@@ -372,10 +372,8 @@ async def list_tools_async():
372372 from jupyter_ai_agents .tools import MCPServerStreamableHTTP
373373
374374 server_urls = [s .strip () for s in mcp_servers .split (',' )]
375- typer .echo ("\n 🔧 Available MCP Tools:" )
376375
377376 for server_url in server_urls :
378- typer .echo (f"\n Connecting to: { server_url } " )
379377 try :
380378 mcp_client = MCPServerStreamableHTTP (server_url )
381379
@@ -384,32 +382,33 @@ async def list_tools_async():
384382 tools = await mcp_client .list_tools ()
385383
386384 if not tools or len (tools ) == 0 :
387- typer .echo (" No tools available" )
385+ typer .echo ("\n No tools available" )
388386 continue
389387
390- typer .echo (f" Found { len (tools )} tools :" )
388+ typer .echo (f"\n Available Tools ( { len (tools )} ) :" )
391389 for tool in tools :
392390 name = tool .name
393391 description = tool .description or ""
394392 schema = tool .inputSchema
395393
394+ # Build parameter list
396395 params = []
397396 if schema and "properties" in schema :
398397 for param_name , param_info in schema ["properties" ].items ():
399398 param_type = param_info .get ("type" , "any" )
400399 params .append (f"{ param_name } : { param_type } " )
401400
402401 param_str = f"({ ', ' .join (params )} )" if params else "()"
403- desc_first_line = description .split ('\n ' )[0 ] if description else ""
404- typer .echo (f" • { name } { param_str } - { desc_first_line } " )
402+ desc_first_line = description .split ('\n ' )[0 ] if description else "No description "
403+ typer .echo (f" • { name } { param_str } - { desc_first_line } " )
405404 except Exception as e :
406405 logger .warning (f"Could not connect to { server_url } : { e } " )
407- typer .echo (f" ⚠️ Could not connect: { e } " )
406+ typer .echo (f"\n ⚠️ Could not list tools from { server_url } " )
408407
409408 except Exception as e :
410409 logger .warning (f"Could not list tools: { e } " )
411- typer .echo (f"\n ⚠️ Could not list tools: { e } " )
412- typer . echo ( " The agent will still work with available tools \n " )
410+ typer .echo (f"\n ⚠️ Could not list tools: { e } " )
411+
413412
414413 try :
415414 from pydantic_ai import Agent
@@ -460,6 +459,12 @@ async def list_tools_async():
460459 )
461460 model_display_name = model # azure-openai:deployment-name
462461 logger .info (f"Using Azure OpenAI deployment: { deployment_name } " )
462+ elif model .startswith ('anthropic:' ):
463+ # Parse anthropic:model-name format and use create_model_with_provider
464+ model_name_part = model .split (':' , 1 )[1 ]
465+ model_obj = create_model_with_provider ('anthropic' , model_name_part , timeout )
466+ model_display_name = model
467+ logger .info (f"Using Anthropic model: { model_name_part } (timeout: { timeout } s)" )
463468 else :
464469 model_obj = model
465470 model_display_name = model
@@ -485,7 +490,17 @@ async def list_tools_async():
485490 mcp_client = MCPServerStreamableHTTP (server_url )
486491 toolsets .append (mcp_client )
487492
488- # List tools before starting the agent (separate asyncio.run call)
493+ # Display welcome message
494+ typer .echo ("=" * 70 )
495+ typer .echo ("🪐 ✨ Jupyter AI Agents - Interactive REPL" )
496+ typer .echo ("=" * 70 )
497+ typer .echo (f"Model: { model_display_name } " )
498+
499+ typer .echo (f"MCP Servers: { len (server_urls )} connected" )
500+ for server_url in server_urls :
501+ typer .echo (f" - { server_url } " )
502+
503+ # List tools inline in welcome message
489504 asyncio .run (list_tools_async ())
490505
491506 # Create default system prompt if not provided
@@ -506,17 +521,6 @@ async def list_tools_async():
506521 system_prompt = instructions ,
507522 )
508523
509- # Display welcome message
510- typer .echo ("=" * 70 )
511- typer .echo ("🪐 ✨ Jupyter AI Agents - Interactive REPL" )
512- typer .echo ("=" * 70 )
513- typer .echo (f"Model: { model_display_name } " )
514-
515- server_urls = [s .strip () for s in mcp_servers .split (',' )]
516- typer .echo (f"MCP Servers: { len (server_urls )} connected" )
517- for server_url in server_urls :
518- typer .echo (f" - { server_url } " )
519-
520524 typer .echo ("=" * 70 )
521525 typer .echo ("\n Special commands:" )
522526 typer .echo (" /exit - Exit the session" )
0 commit comments