Title: Field alias is published in the tool schema but forwarded as an invalid Python keyword · Issue #3099 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Field alias is published in the tool schema but forwarded as an invalid Python keyword · Issue #3099 · modelcontextprotocol/python-sdk
X Title: Field alias is published in the tool schema but forwarded as an invalid Python keyword · Issue #3099 · modelcontextprotocol/python-sdk
Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK. I confirm that I searched the issue tracker before opening this issue. Description For a function parameter annotated with Field(alias="externalX"), the genera...
Open Graph Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK. I confirm that I searched the issue tracker before opening this issue. Description For a function parameter annotated w...
X Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK. I confirm that I searched the issue tracker before opening this issue. Description For a function parameter annotat...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/3099
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Field alias is published in the tool schema but forwarded as an invalid Python keyword","articleBody":"### Initial Checks\n\n- [x] I confirm that I'm using the latest version of MCP Python SDK.\n- [x] I confirm that I searched the issue tracker before opening this issue.\n\n### Description\n\nFor 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:\n\n```text\nToolError: Error executing tool f: f() got an unexpected keyword argument 'externalX'\n```\n\nI expected the schema-valid input to be mapped back to the Python parameter `x` before invocation.\n\n### Example Code\n\n```python\nimport asyncio\nfrom typing import Annotated\n\ntry:\n from mcp.server.mcpserver.tools.base import Tool\nexcept ImportError: # MCP Python SDK 1.x\n from mcp.server.fastmcp.tools.base import Tool\n\nfrom pydantic import Field\n\n\nAliasInt = Annotated[int, Field(alias=\"externalX\", ge=1)]\n\n\ndef f(x: AliasInt) -> int:\n return x\n\n\nasync def main() -> None:\n tool = Tool.from_function(f)\n print(tool.parameters)\n print(await tool.run({\"externalX\": 1}, None))\n\n\nasyncio.run(main())\n```\n\nThe printed schema requires `externalX`, then the call fails with the error above.\n\n### Python & MCP Python SDK\n\n```text\nStable reproduction:\n- Python 3.13.13\n- mcp 1.28.1\n- pydantic 2.13.4\n\nCurrent main reproduction:\n- modelcontextprotocol/python-sdk commit 2713b53b127afc094dc97d6067df9f69b647661c\n- mcp 2.0.0b2\n- mcp-types 2.0.0b2\n- Python 3.13.13\n```\n","author":{"url":"https://github.com/destire-mio","@type":"Person","name":"destire-mio"},"datePublished":"2026-07-16T02:31:00Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3099"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3bbb77dd-1edb-b84c-789c-bbe3f12dbb6b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E816:26ECEB:B70710:EC5069:6B00E895 |
| html-safe-nonce | 4e4cc1c60f90553b3ade64ce342d4b3b7b46d96ba326db2be8135a8355cd4b9e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODE2OjI2RUNFQjpCNzA3MTA6RUM1MDY5OjZCMDBFODk1IiwidmlzaXRvcl9pZCI6IjMyOTMwMzgyODQ3NjIwNDg2NjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | e57a7272bdd9f65905816a12d191efbdbd5eb2043cd2fcd113b39d921ff85c73 |
| hovercard-subject-tag | issue:4898115981 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/3099/issue_layout |
| twitter:image | https://opengraph.githubassets.com/414959092e77530c01bf38089dd2e66479db580e7c45f18e0029a3a54f2a7577/modelcontextprotocol/python-sdk/issues/3099 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/414959092e77530c01bf38089dd2e66479db580e7c45f18e0029a3a54f2a7577/modelcontextprotocol/python-sdk/issues/3099 |
| og:image:alt | Initial Checks I confirm that I'm using the latest version of MCP Python SDK. I confirm that I searched the issue tracker before opening this issue. Description For a function parameter annotated w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | destire-mio |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width