Skip to content

Commit 24116cd

Browse files
committed
the tools property now allows extensions to show up with their own validation schema, but still uses MCP by default
1 parent f4fe448 commit 24116cd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

jupyter_server/extension/manager.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff 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?

0 commit comments

Comments
 (0)