Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Field alias is published in the tool schema but forwarded as an invalid Python keyword

Open
#3,099 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
api, backend

Research direction

Start by reading the Tool.from_function and Tool.run entry points and run the provided reproduction with an aliased parameter. Trace how the schema name externalX is passed to the function, then add coverage showing that schema-valid input invokes f with x and returns successfully.

Written by the indexing model from the issue text.

Description

bug needs confirmation P2 v1 v2
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 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
import asyncio
from typing import Annotated

try:
    from mcp.server.mcpserver.tools.base import Tool
except ImportError:  # MCP Python SDK 1.x
    from mcp.server.fastmcp.tools.base import Tool

from pydantic import Field


AliasInt = Annotated[int, Field(alias="externalX", ge=1)]


def f(x: AliasInt) -> int:
    return x


async def main() -> None:
    tool = Tool.from_function(f)
    print(tool.parameters)
    print(await tool.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
Dominant language
Python
Stars
24.3k
Forks
4k
Avg merge
1d 11h
Merged PRs (30d)
30

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from modelcontextprotocol/python-sdk

All issues in modelcontextprotocol/python-sdk

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.