mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
fix showing list of MCP tools
This commit is contained in:
parent
fe6c033427
commit
7dd54112cb
1 changed files with 13 additions and 9 deletions
|
@ -253,16 +253,20 @@ if MCP_AVAILABLE:
|
||||||
"""
|
"""
|
||||||
list_tools_result: List[ListMCPToolsRestAPIResponseObject] = []
|
list_tools_result: List[ListMCPToolsRestAPIResponseObject] = []
|
||||||
for server in global_mcp_server_manager.mcp_servers:
|
for server in global_mcp_server_manager.mcp_servers:
|
||||||
tools = await global_mcp_server_manager._get_tools_from_server(server)
|
try:
|
||||||
for tool in tools:
|
tools = await global_mcp_server_manager._get_tools_from_server(server)
|
||||||
list_tools_result.append(
|
for tool in tools:
|
||||||
ListMCPToolsRestAPIResponseObject(
|
list_tools_result.append(
|
||||||
name=tool.name,
|
ListMCPToolsRestAPIResponseObject(
|
||||||
description=tool.description,
|
name=tool.name,
|
||||||
inputSchema=tool.inputSchema,
|
description=tool.description,
|
||||||
mcp_info=server.mcp_info,
|
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
|
return list_tools_result
|
||||||
|
|
||||||
@router.post("/tools/call", dependencies=[Depends(user_api_key_auth)])
|
@router.post("/tools/call", dependencies=[Depends(user_api_key_auth)])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue