mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 18:00:36 +00:00
fix: update MCP tool runtime provider to use new function signatures
Updated list_mcp_tools and invoke_mcp_tool calls to use named parameters instead of positional arguments to match the refactored API signatures.
This commit is contained in:
parent
76fdff4a85
commit
7db4ed7bbb
1 changed files with 7 additions and 2 deletions
|
|
@ -45,7 +45,7 @@ class ModelContextProtocolToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime
|
||||||
if mcp_endpoint is None:
|
if mcp_endpoint is None:
|
||||||
raise ValueError("mcp_endpoint is required")
|
raise ValueError("mcp_endpoint is required")
|
||||||
headers = await self.get_headers_from_request(mcp_endpoint.uri)
|
headers = await self.get_headers_from_request(mcp_endpoint.uri)
|
||||||
return await list_mcp_tools(mcp_endpoint.uri, headers)
|
return await list_mcp_tools(endpoint=mcp_endpoint.uri, headers=headers)
|
||||||
|
|
||||||
async def invoke_tool(self, tool_name: str, kwargs: dict[str, Any]) -> ToolInvocationResult:
|
async def invoke_tool(self, tool_name: str, kwargs: dict[str, Any]) -> ToolInvocationResult:
|
||||||
tool = await self.tool_store.get_tool(tool_name)
|
tool = await self.tool_store.get_tool(tool_name)
|
||||||
|
|
@ -56,7 +56,12 @@ class ModelContextProtocolToolRuntimeImpl(ToolGroupsProtocolPrivate, ToolRuntime
|
||||||
raise ValueError(f"Endpoint {endpoint} is not a valid HTTP(S) URL")
|
raise ValueError(f"Endpoint {endpoint} is not a valid HTTP(S) URL")
|
||||||
|
|
||||||
headers = await self.get_headers_from_request(endpoint)
|
headers = await self.get_headers_from_request(endpoint)
|
||||||
return await invoke_mcp_tool(endpoint, headers, tool_name, kwargs)
|
return await invoke_mcp_tool(
|
||||||
|
endpoint=endpoint,
|
||||||
|
tool_name=tool_name,
|
||||||
|
kwargs=kwargs,
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
|
|
||||||
async def get_headers_from_request(self, mcp_endpoint_uri: str) -> dict[str, str]:
|
async def get_headers_from_request(self, mcp_endpoint_uri: str) -> dict[str, str]:
|
||||||
def canonicalize_uri(uri: str) -> str:
|
def canonicalize_uri(uri: str) -> str:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue