feat: add _meta to more objects (#963)

This commit is contained in:
Felix Weinberger 2025-06-16 11:43:54 -04:00 • committed by GitHub
commit 1eb1bba83c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,8 +69,7 @@ class NotificationParams(BaseModel):
meta: Meta | None = Field(alias="_meta", default=None) meta: Meta | None = Field(alias="_meta", default=None)
""" """
This parameter name is reserved by MCP to allow clients and servers to attach Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
additional metadata to their notifications.
""" """
@ -105,13 +104,11 @@ class Notification(BaseModel, Generic[NotificationParamsT, MethodT]):
class Result(BaseModel): class Result(BaseModel):
"""Base class for JSON-RPC results.""" """Base class for JSON-RPC results."""
model_config = ConfigDict(extra="allow")
meta: dict[str, Any] | None = Field(alias="_meta", default=None) meta: dict[str, Any] | None = Field(alias="_meta", default=None)
""" """
This result property is reserved by the protocol to allow clients and servers to Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
attach additional metadata to their responses.
""" """
model_config = ConfigDict(extra="allow")
class PaginatedResult(Result): class PaginatedResult(Result):
@ -394,6 +391,10 @@ class Resource(BaseModel):
This can be used by Hosts to display file sizes and estimate context window usage. This can be used by Hosts to display file sizes and estimate context window usage.
""" """
annotations: Annotations | None = None annotations: Annotations | None = None
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
"""
model_config = ConfigDict(extra="allow") model_config = ConfigDict(extra="allow")
@ -415,6 +416,10 @@ class ResourceTemplate(BaseModel):
included if all resources matching this template have the same type. included if all resources matching this template have the same type.
""" """
annotations: Annotations | None = None annotations: Annotations | None = None
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
"""
model_config = ConfigDict(extra="allow") model_config = ConfigDict(extra="allow")
@ -461,6 +466,10 @@ class ResourceContents(BaseModel):
"""The URI of this resource.""" """The URI of this resource."""
mimeType: str | None = None mimeType: str | None = None
"""The MIME type of this resource, if known.""" """The MIME type of this resource, if known."""
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
"""
model_config = ConfigDict(extra="allow") model_config = ConfigDict(extra="allow")
@ -588,6 +597,10 @@ class Prompt(BaseModel):
"""An optional description of what this prompt provides.""" """An optional description of what this prompt provides."""
arguments: list[PromptArgument] | None = None arguments: list[PromptArgument] | None = None
"""A list of arguments to use for templating the prompt.""" """A list of arguments to use for templating the prompt."""
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
"""
model_config = ConfigDict(extra="allow") model_config = ConfigDict(extra="allow")
@ -621,6 +634,10 @@ class TextContent(BaseModel):
text: str text: str
"""The text content of the message.""" """The text content of the message."""
annotations: Annotations | None = None annotations: Annotations | None = None
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
"""
model_config = ConfigDict(extra="allow") model_config = ConfigDict(extra="allow")
@ -636,6 +653,10 @@ class ImageContent(BaseModel):
image types. image types.
""" """
annotations: Annotations | None = None annotations: Annotations | None = None
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
"""
model_config = ConfigDict(extra="allow") model_config = ConfigDict(extra="allow")
@ -651,6 +672,10 @@ class AudioContent(BaseModel):
audio types. audio types.
""" """
annotations: Annotations | None = None annotations: Annotations | None = None
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
"""
model_config = ConfigDict(extra="allow") model_config = ConfigDict(extra="allow")
@ -673,6 +698,10 @@ class EmbeddedResource(BaseModel):
type: Literal["resource"] type: Literal["resource"]
resource: TextResourceContents | BlobResourceContents resource: TextResourceContents | BlobResourceContents
annotations: Annotations | None = None annotations: Annotations | None = None
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
"""
model_config = ConfigDict(extra="allow") model_config = ConfigDict(extra="allow")
@ -772,6 +801,10 @@ class Tool(BaseModel):
"""A JSON Schema object defining the expected parameters for the tool.""" """A JSON Schema object defining the expected parameters for the tool."""
annotations: ToolAnnotations | None = None annotations: ToolAnnotations | None = None
"""Optional additional tool information.""" """Optional additional tool information."""
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
"""
model_config = ConfigDict(extra="allow") model_config = ConfigDict(extra="allow")
@ -1064,6 +1097,10 @@ class Root(BaseModel):
identifier for the root, which may be useful for display purposes or for identifier for the root, which may be useful for display purposes or for
referencing the root in other parts of the application. referencing the root in other parts of the application.
""" """
meta: dict[str, Any] | None = Field(alias="_meta", default=None)
"""
Reserved by MCP for protocol-level metadata; implementations must not make assumptions about its contents.
"""
model_config = ConfigDict(extra="allow") model_config = ConfigDict(extra="allow")