Skip to content

fix: set default values for type in message content models #712

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/mcp/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ class GetPromptRequest(Request[GetPromptRequestParams, Literal["prompts/get"]]):
class TextContent(BaseModel):
"""Text content for a message."""

type: Literal["text"]
type: Literal["text"] = "text"
text: str
"""The text content of the message."""
annotations: Annotations | None = None
Expand All @@ -639,7 +639,7 @@ class TextContent(BaseModel):
class ImageContent(BaseModel):
"""Image content for a message."""

type: Literal["image"]
type: Literal["image"] = "image"
data: str
"""The base64-encoded image data."""
mimeType: str
Expand Down Expand Up @@ -667,7 +667,7 @@ class EmbeddedResource(BaseModel):
of the LLM and/or the user.
"""

type: Literal["resource"]
type: Literal["resource"] = "resource"
resource: TextResourceContents | BlobResourceContents
annotations: Annotations | None = None
model_config = ConfigDict(extra="allow")
Expand Down
Loading