File tree Expand file tree Collapse file tree 3 files changed +2
-9
lines changed
Expand file tree Collapse file tree 3 files changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -236,7 +236,7 @@ def run(
236236 def _setup_handlers (self ) -> None :
237237 """Set up core MCP protocol handlers."""
238238 self ._mcp_server .list_tools ()(self .list_tools )
239- self ._mcp_server .call_tool ()(self .call_tool , self ._get_schema )
239+ self ._mcp_server .call_tool ()(self .call_tool , self ._tool_manager . get_schema )
240240 self ._mcp_server .list_resources ()(self .list_resources )
241241 self ._mcp_server .read_resource ()(self .read_resource )
242242 self ._mcp_server .list_prompts ()(self .list_prompts )
@@ -277,9 +277,6 @@ async def call_tool(
277277 converted_result = _convert_to_content (result )
278278 return converted_result
279279
280- def _get_schema (self , name : str ) -> dict [str , Any ] | None :
281- return self ._tool_manager .get_schema (name )
282-
283280 async def list_resources (self ) -> list [MCPResource ]:
284281 """List all available resources."""
285282
Original file line number Diff line number Diff line change @@ -94,14 +94,13 @@ async def run(
9494 ) -> Any :
9595 """Run the tool with arguments."""
9696 try :
97- result = await self .fn_metadata .call_fn_with_arg_validation (
97+ return await self .fn_metadata .call_fn_with_arg_validation (
9898 self .fn ,
9999 self .is_async ,
100100 arguments ,
101101 {self .context_kwarg : context }
102102 if self .context_kwarg is not None
103103 else None ,
104104 )
105- return result
106105 except Exception as e :
107106 raise ToolError (f"Error executing tool { self .name } : { e } " ) from e
Original file line number Diff line number Diff line change @@ -486,7 +486,6 @@ def handle_error(e: Exception):
486486 )
487487
488488 if schema_func is None :
489-
490489 async def handler (req : types .CallToolRequest ):
491490 try :
492491 result = await func (
@@ -495,9 +494,7 @@ async def handler(req: types.CallToolRequest):
495494 return handle_result_without_schema (req , result )
496495 except Exception as e :
497496 return handle_error (e )
498-
499497 else :
500-
501498 async def handler (req : types .CallToolRequest ):
502499 try :
503500 result = await func (
You can’t perform that action at this time.
0 commit comments