Proper handle extra data in MCP objects (#1937)
This commit is contained in:
parent
5301298225
commit
a1d330de9f
1 changed files with 42 additions and 155 deletions
|
|
@ -30,10 +30,9 @@ TASK_REQUIRED: Final[Literal["required"]] = "required"
|
|||
|
||||
|
||||
class MCPModel(BaseModel):
|
||||
"""Base class for all MCP protocol types. Allows extra fields for forward compatibility."""
|
||||
"""Base class for all MCP protocol types."""
|
||||
|
||||
# TODO(Marcelo): The extra="allow" should be only on specific types e.g. `Meta`, not on the base class.
|
||||
model_config = ConfigDict(extra="allow", alias_generator=to_camel, populate_by_name=True)
|
||||
model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True)
|
||||
|
||||
|
||||
Meta: TypeAlias = dict[str, Any]
|
||||
|
|
@ -472,10 +471,13 @@ class GetTaskPayloadRequest(Request[GetTaskPayloadRequestParams, Literal["tasks/
|
|||
|
||||
class GetTaskPayloadResult(Result):
|
||||
"""The response to a tasks/result request.
|
||||
|
||||
The structure matches the result type of the original request.
|
||||
For example, a tools/call task would return the CallToolResult structure.
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(extra="allow", alias_generator=to_camel, populate_by_name=True)
|
||||
|
||||
|
||||
class CancelTaskRequestParams(RequestParams):
|
||||
task_id: str
|
||||
|
|
|
|||
Loading…
Reference in a new issue