Initial Checks
Description
For a function parameter annotated with Field(alias="externalX"), the generated tool schema correctly requires externalX. At runtime, however, that wire name is forwarded directly to the original function, so the call fails with:
ToolError: Error executing tool f: f() got an unexpected keyword argument 'externalX'
I expected the schema-valid input to be mapped back to the Python parameter x before invocation.
Example Code
importasynciofromtypingimportAnnotatedtry:
frommcp.server.mcpserver.tools.baseimportToolexceptImportError: # MCP Python SDK 1.xfrommcp.server.fastmcp.tools.baseimportToolfrompydanticimportFieldAliasInt=Annotated[int, Field(alias="externalX", ge=1)]
deff(x: AliasInt) ->int:
returnxasyncdefmain() ->None:
tool=Tool.from_function(f)
print(tool.parameters)
print(awaittool.run({"externalX": 1}, None))
asyncio.run(main())The printed schema requires externalX, then the call fails with the error above.
Python & MCP Python SDK
Stable reproduction:
- Python 3.13.13
- mcp 1.28.1
- pydantic 2.13.4
Current main reproduction:
- modelcontextprotocol/python-sdk commit 2713b53b127afc094dc97d6067df9f69b647661c
- mcp 2.0.0b2
- mcp-types 2.0.0b2
- Python 3.13.13
Initial Checks
Description
For a function parameter annotated with
Field(alias="externalX"), the generated tool schema correctly requiresexternalX. At runtime, however, that wire name is forwarded directly to the original function, so the call fails with:I expected the schema-valid input to be mapped back to the Python parameter
xbefore invocation.Example Code
The printed schema requires
externalX, then the call fails with the error above.Python & MCP Python SDK