1010from mcp .types .jsonrpc import RequestId
1111
1212LATEST_PROTOCOL_VERSION = "2025-11-25"
13+ """The latest version of the Model Context Protocol.
1314
15+ You can find the latest specification at https://modelcontextprotocol.io/specification/latest.
1416"""
15- The default negotiated version of the Model Context Protocol when no version is specified.
16- We need this to satisfy the MCP specification, which requires the server to assume a
17- specific version if none is provided by the client. See section "Protocol Version Header" at
18- https://modelcontextprotocol.io/specification
19- """
17+
2018DEFAULT_NEGOTIATED_VERSION = "2025-03-26"
19+ """The default negotiated version of the Model Context Protocol when no version is specified.
20+
21+ We need this to satisfy the MCP specification, which requires the server to assume a specific version if none is
22+ provided by the client.
23+
24+ See the "Protocol Version Header" at
25+ https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#protocol-version-header).
26+ """
2127
2228ProgressToken = str | int
23- Cursor = str
2429Role = Literal ["user" , "assistant" ]
2530
2631TaskExecutionMode = Literal ["forbidden" , "optional" , "required" ]
@@ -50,6 +55,7 @@ class RequestParamsMeta(TypedDict, extra_items=Any):
5055
5156class TaskMetadata (MCPModel ):
5257 """Metadata for augmenting a request with task execution.
58+
5359 Include this in the `task` field of the request parameters.
5460 """
5561
@@ -72,9 +78,9 @@ class RequestParams(MCPModel):
7278
7379
7480class PaginatedRequestParams (RequestParams ):
75- cursor : Cursor | None = None
76- """
77- An opaque token representing the current pagination position.
81+ cursor : str | None = None
82+ """An opaque token representing the current pagination position.
83+
7884 If provided, the server should return results starting after this cursor.
7985 """
8086
@@ -124,7 +130,7 @@ class Result(MCPModel):
124130
125131
126132class PaginatedResult (Result ):
127- next_cursor : Cursor | None = None
133+ next_cursor : str | None = None
128134 """
129135 An opaque token representing the pagination position after the last returned result.
130136 If present, there may be more results available.
@@ -369,16 +375,22 @@ class ServerCapabilities(MCPModel):
369375
370376 experimental : dict [str , dict [str , Any ]] | None = None
371377 """Experimental, non-standard capabilities that the server supports."""
378+
372379 logging : LoggingCapability | None = None
373380 """Present if the server supports sending log messages to the client."""
381+
374382 prompts : PromptsCapability | None = None
375383 """Present if the server offers any prompt templates."""
384+
376385 resources : ResourcesCapability | None = None
377386 """Present if the server offers any resources to read."""
387+
378388 tools : ToolsCapability | None = None
379389 """Present if the server offers any tools to call."""
390+
380391 completions : CompletionsCapability | None = None
381392 """Present if the server offers autocompletion suggestions for prompts and resources."""
393+
382394 tasks : ServerTasksCapability | None = None
383395 """Present if the server supports task-augmented requests."""
384396
@@ -413,8 +425,8 @@ class Task(MCPModel):
413425 """Current task state."""
414426
415427 status_message : str | None = None
416- """
417- Optional human-readable message describing the current task state.
428+ """Optional human-readable message describing the current task state.
429+
418430 This can provide context for any status, including:
419431 - Reasons for "cancelled" status
420432 - Summaries for "completed" status
@@ -583,16 +595,14 @@ class ProgressNotificationParams(NotificationParams):
583595 total : float | None = None
584596 """Total number of items to process (or total progress required), if known."""
585597 message : str | None = None
586- """
587- Message related to progress. This should provide relevant human readable
588- progress information.
598+ """Message related to progress.
599+
600+ This should provide relevant human readable progress information.
589601 """
590602
591603
592604class ProgressNotification (Notification [ProgressNotificationParams , Literal ["notifications/progress" ]]):
593- """An out-of-band notification used to inform the receiver of a progress update for a
594- long-running request.
595- """
605+ """An out-of-band notification used to inform the receiver of a progress update for a long-running request."""
596606
597607 method : Literal ["notifications/progress" ] = "notifications/progress"
598608 params : ProgressNotificationParams
@@ -614,20 +624,24 @@ class Resource(BaseMetadata):
614624
615625 uri : str
616626 """The URI of this resource."""
627+
617628 description : str | None = None
618629 """A description of what this resource represents."""
630+
619631 mime_type : str | None = None
620632 """The MIME type of this resource, if known."""
633+
621634 size : int | None = None
622- """
623- The size of the raw resource content, in bytes (i.e., before base64 encoding
624- or any tokenization), if known.
635+ """The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.
625636
626637 This can be used by Hosts to display file sizes and estimate context window usage.
627638 """
639+
628640 icons : list [Icon ] | None = None
629641 """An optional list of icons for this resource."""
642+
630643 annotations : Annotations | None = None
644+
631645 meta : Meta | None = Field (alias = "_meta" , default = None )
632646 """
633647 See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
@@ -639,20 +653,22 @@ class ResourceTemplate(BaseMetadata):
639653 """A template description for resources available on the server."""
640654
641655 uri_template : str
642- """
643- A URI template (according to RFC 6570) that can be used to construct resource
644- URIs.
645- """
656+ """A URI template (according to RFC 6570) that can be used to construct resource URIs."""
657+
646658 description : str | None = None
647659 """A human-readable description of what this template is for."""
660+
648661 mime_type : str | None = None
662+ """The MIME type for all resources that match this template.
663+
664+ This should only be included if all resources matching this template have the same type.
649665 """
650- The MIME type for all resources that match this template. This should only be
651- included if all resources matching this template have the same type.
652- """
666+
653667 icons : list [Icon ] | None = None
654668 """An optional list of icons for this resource template."""
669+
655670 annotations : Annotations | None = None
671+
656672 meta : Meta | None = Field (alias = "_meta" , default = None )
657673 """
658674 See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
0 commit comments