Describe the bug
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:
export interface Request {
method: string;
params?: {
_meta?: {
progressToken?: ProgressToken;
};
[key: string]: unknown;
};
}
- The Python class only allows extra fields inside the Meta class:
class RequestParams(BaseModel):
class Meta(BaseModel):
progressToken: ProgressToken | None = None
model_config = ConfigDict(extra="allow")
meta: Meta | None = Field(alias="_meta", default=None)Reactions are currently unavailable
Describe the bug
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.:
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