mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-07 11:08:20 +00:00
Fix to issue 1586
This commit is contained in:
parent
a1bb7c8d82
commit
fbe3c9c588
1 changed files with 7 additions and 2 deletions
|
@ -36,7 +36,12 @@ class ModelContextProtocolToolRuntimeImpl(ToolsProtocolPrivate, ToolRuntime):
|
|||
raise ValueError("mcp_endpoint is required")
|
||||
|
||||
tools = []
|
||||
async with sse_client(mcp_endpoint.uri) as streams:
|
||||
if hasattr(mcp_endpoint, "__getitem__"):
|
||||
if mcp_endpoint["uri"] is not None:
|
||||
uri = mcp_endpoint["uri"]
|
||||
else:
|
||||
uri = mcp_endpoint.uri
|
||||
async with sse_client(uri) as streams:
|
||||
async with ClientSession(*streams) as session:
|
||||
await session.initialize()
|
||||
tools_result = await session.list_tools()
|
||||
|
@ -56,7 +61,7 @@ class ModelContextProtocolToolRuntimeImpl(ToolsProtocolPrivate, ToolRuntime):
|
|||
description=tool.description,
|
||||
parameters=parameters,
|
||||
metadata={
|
||||
"endpoint": mcp_endpoint.uri,
|
||||
"endpoint": uri,
|
||||
},
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue