File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -417,10 +417,13 @@ async def _get_cached_tool_definition(self, tool_name: str) -> types.Tool | None
417417
418418 return tool
419419
420- def call_tool (self ):
420+ def call_tool (self , * , validate_input : bool = True ):
421421 """Register a tool call handler.
422422
423- The handler validates input against inputSchema, calls the tool function,
423+ Args:
424+ validate_input: If True, validates input against inputSchema. Default is True.
425+
426+ The handler validates input against inputSchema (if validate_input=True), calls the tool function,
424427 and builds a CallToolResult with the results:
425428 - Unstructured content (iterable of ContentBlock): returned in content
426429 - Structured content (dict): returned in structuredContent, serialized JSON text returned in content
@@ -444,7 +447,7 @@ async def handler(req: types.CallToolRequest):
444447 tool = await self ._get_cached_tool_definition (tool_name )
445448
446449 # input validation
447- if tool :
450+ if validate_input and tool :
448451 try :
449452 jsonschema .validate (instance = arguments , schema = tool .inputSchema )
450453 except jsonschema .ValidationError as e :
You can’t perform that action at this time.
0 commit comments