Skip to content

Commit cf29493

Browse files
committed
Say that the tool schema lookup runs before middleware
1 parent b04cf03 commit cf29493

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎src/mcp/server/lowlevel/server.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ def __init__(
432432
"""Returns a tool's input schema by name, or `None` when there is nothing to validate.
433433
434434
When set, `Mcp-Param-*` header validation on the 2026-07-28 Streamable HTTP
435-
path calls this instead of running the `tools/list` handler. If it raises,
435+
path calls this instead of running the `tools/list` handler. It is called
436+
before middleware runs, so it is not scoped to the caller. If it raises,
436437
the error is logged and the call is served unvalidated.
437438
"""
438439
self._request_handlers: dict[str, HandlerEntry[LifespanResultT]] = {}

‎src/mcp/server/mcpserver/server.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ async def _handle_list_tools(
430430
return ListToolsResult(tools=await self.list_tools())
431431

432432
def _tool_input_schema(self, name: str) -> dict[str, Any] | None:
433+
"""Called before middleware runs, so it also finds a tool that middleware hides from the caller."""
433434
tool = self._tool_manager.get_tool(name)
434435
return None if tool is None else tool.parameters
435436

0 commit comments

Comments
 (0)