File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -145,10 +145,16 @@ def tools(self):
145145
146146 tools = {}
147147 try :
148- definitions = tools_func ()
149- for name , tool in definitions .items ():
150- # not sure if we should just pick MCP schema or make the schema something the user can pass
151- jsonschema .validate (instance = tool ["metadata" ], schema = MCP_TOOL_SCHEMA )
148+ result = tools_func ()
149+ # Support (tools_dict, schema) or just tools_dict
150+ if isinstance (result , tuple ) and len (result ) == 2 :
151+ tools_dict , schema = result
152+ else :
153+ tools_dict = result
154+ schema = MCP_TOOL_SCHEMA
155+
156+ for name , tool in tools_dict .items ():
157+ jsonschema .validate (instance = tool ["metadata" ], schema = schema )
152158 tools [name ] = tool
153159 except Exception as e :
154160 # not sure if this should fail quietly, raise an error, or log it?
You can’t perform that action at this time.
0 commit comments