|
1 | 1 | from collections.abc import Callable |
| 2 | +from enum import Enum |
2 | 3 | from typing import ( |
3 | 4 | Annotated, |
4 | 5 | Any, |
@@ -368,15 +369,31 @@ class Annotations(BaseModel): |
368 | 369 | model_config = ConfigDict(extra="allow") |
369 | 370 |
|
370 | 371 |
|
| 372 | +class ResourceStatus(str, Enum): |
| 373 | + """The status of a resource.""" |
| 374 | + |
| 375 | + READY = "ready" |
| 376 | + """Resource is ready to be read.""" |
| 377 | + PENDING = "pending" |
| 378 | + """Resource is being created or processed.""" |
| 379 | + ERROR = "error" |
| 380 | + """Resource has an error state.""" |
| 381 | + DELETED = "deleted" |
| 382 | + """Resource has been deleted.""" |
| 383 | + |
| 384 | + |
371 | 385 | class Resource(BaseModel): |
372 | 386 | """A known resource that the server is capable of reading.""" |
373 | 387 |
|
| 388 | + type: Literal["resource"] |
374 | 389 | uri: Annotated[AnyUrl, UrlConstraints(host_required=False)] |
375 | 390 | """The URI of this resource.""" |
376 | 391 | name: str |
377 | 392 | """A human-readable name for this resource.""" |
378 | 393 | description: str | None = None |
379 | 394 | """A description of what this resource represents.""" |
| 395 | + status: ResourceStatus | None = None |
| 396 | + """The status of this resource.""" |
380 | 397 | mimeType: str | None = None |
381 | 398 | """The MIME type of this resource, if known.""" |
382 | 399 | size: int | None = None |
@@ -791,7 +808,7 @@ class CallToolRequest(Request[CallToolRequestParams, Literal["tools/call"]]): |
791 | 808 | class CallToolResult(Result): |
792 | 809 | """The server's response to a tool call.""" |
793 | 810 |
|
794 | | - content: list[TextContent | ImageContent | EmbeddedResource] |
| 811 | + content: list[TextContent | ImageContent | EmbeddedResource | Resource] |
795 | 812 | isError: bool = False |
796 | 813 |
|
797 | 814 |
|
|
0 commit comments