Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix showing list of MCP tools

Ishaan Jaff7dd54112cb57
diff --git a/litellm/proxy/_experimental/mcp_server/server.py b/litellm/proxy/_experimental/mcp_server/server.py
index 1469f523b42..4cfed9a603d 100644
--- a/litellm/proxy/_experimental/mcp_server/server.py
+++ b/litellm/proxy/_experimental/mcp_server/server.py
@@ -253,16 +253,20 @@ if MCP_AVAILABLE:
"""
list_tools_result: List[ListMCPToolsRestAPIResponseObject] = []
for server in global_mcp_server_manager.mcp_servers:
- tools = await global_mcp_server_manager._get_tools_from_server(server)
- for tool in tools:
- list_tools_result.append(
- ListMCPToolsRestAPIResponseObject(
- name=tool.name,
- description=tool.description,
- inputSchema=tool.inputSchema,
- mcp_info=server.mcp_info,
+ try:
+ tools = await global_mcp_server_manager._get_tools_from_server(server)
+ for tool in tools:
+ list_tools_result.append(
+ ListMCPToolsRestAPIResponseObject(
+ name=tool.name,
+ description=tool.description,
+ inputSchema=tool.inputSchema,
+ mcp_info=server.mcp_info,
+ )
)
- )
+ except Exception as e:
+ verbose_logger.error(f"Error getting tools from {server.name}: {e}")
+ continue
return list_tools_result
@router.post("/tools/call", dependencies=[Depends(user_api_key_auth)])