[FIX] mcp: read the tool schema by its wire name - #193
Merged
Conversation
The gateway took the schema off the SDK's attribute, which is not part of any contract: mcp 2.0 renamed it to input_schema, the list comprehension raised AttributeError for every server, and agents were served an empty tool list. `model_dump(by_alias=True)` returns the field under its protocol name, which the spec fixes and both majors agree on. This does not make 2.0 work on its own — the servers still use decorators it dropped — but it removes the gateway's dependency on which major is installed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #190.
The gateway read the tool schema off the SDK's Python attribute
(
tool.inputSchema), which is not part of any contract. mcp 2.0 renamed it toinput_schema; the list comprehension raisedAttributeErrorfor every server,_connectreported "connection failed", and agents were served an empty toollist.
model_dump(by_alias=True)returns the field under its protocol name, whichthe MCP spec fixes and which both majors agree on — verified against 1.29.1 and
2.0.0, identical result. The gateway no longer cares which major is installed.
This does not make 2.0 work on its own. Scope of what remains, measured:
plugins/ms365/server.pyplugins/livekit-agent/server.pytests/unit/mcp_gateway/echo_server.pyNotes for whoever picks up the rest:
inputSchemaoccurrences counted on Migrate to mcp 2.x (Tool.inputSchema renamed to input_schema) #190 are mostly a falsepositive. Almost all are plain dicts in the wire format or in the
Anthropic/OpenAI/Gemini tool formats, and none of those change.
gmailandgoogle-workspaceimplement JSON-RPC by hand and never touch the SDK server.Tool(inputSchema=...)still constructs fine on 2.0 — the alias isaccepted on input. Only attribute reads broke.
@server.list_tools()/@server.call_tool()are gone and
mcp.server.fastmcpwas removed. The successor,mcp.server.mcpserver.MCPServer, derives schemas from function signatures andoffers no way to pass an explicit JSON schema, so the 18 hand-written ms365
schemas cannot move across mechanically. The lower-level
Server.add_request_handler(method, params_type, handler)does allow keepingthe current shape.
and 2.0.0.