Skip to content

Commit f6a5d42

Browse files
committed
added some comments about uncertainties in the logic / layout
1 parent d44f68c commit f6a5d42

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

jupyter_server/extension/manager.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from .utils import ExtensionMetadataError, ExtensionModuleNotFound, get_loader, get_metadata
1717

1818

19+
# probably this should go in it's own file? Not sure where though
1920
MCP_TOOL_SCHEMA = {
2021
"type": "object",
2122
"properties": {
@@ -144,10 +145,11 @@ def tools(self):
144145
try:
145146
definitions = tools_func()
146147
for name, tool in definitions.items():
148+
# not sure if we should just pick MCP schema or make the schema something the user can pass
147149
jsonschema.validate(instance=tool["metadata"], schema=MCP_TOOL_SCHEMA)
148150
tools[name] = tool
149151
except Exception as e:
150-
# You could also `self.log.warning(...)` if you pass the log around
152+
# not sure if this should fail quietly, raise an error, or log it?
151153
print(f"[tool-discovery] Failed to load tools from {self.module_name}: {e}")
152154
return tools
153155

@@ -508,7 +510,7 @@ def get_tools(self) -> Dict[str, Any]:
508510
continue
509511

510512
for point in ext_pkg.extension_points.values():
511-
for name, tool in point.tools.items(): # 🔥 <— new property!
513+
for name, tool in point.tools.items(): # <— new property!
512514
if name in all_tools:
513515
raise ValueError(f"Duplicate tool name detected: '{name}'")
514516
all_tools[name] = tool

jupyter_server/serverapp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,6 +2540,7 @@ def load_server_extensions(self) -> None:
25402540
"""
25412541
self.extension_manager.load_all_extensions()
25422542

2543+
# is this how I would expose it? and Is this a good name?
25432544
def get_tools(self):
25442545
return self.extension_manager.get_tools()
25452546

jupyter_server/services/contents/handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,12 @@ async def post(self, path=""):
423423
self.set_status(201)
424424
self.finish()
425425

426+
# Somehow this doesn't feel like the right service for this to go in?
426427
class ListToolInfoHandler(APIHandler):
427428
@web.authenticated
428429
async def get(self):
429430
tools = self.serverapp.extension_manager.discover_tools()
430-
self.finish({"discovered_tools": tools})
431+
self.finish({"discovered_tools": tools})
431432

432433

433434
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)