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
Inconsistency in types.py schema for RequestParams #913
Not sure if I'm missing something, but I found that I was unable to add extra fields to RequestParams in the MCP Python schema in types.py (e.g., I'm trying to pass auth tokens along for ListToolsRequest). The Python MCP schema ignores extra fields at the top level of RequestParams, but the TypeScript MCP schema does not.
To Reproduce
Try to create a RequestParams instance with an extra field at the top level (not inside meta), e.g.:
RequestParams(foo="bar", meta=None)
The additional field foo is ignored.
Expected behavior
Extra fields at the top level of RequestParams should be accepted, matching the TypeScript schema’s behavior.
Additional context
The TypeScript interface allows arbitrary extra fields at the top level of params via:
I'd like to work on this. The fix adds model_config = ConfigDict(extra="allow") to RequestParams, matching the TypeScript SDK's [key: string]: unknown behavior.
Closing — this was based on the 2025-06-18 schema which did have an index signature on Request.params, but it was deliberately removed in the 2025-11-25 spec as an intentional breaking change (described by the spec author as fixing "a bug that allows usage of arbitrary params").
For your use case (passing auth tokens with ListToolsRequest), _meta is the spec-sanctioned extension point — it already supports extra fields in this SDK via extra_items=Any.
Activity
pyrotank41 commentedon Jun 22, 2025
this PR might help: #1003
Br1an67 commentedon Mar 1, 2026
I'd like to work on this. The fix adds
model_config = ConfigDict(extra="allow")toRequestParams, matching the TypeScript SDK's[key: string]: unknownbehavior.PR: #2188
maxisbey commentedon Mar 5, 2026
Closing — this was based on the 2025-06-18 schema which did have an index signature on
Request.params, but it was deliberately removed in the 2025-11-25 spec as an intentional breaking change (described by the spec author as fixing "a bug that allows usage of arbitrary params").For your use case (passing auth tokens with
ListToolsRequest),_metais the spec-sanctioned extension point — it already supports extra fields in this SDK viaextra_items=Any.AI Disclaimer