You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Field alias is published in the tool schema but forwarded as an invalid Python keyword #3099
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:
This is another tool-schema contract issue: the published JSON Schema advertises a field alias, but the Python call path still forwards the alias as if it were a valid keyword argument — so the tool “exists” in the agent’s schema while the runtime rejects or mis-binds the name.
Isolation that usually resolves it in one pass:
Dump tool schema (what the agent sees) vs actual function signature / pydantic model field names.
Call the tool outside the agent with both the alias and the real keyword — which one succeeds?
I'd like to work on this — I've root-caused it (model_dump_one_level() conflates the SDK's internal reserved-name alias workaround with a user-supplied Field(alias=...), using the alias as the call-time keyword in both cases) and have a fix + regression test ready to submit. Could a maintainer assign this to me or apply ready for work?
Just flagging that a fix for this already exists in #3119 (opened Jul 17, CI green). It is still marked draft because of the repo's open-PR limit for non-write contributors, not because it is unfinished. Reuse or ignore it as suits whoever picks this up.
I'd like to work on this. I have a fix ready that tracks the original parameter names in a ClassVar and uses them in model_dump_one_level(), so the alias is published in the schema but the Python name is forwarded to the function.
Could a maintainer assign this one? #3119 has the fix, open since Jul 17 with CI green. It predates the intake gate so it was never assignment-checked. I'll rebase onto main and mark it ready as soon as it's assigned.
Several people have offered here, so no objection if you'd rather assign someone else. Worth knowing the fix already exists either way.
Activity
nightcityblade commentedon Jul 16, 2026
Hi, I'd like to work on this. I'll submit a PR shortly.
IgorGanapolsky commentedon Jul 16, 2026
This is another tool-schema contract issue: the published JSON Schema advertises a field alias, but the Python call path still forwards the alias as if it were a valid keyword argument — so the tool “exists” in the agent’s schema while the runtime rejects or mis-binds the name.
Isolation that usually resolves it in one pass:
That separates “model chose wrong field” from “schema lied about the callable surface.”
nightcityblade commentedon Jul 17, 2026
I reviewed the contribution guidelines and will wait for maintainer feedback or assignment before starting implementation.
zerafachris commentedon Jul 17, 2026
I'd like to work on this — I've root-caused it (
model_dump_one_level()conflates the SDK's internal reserved-name alias workaround with a user-suppliedField(alias=...), using the alias as the call-time keyword in both cases) and have a fix + regression test ready to submit. Could a maintainer assign this to me or applyready for work?jayzuccarelli commentedon Jul 20, 2026
Just flagging that a fix for this already exists in #3119 (opened Jul 17, CI green). It is still marked draft because of the repo's open-PR limit for non-write contributors, not because it is unfinished. Reuse or ignore it as suits whoever picks this up.
mturac commentedon Aug 30, 2026
I'd like to work on this. I have a fix ready that tracks the original parameter names in a ClassVar and uses them in model_dump_one_level(), so the alias is published in the schema but the Python name is forwarded to the function.
jayzuccarelli commentedon Aug 30, 2026
Could a maintainer assign this one? #3119 has the fix, open since Jul 17 with CI green. It predates the intake gate so it was never assignment-checked. I'll rebase onto main and mark it ready as soon as it's assigned.
Several people have offered here, so no objection if you'd rather assign someone else. Worth knowing the fix already exists either way.