Add resource Link (#974)

This commit is contained in:
Inna Harper 2025-06-17 20:23:07 +01:00 • committed by GitHub
commit d0443a1832
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -733,14 +733,28 @@ class EmbeddedResource(BaseModel):
model_config = ConfigDict(extra="allow")
Content = TextContent | ImageContent | AudioContent | EmbeddedResource
class ResourceLink(Resource):
"""
A resource that the server is capable of reading, included in a prompt or tool call result.
Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
"""
type: Literal["resource_link"]
ContentBlock = TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource
"""A content block that can be used in prompts and tool results."""
Content: TypeAlias = ContentBlock
# """DEPRECATED: Content is deprecated, you should use ContentBlock directly."""
class PromptMessage(BaseModel):
"""Describes a message returned as part of a prompt."""
role: Role
content: Content
content: ContentBlock
model_config = ConfigDict(extra="allow")
@ -859,7 +873,7 @@ class CallToolRequest(Request[CallToolRequestParams, Literal["tools/call"]]):
class CallToolResult(Result):
"""The server's response to a tool call."""
content: list[Content]
content: list[ContentBlock]
isError: bool = False