Skip to content

Index

This module defines the types for the MCP protocol.

Check the latest schema at: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/draft/schema.json

CLIENT_CAPABILITIES_META_KEY module-attribute

CLIENT_CAPABILITIES_META_KEY = (
    "io.modelcontextprotocol/clientCapabilities"
)

Reserved request _meta key: per-request ClientCapabilities (2026-07-28). SDK-managed.

CLIENT_INFO_META_KEY module-attribute

CLIENT_INFO_META_KEY = 'io.modelcontextprotocol/clientInfo'

Reserved request _meta key: the client Implementation (2026-07-28). SDK-managed.

DEFAULT_NEGOTIATED_VERSION module-attribute

DEFAULT_NEGOTIATED_VERSION: Final[str] = '2025-03-26'

The default negotiated version of the Model Context Protocol when no version is specified.

We need this to satisfy the MCP specification, which requires the server to assume a specific version if none is provided by the client.

See the "Protocol Version Header" at https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#protocol-version-header.

LOG_LEVEL_META_KEY module-attribute

LOG_LEVEL_META_KEY = 'io.modelcontextprotocol/logLevel'

Reserved request _meta key: desired log level for this request (2026-07-28).

Deprecated (with the rest of logging) by SEP-2577 in the same revision that introduces it. If absent, the server must not send log notifications.

PROTOCOL_VERSION_META_KEY module-attribute

PROTOCOL_VERSION_META_KEY = (
    "io.modelcontextprotocol/protocolVersion"
)

Reserved request _meta key: the MCP protocol version for this request (2026-07-28).

SDK-managed; for HTTP its value must match the MCP-Protocol-Version header.

Annotations

Bases: MCPModel

Optional annotations the client can use to inform how objects are used or displayed.

Source code in src/mcp-types/mcp_types/_types.py
763
764
765
766
767
768
769
770
771
772
773
774
class Annotations(MCPModel):
    """Optional annotations the client can use to inform how objects are used or displayed."""

    audience: list[Role] | None = None
    """Who the intended audience is, e.g. `["user", "assistant"]`."""

    priority: Annotated[float, Field(ge=0.0, le=1.0)] | None = None
    """How important this data is for operating the server: 1 means effectively
    required, 0 means entirely optional."""

    last_modified: str | None = None
    """ISO 8601 timestamp of when the item was last modified."""

audience class-attribute instance-attribute

audience: list[Role] | None = None

Who the intended audience is, e.g. ["user", "assistant"].

priority class-attribute instance-attribute

priority: Annotated[float, Field(ge=0.0, le=1.0)] | None = (
    None
)

How important this data is for operating the server: 1 means effectively required, 0 means entirely optional.

last_modified class-attribute instance-attribute

last_modified: str | None = None

ISO 8601 timestamp of when the item was last modified.

AudioContent

Bases: MCPModel

Audio provided to or from an LLM.

Source code in src/mcp-types/mcp_types/_types.py
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
class AudioContent(MCPModel):
    """Audio provided to or from an LLM."""

    type: Literal["audio"] = "audio"
    data: str
    """The base64-encoded audio data."""
    mime_type: str
    """
    The MIME type of the audio. Different providers may support different
    audio types.
    """
    annotations: Annotations | None = None
    """Optional annotations for the client."""
    meta: Meta | None = Field(alias="_meta", default=None)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

data instance-attribute

data: str

The base64-encoded audio data.

mime_type instance-attribute

mime_type: str

The MIME type of the audio. Different providers may support different audio types.

annotations class-attribute instance-attribute

annotations: Annotations | None = None

Optional annotations for the client.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See MCP specification for notes on _meta usage.

BaseMetadata

Bases: MCPModel

Base class for entities with a programmatic name and an optional display title.

Source code in src/mcp-types/mcp_types/_types.py
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
class BaseMetadata(MCPModel):
    """Base class for entities with a programmatic name and an optional display title."""

    name: str
    """Intended for programmatic or logical use, but used as a display name in past
    specs or fallback (if title isn't present)."""

    title: str | None = None
    """
    Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
    even by those unfamiliar with domain-specific terminology.

    If not provided, the name should be used for display (except for Tool,
    where `annotations.title` should be given precedence over using `name`,
    if present).
    """

name instance-attribute

name: str

Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present).

title class-attribute instance-attribute

title: str | None = None

Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.

If not provided, the name should be used for display (except for Tool, where annotations.title should be given precedence over using name, if present).

BlobResourceContents

Bases: ResourceContents

Binary contents of a resource.

Source code in src/mcp-types/mcp_types/_types.py
908
909
910
911
912
class BlobResourceContents(ResourceContents):
    """Binary contents of a resource."""

    blob: str
    """A base64-encoded string representing the binary data of the item."""

blob instance-attribute

blob: str

A base64-encoded string representing the binary data of the item.

CacheableResult

Bases: Result

Base class for results that carry client-side caching directives (2026-07-28).

Both fields are required on the 2026-07-28 wire. The SDK defaults to ttl_ms=0 (immediately stale) and cache_scope="private" so a handler that doesn't set them still produces a valid 2026-07-28 result without accidentally enabling shared caching.

Source code in src/mcp-types/mcp_types/_types.py
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
class CacheableResult(Result):
    """Base class for results that carry client-side caching directives (2026-07-28).

    Both fields are required on the 2026-07-28 wire. The SDK defaults to
    `ttl_ms=0` (immediately stale) and `cache_scope="private"` so a handler
    that doesn't set them still produces a valid 2026-07-28 result without
    accidentally enabling shared caching.
    """

    ttl_ms: Annotated[int, Field(ge=0)] = 0
    """How long (ms) the client MAY cache this response, analogous to HTTP
    `Cache-Control: max-age`. 0 means immediately stale."""

    cache_scope: Literal["public", "private"] = "private"
    """Analogous to HTTP `Cache-Control: public` vs `private`: "public" allows
    shared caches to serve the response to any user; "private" forbids that."""

ttl_ms class-attribute instance-attribute

ttl_ms: Annotated[int, Field(ge=0)] = 0

How long (ms) the client MAY cache this response, analogous to HTTP Cache-Control: max-age. 0 means immediately stale.

cache_scope class-attribute instance-attribute

cache_scope: Literal['public', 'private'] = 'private'

Analogous to HTTP Cache-Control: public vs private: "public" allows shared caches to serve the response to any user; "private" forbids that.

CallToolRequest

Bases: Request[CallToolRequestParams, Literal['tools/call']]

Used by the client to invoke a tool provided by the server.

Source code in src/mcp-types/mcp_types/_types.py
1440
1441
1442
1443
1444
class CallToolRequest(Request[CallToolRequestParams, Literal["tools/call"]]):
    """Used by the client to invoke a tool provided by the server."""

    method: Literal["tools/call"] = "tools/call"
    params: CallToolRequestParams

CallToolRequestParams

Bases: InputResponseRequestParams

Source code in src/mcp-types/mcp_types/_types.py
1433
1434
1435
1436
1437
class CallToolRequestParams(InputResponseRequestParams):
    name: str
    arguments: dict[str, Any] | None = None
    task: TaskMetadata | None = None
    """If specified, the caller requests task-augmented execution (2025-11-25 only)."""

task class-attribute instance-attribute

task: TaskMetadata | None = None

If specified, the caller requests task-augmented execution (2025-11-25 only).

CallToolResult

Bases: Result

The server's response to a tool call.

Errors that originate from the tool SHOULD be reported inside the result with is_error set to true, not as an MCP protocol-level error, so the LLM can see and self-correct. Errors in finding the tool, or any other exceptional condition, should be reported as an MCP error response.

Source code in src/mcp-types/mcp_types/_types.py
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
class CallToolResult(Result):
    """The server's response to a tool call.

    Errors that originate from the tool SHOULD be reported inside the result
    with `is_error` set to true, not as an MCP protocol-level error, so the LLM
    can see and self-correct. Errors in finding the tool, or any other
    exceptional condition, should be reported as an MCP error response.
    """

    content: list[ContentBlock]
    """A list of content objects that represent the unstructured result of the tool call."""
    structured_content: Any = None
    """An optional JSON value representing the structured result of the tool call.

    Any JSON value on 2026-07-28; restricted to a JSON object on 2025-06-18 and
    2025-11-25.
    """
    is_error: bool = False
    """Whether the tool call ended in an error."""

    result_type: ResultType = "complete"
    """See `ResultType`. Always serialized; older peers ignore it."""

content instance-attribute

content: list[ContentBlock]

A list of content objects that represent the unstructured result of the tool call.

structured_content class-attribute instance-attribute

structured_content: Any = None

An optional JSON value representing the structured result of the tool call.

Any JSON value on 2026-07-28; restricted to a JSON object on 2025-06-18 and 2025-11-25.

is_error class-attribute instance-attribute

is_error: bool = False

Whether the tool call ended in an error.

result_type class-attribute instance-attribute

result_type: ResultType = 'complete'

See ResultType. Always serialized; older peers ignore it.

CancelledNotification

Bases: Notification[CancelledNotificationParams, Literal['notifications/cancelled']]

This notification can be sent by either side to indicate that it is canceling a previously-issued request.

The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished. A client MUST NOT attempt to cancel its initialize request.

Source code in src/mcp-types/mcp_types/_types.py
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
class CancelledNotification(Notification[CancelledNotificationParams, Literal["notifications/cancelled"]]):
    """This notification can be sent by either side to indicate that it is canceling a
    previously-issued request.

    The request SHOULD still be in-flight, but due to communication latency, it
    is always possible that this notification MAY arrive after the request has
    already finished. A client MUST NOT attempt to cancel its `initialize` request.
    """

    method: Literal["notifications/cancelled"] = "notifications/cancelled"
    params: CancelledNotificationParams

CancelledNotificationParams

Bases: NotificationParams

Source code in src/mcp-types/mcp_types/_types.py
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
class CancelledNotificationParams(NotificationParams):
    request_id: RequestId | None = None
    """
    The ID of the request to cancel.

    This MUST correspond to the ID of a request previously issued in the same direction.
    Required on the wire through 2025-06-18; optional at 2025-11-25; required again from
    2026-07-28, where it must name a request the client previously issued (servers send
    this notification only to terminate a `subscriptions/listen` stream).
    """
    reason: str | None = None
    """An optional string describing the reason for the cancellation."""

request_id class-attribute instance-attribute

request_id: RequestId | None = None

The ID of the request to cancel.

This MUST correspond to the ID of a request previously issued in the same direction. Required on the wire through 2025-06-18; optional at 2025-11-25; required again from 2026-07-28, where it must name a request the client previously issued (servers send this notification only to terminate a subscriptions/listen stream).

reason class-attribute instance-attribute

reason: str | None = None

An optional string describing the reason for the cancellation.

CancelTaskRequest

Bases: Request[CancelTaskRequestParams, Literal['tasks/cancel']]

A request to cancel a task (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
671
672
673
674
675
class CancelTaskRequest(Request[CancelTaskRequestParams, Literal["tasks/cancel"]]):
    """A request to cancel a task (2025-11-25 only)."""

    method: Literal["tasks/cancel"] = "tasks/cancel"
    params: CancelTaskRequestParams

CancelTaskResult

Bases: Result, Task

The response to a tasks/cancel request (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
678
679
class CancelTaskResult(Result, Task):
    """The response to a tasks/cancel request (2025-11-25 only)."""

ClientCapabilities

Bases: MCPModel

Capabilities a client may support.

Not a closed set: any client can define additional capabilities. Sent once in initialize through 2025-11-25; per-request in _meta on 2026-07-28.

Source code in src/mcp-types/mcp_types/_types.py
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
class ClientCapabilities(MCPModel):
    """Capabilities a client may support.

    Not a closed set: any client can define additional capabilities. Sent once in
    `initialize` through 2025-11-25; per-request in `_meta` on 2026-07-28.
    """

    experimental: dict[str, dict[str, Any]] | None = None
    """Experimental, non-standard capabilities that the client supports."""
    sampling: SamplingCapability | None = None
    """
    Present if the client supports sampling from an LLM.
    Can contain fine-grained capabilities like context and tools support.
    """
    elicitation: ElicitationCapability | None = None
    """Present if the client supports elicitation from the user."""
    roots: RootsCapability | None = None
    """Present if the client supports listing roots."""
    extensions: dict[str, dict[str, Any]] | None = None
    """MCP extensions the client supports (2026-07-28). Keys are extension
    identifiers; values are per-extension settings (empty object = no settings)."""
    tasks: ClientTasksCapability | None = None
    """Present if the client supports task-augmented requests (2025-11-25 only)."""

experimental class-attribute instance-attribute

experimental: dict[str, dict[str, Any]] | None = None

Experimental, non-standard capabilities that the client supports.

sampling class-attribute instance-attribute

sampling: SamplingCapability | None = None

Present if the client supports sampling from an LLM. Can contain fine-grained capabilities like context and tools support.

elicitation class-attribute instance-attribute

elicitation: ElicitationCapability | None = None

Present if the client supports elicitation from the user.

roots class-attribute instance-attribute

roots: RootsCapability | None = None

Present if the client supports listing roots.

extensions class-attribute instance-attribute

extensions: dict[str, dict[str, Any]] | None = None

MCP extensions the client supports (2026-07-28). Keys are extension identifiers; values are per-extension settings (empty object = no settings).

tasks class-attribute instance-attribute

tasks: ClientTasksCapability | None = None

Present if the client supports task-augmented requests (2025-11-25 only).

ClientNotification module-attribute

Notifications sent from the client to the server.

TaskStatusNotification is deliberately excluded (types-only).

ClientRequest module-attribute

Union of client-to-server request payloads across all supported protocol versions.

The 2025-11-25 task requests are deliberately excluded (types-only).

ClientTasksCapability

Bases: MCPModel

Capability for client tasks operations (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
363
364
365
366
367
368
class ClientTasksCapability(MCPModel):
    """Capability for client tasks operations (2025-11-25 only)."""

    list: TasksListCapability | None = None
    cancel: TasksCancelCapability | None = None
    requests: ClientTasksRequestsCapability | None = None

ClientTasksRequestsCapability

Bases: MCPModel

Specifies which request types the client can augment with tasks (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
356
357
358
359
360
class ClientTasksRequestsCapability(MCPModel):
    """Specifies which request types the client can augment with tasks (2025-11-25 only)."""

    sampling: TasksSamplingCapability | None = None
    elicitation: TasksElicitationCapability | None = None

CompleteRequest

Bases: Request[CompleteRequestParams, Literal['completion/complete']]

A request from the client to the server, to ask for completion options.

Source code in src/mcp-types/mcp_types/_types.py
1769
1770
1771
1772
1773
class CompleteRequest(Request[CompleteRequestParams, Literal["completion/complete"]]):
    """A request from the client to the server, to ask for completion options."""

    method: Literal["completion/complete"] = "completion/complete"
    params: CompleteRequestParams

CompleteRequestParams

Bases: RequestParams

Source code in src/mcp-types/mcp_types/_types.py
1761
1762
1763
1764
1765
1766
class CompleteRequestParams(RequestParams):
    ref: ResourceTemplateReference | PromptReference
    """The prompt or resource-template reference to complete against."""
    argument: CompletionArgument
    context: CompletionContext | None = None
    """Additional, optional context for completions."""

ref instance-attribute

The prompt or resource-template reference to complete against.

context class-attribute instance-attribute

context: CompletionContext | None = None

Additional, optional context for completions.

CompleteResult

Bases: Result

The server's response to a completion/complete request.

Source code in src/mcp-types/mcp_types/_types.py
1793
1794
1795
1796
1797
1798
1799
1800
class CompleteResult(Result):
    """The server's response to a completion/complete request."""

    completion: Completion
    """The completion values, with optional total / has-more pagination hints."""

    result_type: ResultType = "complete"
    """See `ResultType`. Always serialized; older peers ignore it."""

completion instance-attribute

completion: Completion

The completion values, with optional total / has-more pagination hints.

result_type class-attribute instance-attribute

result_type: ResultType = 'complete'

See ResultType. Always serialized; older peers ignore it.

Completion

Bases: MCPModel

Completion information.

Source code in src/mcp-types/mcp_types/_types.py
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
class Completion(MCPModel):
    """Completion information."""

    values: list[str]
    """An array of completion values. Must not exceed 100 items."""
    total: int | None = None
    """
    The total number of completion options available. This can exceed the number of
    values actually sent in the response.
    """
    has_more: bool | None = None
    """
    Indicates whether there are additional completion options beyond those provided in
    the current response, even if the exact total is unknown.
    """

values instance-attribute

values: list[str]

An array of completion values. Must not exceed 100 items.

total class-attribute instance-attribute

total: int | None = None

The total number of completion options available. This can exceed the number of values actually sent in the response.

has_more class-attribute instance-attribute

has_more: bool | None = None

Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.

CompletionArgument

Bases: MCPModel

The argument's information for completion requests.

Source code in src/mcp-types/mcp_types/_types.py
1745
1746
1747
1748
1749
1750
1751
class CompletionArgument(MCPModel):
    """The argument's information for completion requests."""

    name: str
    """The name of the argument."""
    value: str
    """The value of the argument to use for completion matching."""

name instance-attribute

name: str

The name of the argument.

value instance-attribute

value: str

The value of the argument to use for completion matching.

CompletionContext

Bases: MCPModel

Additional, optional context for completions.

Source code in src/mcp-types/mcp_types/_types.py
1754
1755
1756
1757
1758
class CompletionContext(MCPModel):
    """Additional, optional context for completions."""

    arguments: dict[str, str] | None = None
    """Previously-resolved variables in a URI template or prompt."""

arguments class-attribute instance-attribute

arguments: dict[str, str] | None = None

Previously-resolved variables in a URI template or prompt.

CompletionsCapability

Bases: MCPModel

Capability for completions operations.

Source code in src/mcp-types/mcp_types/_types.py
439
440
class CompletionsCapability(MCPModel):
    """Capability for completions operations."""

ContentBlock module-attribute

A content block that can be used in prompts and tool results.

CreateMessageRequest

Bases: Request[CreateMessageRequestParams, Literal['sampling/createMessage']]

A request from the server to sample an LLM via the client.

The client has full discretion over which model to select and should inform the user before sampling (human in the loop). A standalone JSON-RPC request through 2025-11-25; on 2026-07-28 it is embedded in InputRequiredResult.input_requests instead. Deprecated in 2026-07-28 (SEP-2577).

Source code in src/mcp-types/mcp_types/_types.py
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
class CreateMessageRequest(Request[CreateMessageRequestParams, Literal["sampling/createMessage"]]):
    """A request from the server to sample an LLM via the client.

    The client has full discretion over which model to select and should inform
    the user before sampling (human in the loop). A standalone JSON-RPC request
    through 2025-11-25; on 2026-07-28 it is embedded in
    `InputRequiredResult.input_requests` instead. Deprecated in 2026-07-28 (SEP-2577).
    """

    method: Literal["sampling/createMessage"] = "sampling/createMessage"
    params: CreateMessageRequestParams

CreateMessageRequestParams

Bases: RequestParams

Source code in src/mcp-types/mcp_types/_types.py
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
class CreateMessageRequestParams(RequestParams):
    messages: list[SamplingMessage]
    """The conversation to sample from."""
    model_preferences: ModelPreferences | None = None
    """
    The server's preferences for which model to select. The client MAY ignore
    these preferences.
    """
    system_prompt: str | None = None
    """An optional system prompt the server wants to use for sampling."""
    include_context: IncludeContext | None = None
    """
    A request to include context from one or more MCP servers (including the
    caller), to be attached to the prompt. The client MAY ignore this request.
    Default is "none". "thisServer" and "allServers" are deprecated (SEP-2596).
    """
    temperature: float | None = None
    max_tokens: int
    """The maximum number of tokens to sample, as requested by the server."""
    stop_sequences: list[str] | None = None
    metadata: dict[str, Any] | None = None
    """Optional metadata to pass through to the LLM provider. Provider-specific."""
    tools: list[Tool] | None = None
    """Tools the model may use during generation (2025-11-25+). Requires the
    `sampling.tools` client capability."""
    tool_choice: ToolChoice | None = None
    """Controls how the model uses tools (2025-11-25+). Requires the
    `sampling.tools` client capability."""
    task: TaskMetadata | None = None
    """If specified, the caller requests task-augmented execution (2025-11-25 only)."""

messages instance-attribute

messages: list[SamplingMessage]

The conversation to sample from.

model_preferences class-attribute instance-attribute

model_preferences: ModelPreferences | None = None

The server's preferences for which model to select. The client MAY ignore these preferences.

system_prompt class-attribute instance-attribute

system_prompt: str | None = None

An optional system prompt the server wants to use for sampling.

include_context class-attribute instance-attribute

include_context: IncludeContext | None = None

A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request. Default is "none". "thisServer" and "allServers" are deprecated (SEP-2596).

max_tokens instance-attribute

max_tokens: int

The maximum number of tokens to sample, as requested by the server.

metadata class-attribute instance-attribute

metadata: dict[str, Any] | None = None

Optional metadata to pass through to the LLM provider. Provider-specific.

tools class-attribute instance-attribute

tools: list[Tool] | None = None

Tools the model may use during generation (2025-11-25+). Requires the sampling.tools client capability.

tool_choice class-attribute instance-attribute

tool_choice: ToolChoice | None = None

Controls how the model uses tools (2025-11-25+). Requires the sampling.tools client capability.

task class-attribute instance-attribute

task: TaskMetadata | None = None

If specified, the caller requests task-augmented execution (2025-11-25 only).

CreateMessageResult

Bases: Result

The client's response to a sampling/createMessage request from the server.

This is the backwards-compatible version that returns single content (no arrays). Used when the request does not include tools.

On 2026-07-28 this travels embedded in an InputResponses map rather than as a top-level JSON-RPC result. Deprecated in 2026-07-28 (SEP-2577).

Source code in src/mcp-types/mcp_types/_types.py
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
class CreateMessageResult(Result):
    """The client's response to a sampling/createMessage request from the server.

    This is the backwards-compatible version that returns single content (no arrays).
    Used when the request does not include tools.

    On 2026-07-28 this travels embedded in an `InputResponses` map rather than
    as a top-level JSON-RPC result. Deprecated in 2026-07-28 (SEP-2577).
    """

    role: Role
    """The role of the message sender (typically 'assistant' for LLM responses)."""
    content: SamplingContent
    """Response content. Single content block (text, image, or audio)."""
    model: str
    """The name of the model that generated the message."""
    stop_reason: StopReason | None = None
    """The reason why sampling stopped, if known."""

role instance-attribute

role: Role

The role of the message sender (typically 'assistant' for LLM responses).

content instance-attribute

content: SamplingContent

Response content. Single content block (text, image, or audio).

model instance-attribute

model: str

The name of the model that generated the message.

stop_reason class-attribute instance-attribute

stop_reason: StopReason | None = None

The reason why sampling stopped, if known.

CreateMessageResultWithTools

Bases: Result

The client's response to a sampling/createMessage request when tools were provided.

This version supports array content for tool use flows (2025-11-25 and later).

Source code in src/mcp-types/mcp_types/_types.py
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
class CreateMessageResultWithTools(Result):
    """The client's response to a sampling/createMessage request when tools were provided.

    This version supports array content for tool use flows (2025-11-25 and later).
    """

    role: Role
    """The role of the message sender (typically 'assistant' for LLM responses)."""
    content: SamplingMessageContentBlock | list[SamplingMessageContentBlock]
    """
    Response content. May be a single content block or an array.
    May include ToolUseContent if stop_reason is 'toolUse'.
    """
    model: str
    """The name of the model that generated the message."""
    stop_reason: StopReason | None = None
    """
    The reason why sampling stopped, if known.
    'toolUse' indicates the model wants to use a tool.
    """

    @property
    def content_as_list(self) -> list[SamplingMessageContentBlock]:
        """Returns the content as a list of content blocks, regardless of whether
        it was originally a single block or a list."""
        return self.content if isinstance(self.content, list) else [self.content]

role instance-attribute

role: Role

The role of the message sender (typically 'assistant' for LLM responses).

content instance-attribute

Response content. May be a single content block or an array. May include ToolUseContent if stop_reason is 'toolUse'.

model instance-attribute

model: str

The name of the model that generated the message.

stop_reason class-attribute instance-attribute

stop_reason: StopReason | None = None

The reason why sampling stopped, if known. 'toolUse' indicates the model wants to use a tool.

content_as_list property

Returns the content as a list of content blocks, regardless of whether it was originally a single block or a list.

CreateTaskResult

Bases: Result

A response to a task-augmented request (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
646
647
648
649
class CreateTaskResult(Result):
    """A response to a task-augmented request (2025-11-25 only)."""

    task: Task

DiscoverRequest

Bases: Request[RequestParams | None, Literal['server/discover']]

Asks the server to advertise its supported protocol versions, capabilities, and other metadata (2026-07-28).

Servers speaking 2026-07-28 MUST implement this; clients MAY call it but are not required to (version negotiation can also happen via per-request _meta).

Source code in src/mcp-types/mcp_types/_types.py
562
563
564
565
566
567
568
569
570
571
572
class DiscoverRequest(Request[RequestParams | None, Literal["server/discover"]]):
    """Asks the server to advertise its supported protocol versions, capabilities,
    and other metadata (2026-07-28).

    Servers speaking 2026-07-28 MUST implement this; clients MAY call it but are
    not required to (version negotiation can also happen via per-request `_meta`).
    """

    method: Literal["server/discover"] = "server/discover"
    params: RequestParams | None = None
    """Required on the 2026-07-28 wire (for `_meta`); the session layer materializes it."""

params class-attribute instance-attribute

params: RequestParams | None = None

Required on the 2026-07-28 wire (for _meta); the session layer materializes it.

DiscoverResult

Bases: CacheableResult

The result returned by the server for a server/discover request (2026-07-28).

Source code in src/mcp-types/mcp_types/_types.py
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
class DiscoverResult(CacheableResult):
    """The result returned by the server for a `server/discover` request (2026-07-28)."""

    supported_versions: list[str]
    """MCP protocol versions this server supports; the client should pick one for subsequent requests."""

    capabilities: ServerCapabilities

    server_info: Implementation

    instructions: str | None = None
    """Natural-language guidance describing the server and its features, e.g. for
    a system prompt. Should not duplicate information already in tool descriptions."""

    result_type: ResultType = "complete"
    """See `ResultType`. Always serialized; required on the 2026-07-28 wire,
    ignored by older peers, and defaulted on inbound bodies that omit it."""

supported_versions instance-attribute

supported_versions: list[str]

MCP protocol versions this server supports; the client should pick one for subsequent requests.

instructions class-attribute instance-attribute

instructions: str | None = None

Natural-language guidance describing the server and its features, e.g. for a system prompt. Should not duplicate information already in tool descriptions.

result_type class-attribute instance-attribute

result_type: ResultType = 'complete'

See ResultType. Always serialized; required on the 2026-07-28 wire, ignored by older peers, and defaulted on inbound bodies that omit it.

ElicitationCapability

Bases: MCPModel

Capability for elicitation operations.

Clients must support at least one mode (form or url).

Source code in src/mcp-types/mcp_types/_types.py
300
301
302
303
304
305
306
307
308
309
310
class ElicitationCapability(MCPModel):
    """Capability for elicitation operations.

    Clients must support at least one mode (form or url).
    """

    form: FormElicitationCapability | None = None
    """Present if the client supports form mode elicitation."""

    url: UrlElicitationCapability | None = None
    """Present if the client supports URL mode elicitation (2025-11-25 and later)."""

form class-attribute instance-attribute

form: FormElicitationCapability | None = None

Present if the client supports form mode elicitation.

url class-attribute instance-attribute

url: UrlElicitationCapability | None = None

Present if the client supports URL mode elicitation (2025-11-25 and later).

ElicitationRequiredErrorData

Bases: MCPModel

Error data for the -32042 URL-elicitation-required error.

Servers return this when a request cannot be processed until one or more URL mode elicitations are completed.

Removed in protocol 2026-07-28; sent/received on sessions negotiating 2025-11-25.

Source code in src/mcp-types/mcp_types/_types.py
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
class ElicitationRequiredErrorData(MCPModel):
    """Error data for the -32042 URL-elicitation-required error.

    Servers return this when a request cannot be processed until one or more
    URL mode elicitations are completed.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating 2025-11-25.
    """

    elicitations: list[ElicitRequestURLParams]
    """List of URL mode elicitations that must be completed."""

elicitations instance-attribute

List of URL mode elicitations that must be completed.

ElicitCompleteNotification

Bases: Notification[ElicitCompleteNotificationParams, Literal['notifications/elicitation/complete']]

A notification from the server to the client, informing it that a URL mode elicitation has been completed.

Clients MAY use the notification to automatically retry requests that received a URLElicitationRequiredError, update the user interface, or otherwise continue an interaction. However, because delivery of the notification is not guaranteed, clients must not wait indefinitely for a notification from the server.

New in protocol 2025-11-25 with URL mode itself.

Source code in src/mcp-types/mcp_types/_types.py
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
class ElicitCompleteNotification(
    Notification[ElicitCompleteNotificationParams, Literal["notifications/elicitation/complete"]]
):
    """A notification from the server to the client, informing it that a URL mode
    elicitation has been completed.

    Clients MAY use the notification to automatically retry requests that received a
    URLElicitationRequiredError, update the user interface, or otherwise continue
    an interaction. However, because delivery of the notification is not guaranteed,
    clients must not wait indefinitely for a notification from the server.

    New in protocol 2025-11-25 with URL mode itself.
    """

    method: Literal["notifications/elicitation/complete"] = "notifications/elicitation/complete"
    params: ElicitCompleteNotificationParams

ElicitCompleteNotificationParams

Bases: NotificationParams

Parameters for elicitation completion notifications.

Source code in src/mcp-types/mcp_types/_types.py
1904
1905
1906
1907
1908
class ElicitCompleteNotificationParams(NotificationParams):
    """Parameters for elicitation completion notifications."""

    elicitation_id: str
    """The unique identifier of the elicitation that was completed."""

elicitation_id instance-attribute

elicitation_id: str

The unique identifier of the elicitation that was completed.

ElicitRequest

Bases: Request[ElicitRequestParams, Literal['elicitation/create']]

A request from the server to elicit additional information from the user via the client.

Source code in src/mcp-types/mcp_types/_types.py
1989
1990
1991
1992
1993
class ElicitRequest(Request[ElicitRequestParams, Literal["elicitation/create"]]):
    """A request from the server to elicit additional information from the user via the client."""

    method: Literal["elicitation/create"] = "elicitation/create"
    params: ElicitRequestParams

ElicitRequestFormParams

Bases: RequestParams

Parameters for form mode elicitation requests.

Form mode collects non-sensitive information from the user via an in-band form rendered by the client.

Source code in src/mcp-types/mcp_types/_types.py
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
class ElicitRequestFormParams(RequestParams):
    """Parameters for form mode elicitation requests.

    Form mode collects non-sensitive information from the user via an in-band form
    rendered by the client.
    """

    mode: Literal["form"] = "form"
    """The elicitation mode (always "form" for this type)."""

    message: str
    """The message to present to the user describing what information is being requested."""

    requested_schema: ElicitRequestedSchema
    """
    A restricted subset of JSON Schema defining the structure of the expected response.
    Only top-level properties are allowed, without nesting.
    """

    task: TaskMetadata | None = None
    """If specified, the caller requests task-augmented execution (2025-11-25 only)."""

mode class-attribute instance-attribute

mode: Literal['form'] = 'form'

The elicitation mode (always "form" for this type).

message instance-attribute

message: str

The message to present to the user describing what information is being requested.

requested_schema instance-attribute

requested_schema: ElicitRequestedSchema

A restricted subset of JSON Schema defining the structure of the expected response. Only top-level properties are allowed, without nesting.

task class-attribute instance-attribute

task: TaskMetadata | None = None

If specified, the caller requests task-augmented execution (2025-11-25 only).

ElicitRequestParams module-attribute

Parameters for elicitation requests - either form or URL mode.

ElicitRequestURLParams

Bases: RequestParams

Parameters for URL mode elicitation requests.

URL mode directs users to external URLs for sensitive out-of-band interactions like OAuth flows, credential collection, or payment processing. New in 2025-11-25.

Source code in src/mcp-types/mcp_types/_types.py
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
class ElicitRequestURLParams(RequestParams):
    """Parameters for URL mode elicitation requests.

    URL mode directs users to external URLs for sensitive out-of-band interactions
    like OAuth flows, credential collection, or payment processing. New in 2025-11-25.
    """

    mode: Literal["url"] = "url"
    """The elicitation mode (always "url" for this type)."""

    message: str
    """The message to present to the user explaining why the interaction is needed."""

    url: str
    """The URL that the user should navigate to."""

    elicitation_id: str | None = None
    """The ID of the elicitation, which must be unique within the context of the server.

    The client MUST treat this ID as an opaque value. Required on the wire at
    2025-11-25; removed at 2026-07-28.
    """

    task: TaskMetadata | None = None
    """If specified, the caller requests task-augmented execution (2025-11-25 only)."""

mode class-attribute instance-attribute

mode: Literal['url'] = 'url'

The elicitation mode (always "url" for this type).

message instance-attribute

message: str

The message to present to the user explaining why the interaction is needed.

url instance-attribute

url: str

The URL that the user should navigate to.

elicitation_id class-attribute instance-attribute

elicitation_id: str | None = None

The ID of the elicitation, which must be unique within the context of the server.

The client MUST treat this ID as an opaque value. Required on the wire at 2025-11-25; removed at 2026-07-28.

task class-attribute instance-attribute

task: TaskMetadata | None = None

If specified, the caller requests task-augmented execution (2025-11-25 only).

ElicitResult

Bases: Result

The client's response to an elicitation request.

Source code in src/mcp-types/mcp_types/_types.py
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
class ElicitResult(Result):
    """The client's response to an elicitation request."""

    action: Literal["accept", "decline", "cancel"]
    """
    The user action in response to the elicitation.
    - "accept": User submitted the form/confirmed the action (or consented to URL navigation)
    - "decline": User explicitly declined the action
    - "cancel": User dismissed without making an explicit choice
    """

    content: dict[str, str | int | float | bool | list[str] | None] | None = None
    """
    The submitted form data, only present when action is "accept" in form mode.
    Contains values matching the requested schema. Values can be strings, integers, floats,
    booleans, arrays of strings, or null.
    For URL mode, this field is omitted.
    """

action instance-attribute

action: Literal['accept', 'decline', 'cancel']

The user action in response to the elicitation. - "accept": User submitted the form/confirmed the action (or consented to URL navigation) - "decline": User explicitly declined the action - "cancel": User dismissed without making an explicit choice

content class-attribute instance-attribute

content: (
    dict[str, str | int | float | bool | list[str] | None]
    | None
) = None

The submitted form data, only present when action is "accept" in form mode. Contains values matching the requested schema. Values can be strings, integers, floats, booleans, arrays of strings, or null. For URL mode, this field is omitted.

EmbeddedResource

Bases: MCPModel

The contents of a resource, embedded into a prompt or tool call result.

It is up to the client how best to render embedded resources for the benefit of the LLM and/or the user.

Source code in src/mcp-types/mcp_types/_types.py
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
class EmbeddedResource(MCPModel):
    """The contents of a resource, embedded into a prompt or tool call result.

    It is up to the client how best to render embedded resources for the benefit
    of the LLM and/or the user.
    """

    type: Literal["resource"] = "resource"
    resource: TextResourceContents | BlobResourceContents
    annotations: Annotations | None = None
    """Optional annotations for the client."""
    meta: Meta | None = Field(alias="_meta", default=None)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

annotations class-attribute instance-attribute

annotations: Annotations | None = None

Optional annotations for the client.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See MCP specification for notes on _meta usage.

EmptyResult

Bases: Result

A result that indicates success but carries no data.

result_type defaults to None so this dumps as {}: deployed TypeScript and Rust SDK peers (clients and servers) validate empty results strictly and reject extra keys. The 2026-07-28 schema requires resultType, so code answering an empty result on a 2026-07-28+ session must pass result_type="complete".

Source code in src/mcp-types/mcp_types/_types.py
198
199
200
201
202
203
204
205
206
207
208
209
class EmptyResult(Result):
    """A result that indicates success but carries no data.

    `result_type` defaults to None so this dumps as `{}`: deployed TypeScript
    and Rust SDK peers (clients and servers) validate empty results strictly
    and reject extra keys. The 2026-07-28 schema requires `resultType`, so code
    answering an empty result on a 2026-07-28+ session must pass
    `result_type="complete"`.
    """

    result_type: ResultType | None = None
    """None keeps the dump empty; see the class docstring."""

result_type class-attribute instance-attribute

result_type: ResultType | None = None

None keeps the dump empty; see the class docstring.

FormElicitationCapability

Bases: MCPModel

Capability for form mode elicitation.

Source code in src/mcp-types/mcp_types/_types.py
292
293
class FormElicitationCapability(MCPModel):
    """Capability for form mode elicitation."""

GetPromptRequest

Bases: Request[GetPromptRequestParams, Literal['prompts/get']]

Used by the client to get a prompt provided by the server.

Source code in src/mcp-types/mcp_types/_types.py
1127
1128
1129
1130
1131
class GetPromptRequest(Request[GetPromptRequestParams, Literal["prompts/get"]]):
    """Used by the client to get a prompt provided by the server."""

    method: Literal["prompts/get"] = "prompts/get"
    params: GetPromptRequestParams

GetPromptRequestParams

Bases: InputResponseRequestParams

Source code in src/mcp-types/mcp_types/_types.py
1120
1121
1122
1123
1124
class GetPromptRequestParams(InputResponseRequestParams):
    name: str
    """The name of the prompt or prompt template."""
    arguments: dict[str, str] | None = None
    """Arguments to use for templating the prompt."""

name instance-attribute

name: str

The name of the prompt or prompt template.

arguments class-attribute instance-attribute

arguments: dict[str, str] | None = None

Arguments to use for templating the prompt.

GetPromptResult

Bases: Result

The server's response to a prompts/get request from the client.

Source code in src/mcp-types/mcp_types/_types.py
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
class GetPromptResult(Result):
    """The server's response to a prompts/get request from the client."""

    description: str | None = None
    """An optional description for the prompt."""
    messages: list[PromptMessage]
    """The messages composing the prompt, in the order they should be presented."""

    result_type: ResultType = "complete"
    """See `ResultType`. Always serialized; older peers ignore it."""

description class-attribute instance-attribute

description: str | None = None

An optional description for the prompt.

messages instance-attribute

messages: list[PromptMessage]

The messages composing the prompt, in the order they should be presented.

result_type class-attribute instance-attribute

result_type: ResultType = 'complete'

See ResultType. Always serialized; older peers ignore it.

GetTaskPayloadRequest

Bases: Request[GetTaskPayloadRequestParams, Literal['tasks/result']]

A request to retrieve the result of a completed task (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
699
700
701
702
703
class GetTaskPayloadRequest(Request[GetTaskPayloadRequestParams, Literal["tasks/result"]]):
    """A request to retrieve the result of a completed task (2025-11-25 only)."""

    method: Literal["tasks/result"] = "tasks/result"
    params: GetTaskPayloadRequestParams

GetTaskPayloadRequestParams

Bases: RequestParams

Parameters for a tasks/result request.

Source code in src/mcp-types/mcp_types/_types.py
693
694
695
696
class GetTaskPayloadRequestParams(RequestParams):
    """Parameters for a tasks/result request."""

    task_id: str

GetTaskPayloadResult

Bases: Result

The response to a tasks/result request (2025-11-25 only).

The structure matches the result type of the original request. The payload arrives as extra wire fields, which MCPModel does not retain; validate the response into the original request's result type (e.g. CallToolResult) instead of this class.

Source code in src/mcp-types/mcp_types/_types.py
706
707
708
709
710
711
712
713
class GetTaskPayloadResult(Result):
    """The response to a tasks/result request (2025-11-25 only).

    The structure matches the result type of the original request. The payload
    arrives as extra wire fields, which `MCPModel` does not retain; validate the
    response into the original request's result type (e.g. `CallToolResult`)
    instead of this class.
    """

GetTaskRequest

Bases: Request[GetTaskRequestParams, Literal['tasks/get']]

A request to retrieve the state of a task (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
656
657
658
659
660
class GetTaskRequest(Request[GetTaskRequestParams, Literal["tasks/get"]]):
    """A request to retrieve the state of a task (2025-11-25 only)."""

    method: Literal["tasks/get"] = "tasks/get"
    params: GetTaskRequestParams

GetTaskResult

Bases: Result, Task

The response to a tasks/get request (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
663
664
class GetTaskResult(Result, Task):
    """The response to a tasks/get request (2025-11-25 only)."""

Icon

Bases: MCPModel

An optionally-sized icon for display in a user interface (2025-11-25+).

Source code in src/mcp-types/mcp_types/_types.py
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
class Icon(MCPModel):
    """An optionally-sized icon for display in a user interface (2025-11-25+)."""

    src: str
    """A standard URI pointing to an icon resource (`http(s):` or `data:`).

    Consumers SHOULD ensure icon URLs come from a trusted domain and SHOULD
    take appropriate precautions when consuming SVGs (which can contain script).
    """

    mime_type: str | None = None
    """Optional MIME type override if the source MIME type is missing or generic."""

    sizes: list[str] | None = None
    """Optional sizes this icon is available in: WxH (e.g. `"48x48"`) or `"any"`.
    If not provided, assume the icon can be used at any size."""

    theme: IconTheme | None = None
    """The theme this icon is designed for. If not provided, assume any theme."""

src instance-attribute

src: str

A standard URI pointing to an icon resource (http(s): or data:).

Consumers SHOULD ensure icon URLs come from a trusted domain and SHOULD take appropriate precautions when consuming SVGs (which can contain script).

mime_type class-attribute instance-attribute

mime_type: str | None = None

Optional MIME type override if the source MIME type is missing or generic.

sizes class-attribute instance-attribute

sizes: list[str] | None = None

Optional sizes this icon is available in: WxH (e.g. "48x48") or "any". If not provided, assume the icon can be used at any size.

theme class-attribute instance-attribute

theme: IconTheme | None = None

The theme this icon is designed for. If not provided, assume any theme.

IconTheme module-attribute

IconTheme = Literal['light', 'dark']

Theme an icon is designed for. Wire values of Icon.theme (2025-11-25+).

ImageContent

Bases: MCPModel

An image provided to or from an LLM.

Source code in src/mcp-types/mcp_types/_types.py
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
class ImageContent(MCPModel):
    """An image provided to or from an LLM."""

    type: Literal["image"] = "image"
    data: str
    """The base64-encoded image data."""
    mime_type: str
    """
    The MIME type of the image. Different providers may support different
    image types.
    """
    annotations: Annotations | None = None
    """Optional annotations for the client."""
    meta: Meta | None = Field(alias="_meta", default=None)
    """See the MCP specification's "General fields: _meta" section for notes on _meta usage."""

data instance-attribute

data: str

The base64-encoded image data.

mime_type instance-attribute

mime_type: str

The MIME type of the image. Different providers may support different image types.

annotations class-attribute instance-attribute

annotations: Annotations | None = None

Optional annotations for the client.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See the MCP specification's "General fields: _meta" section for notes on _meta usage.

Implementation

Bases: BaseMetadata

Describes the name and version of an MCP implementation (clientInfo / serverInfo).

Source code in src/mcp-types/mcp_types/_types.py
251
252
253
254
255
256
257
258
259
260
261
262
class Implementation(BaseMetadata):
    """Describes the name and version of an MCP implementation (`clientInfo` / `serverInfo`)."""

    version: str
    description: str | None = None
    """An optional human-readable description of what this implementation does."""

    website_url: str | None = None
    """An optional URL of the website for this implementation."""

    icons: list[Icon] | None = None
    """Optional set of sized icons that the client can display in a user interface."""

description class-attribute instance-attribute

description: str | None = None

An optional human-readable description of what this implementation does.

website_url class-attribute instance-attribute

website_url: str | None = None

An optional URL of the website for this implementation.

icons class-attribute instance-attribute

icons: list[Icon] | None = None

Optional set of sized icons that the client can display in a user interface.

IncludeContext module-attribute

IncludeContext = Literal["none", "thisServer", "allServers"]

Scope of MCP-server context a sampling request asks the client to attach.

"thisServer" and "allServers" are deprecated (SEP-2596).

InitializedNotification

Bases: Notification[NotificationParams | None, Literal['notifications/initialized']]

This notification is sent from the client to the server after initialization has finished.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.

Source code in src/mcp-types/mcp_types/_types.py
540
541
542
543
544
545
546
547
548
class InitializedNotification(Notification[NotificationParams | None, Literal["notifications/initialized"]]):
    """This notification is sent from the client to the server after initialization has
    finished.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    """

    method: Literal["notifications/initialized"] = "notifications/initialized"
    params: NotificationParams | None = None

InitializeRequest

Bases: Request[InitializeRequestParams, Literal['initialize']]

This request is sent from the client to the server when it first connects, asking it to begin initialization.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25. On 2026-07-28 the handshake is server/discover plus per-request _meta.

Source code in src/mcp-types/mcp_types/_types.py
509
510
511
512
513
514
515
516
517
518
class InitializeRequest(Request[InitializeRequestParams, Literal["initialize"]]):
    """This request is sent from the client to the server when it first connects, asking it
    to begin initialization.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    On 2026-07-28 the handshake is `server/discover` plus per-request `_meta`.
    """

    method: Literal["initialize"] = "initialize"
    params: InitializeRequestParams

InitializeRequestParams

Bases: RequestParams

Parameters for the initialize request.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.

Source code in src/mcp-types/mcp_types/_types.py
497
498
499
500
501
502
503
504
505
506
class InitializeRequestParams(RequestParams):
    """Parameters for the `initialize` request.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    """

    protocol_version: str
    """The latest version of the Model Context Protocol that the client supports."""
    capabilities: ClientCapabilities
    client_info: Implementation

protocol_version instance-attribute

protocol_version: str

The latest version of the Model Context Protocol that the client supports.

InitializeResult

Bases: Result

After receiving an initialize request from the client, the server sends this response.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.

Source code in src/mcp-types/mcp_types/_types.py
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
class InitializeResult(Result):
    """After receiving an initialize request from the client, the server sends this response.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    """

    protocol_version: str
    """The version of the Model Context Protocol that the server wants to use.
    If the client cannot support this version, it MUST disconnect."""
    capabilities: ServerCapabilities
    server_info: Implementation
    instructions: str | None = None
    """Instructions describing how to use the server and its features.

    Clients may use this to improve an LLM's understanding of available tools,
    resources, etc., for example by adding it to the system prompt.
    """

protocol_version instance-attribute

protocol_version: str

The version of the Model Context Protocol that the server wants to use. If the client cannot support this version, it MUST disconnect.

instructions class-attribute instance-attribute

instructions: str | None = None

Instructions describing how to use the server and its features.

Clients may use this to improve an LLM's understanding of available tools, resources, etc., for example by adding it to the system prompt.

InputRequest module-attribute

A single server-initiated input request embedded in InputRequiredResult (2026-07-28).

Discriminated by method. On 2026-07-28 these embedded payloads take the place of standalone server-to-client JSON-RPC requests.

InputRequests module-attribute

InputRequests: TypeAlias = dict[str, InputRequest]

A map of server-initiated requests that the client must fulfill (2026-07-28).

Keys are server-assigned identifiers. Carried by InputRequiredResult.input_requests and by the tasks extension.

InputRequiredResult

Bases: Result

The server needs additional input before the original request can complete (2026-07-28).

Returned in place of the normal result of an interactive client request (tools/call, prompts/get, resources/read). The client fulfills input_requests and retries the original request, carrying the responses and the echoed request_state. At least one of those two fields is present on the wire (spec MUST).

Source code in src/mcp-types/mcp_types/_types.py
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
class InputRequiredResult(Result):
    """The server needs additional input before the original request can complete (2026-07-28).

    Returned in place of the normal result of an interactive client request
    (`tools/call`, `prompts/get`, `resources/read`). The client fulfills
    `input_requests` and retries the original request, carrying the responses
    and the echoed `request_state`. At least one of those two fields is
    present on the wire (spec MUST).
    """

    result_type: Literal["input_required"] = "input_required"
    """Discriminating tag for the dual-result response unions."""

    input_requests: InputRequests | None = None
    """Requests the client must complete before retrying. Keys are server-assigned."""

    request_state: str | None = None
    """Opaque state to pass back verbatim when the client retries the original request."""

    @model_validator(mode="after")
    def _require_one_field(self) -> Self:
        if not self.input_requests and self.request_state is None:
            raise ValueError("InputRequiredResult requires at least one of input_requests or request_state")
        return self

result_type class-attribute instance-attribute

result_type: Literal['input_required'] = 'input_required'

Discriminating tag for the dual-result response unions.

input_requests class-attribute instance-attribute

input_requests: InputRequests | None = None

Requests the client must complete before retrying. Keys are server-assigned.

request_state class-attribute instance-attribute

request_state: str | None = None

Opaque state to pass back verbatim when the client retries the original request.

InputResponse module-attribute

A client response to a single server-initiated input request (2026-07-28).

CreateMessageResultWithTools is this SDK's array-content split of the schema's single CreateMessageResult arm; the wire union has three arms.

InputResponseRequestParams

Bases: RequestParams

Base params for client requests that can carry responses to a server's input requests (2026-07-28 multi-round-trip flow).

When a request returns an InputRequiredResult, the client retries the original request with these fields populated.

Source code in src/mcp-types/mcp_types/_types.py
855
856
857
858
859
860
861
862
863
864
865
866
class InputResponseRequestParams(RequestParams):
    """Base params for client requests that can carry responses to a server's
    input requests (2026-07-28 multi-round-trip flow).

    When a request returns an `InputRequiredResult`, the client retries the
    original request with these fields populated.
    """

    input_responses: InputResponses | None = None
    """Responses to the server's `InputRequiredResult.input_requests`, keyed identically."""
    request_state: str | None = None
    """Opaque state from the `InputRequiredResult`, passed back verbatim on retry."""

input_responses class-attribute instance-attribute

input_responses: InputResponses | None = None

Responses to the server's InputRequiredResult.input_requests, keyed identically.

request_state class-attribute instance-attribute

request_state: str | None = None

Opaque state from the InputRequiredResult, passed back verbatim on retry.

InputResponses module-attribute

InputResponses: TypeAlias = dict[str, InputResponse]

A map of client responses to server-initiated input requests (2026-07-28).

Keys match those of the InputRequests map the server sent. Also used by the tasks extension's tasks/update params.

ListPromptsRequest

Bases: PaginatedRequest[Literal['prompts/list']]

Sent from the client to request a list of prompts and prompt templates the server has.

Source code in src/mcp-types/mcp_types/_types.py
1081
1082
1083
1084
class ListPromptsRequest(PaginatedRequest[Literal["prompts/list"]]):
    """Sent from the client to request a list of prompts and prompt templates the server has."""

    method: Literal["prompts/list"] = "prompts/list"

ListPromptsResult

Bases: PaginatedResult, CacheableResult

The server's response to a prompts/list request from the client.

Source code in src/mcp-types/mcp_types/_types.py
1112
1113
1114
1115
1116
1117
class ListPromptsResult(PaginatedResult, CacheableResult):
    """The server's response to a prompts/list request from the client."""

    prompts: list[Prompt]
    result_type: ResultType = "complete"
    """See `ResultType`. Always serialized; older peers ignore it."""

result_type class-attribute instance-attribute

result_type: ResultType = 'complete'

See ResultType. Always serialized; older peers ignore it.

ListResourcesRequest

Bases: PaginatedRequest[Literal['resources/list']]

Sent from the client to request a list of resources the server has.

Source code in src/mcp-types/mcp_types/_types.py
757
758
759
760
class ListResourcesRequest(PaginatedRequest[Literal["resources/list"]]):
    """Sent from the client to request a list of resources the server has."""

    method: Literal["resources/list"] = "resources/list"

ListResourcesResult

Bases: PaginatedResult, CacheableResult

The server's response to a resources/list request from the client.

Source code in src/mcp-types/mcp_types/_types.py
833
834
835
836
837
838
class ListResourcesResult(PaginatedResult, CacheableResult):
    """The server's response to a resources/list request from the client."""

    resources: list[Resource]
    result_type: ResultType = "complete"
    """See `ResultType`. Always serialized; older peers ignore it."""

result_type class-attribute instance-attribute

result_type: ResultType = 'complete'

See ResultType. Always serialized; older peers ignore it.

ListResourceTemplatesRequest

Bases: PaginatedRequest[Literal['resources/templates/list']]

Sent from the client to request a list of resource templates the server has.

Source code in src/mcp-types/mcp_types/_types.py
841
842
843
844
class ListResourceTemplatesRequest(PaginatedRequest[Literal["resources/templates/list"]]):
    """Sent from the client to request a list of resource templates the server has."""

    method: Literal["resources/templates/list"] = "resources/templates/list"

ListResourceTemplatesResult

Bases: PaginatedResult, CacheableResult

The server's response to a resources/templates/list request from the client.

Source code in src/mcp-types/mcp_types/_types.py
847
848
849
850
851
852
class ListResourceTemplatesResult(PaginatedResult, CacheableResult):
    """The server's response to a resources/templates/list request from the client."""

    resource_templates: list[ResourceTemplate]
    result_type: ResultType = "complete"
    """See `ResultType`. Always serialized; older peers ignore it."""

result_type class-attribute instance-attribute

result_type: ResultType = 'complete'

See ResultType. Always serialized; older peers ignore it.

ListRootsRequest

Bases: Request[RequestParams | None, Literal['roots/list']]

Sent from the server to request a list of root URIs from the client. Roots allow servers to ask for specific directories or files to operate on. A common example for roots is providing a set of repositories or directories a server should operate on.

This request is typically used when the server needs to understand the file system structure or access specific locations that the client has permission to read from.

A standalone JSON-RPC request through 2025-11-25; on 2026-07-28 it is embedded in InputRequiredResult.input_requests. Deprecated in 2026-07-28 (SEP-2577).

Source code in src/mcp-types/mcp_types/_types.py
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
class ListRootsRequest(Request[RequestParams | None, Literal["roots/list"]]):
    """Sent from the server to request a list of root URIs from the client. Roots allow
    servers to ask for specific directories or files to operate on. A common example
    for roots is providing a set of repositories or directories a server should operate
    on.

    This request is typically used when the server needs to understand the file system
    structure or access specific locations that the client has permission to read from.

    A standalone JSON-RPC request through 2025-11-25; on 2026-07-28 it is
    embedded in `InputRequiredResult.input_requests`. Deprecated in 2026-07-28 (SEP-2577).
    """

    method: Literal["roots/list"] = "roots/list"
    params: RequestParams | None = None
    """Stays optional on 2026-07-28 (reserved client `_meta` keys do not apply
    to server-to-client payloads)."""

params class-attribute instance-attribute

params: RequestParams | None = None

Stays optional on 2026-07-28 (reserved client _meta keys do not apply to server-to-client payloads).

ListRootsResult

Bases: Result

The client's response to a roots/list request from the server.

This result contains an array of Root objects, each representing a root directory or file that the server can operate on.

On 2026-07-28 this is carried as an InputResponses entry, not a JSON-RPC result. Deprecated in 2026-07-28 (SEP-2577).

Source code in src/mcp-types/mcp_types/_types.py
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
class ListRootsResult(Result):
    """The client's response to a roots/list request from the server.

    This result contains an array of Root objects, each representing a root
    directory or file that the server can operate on.

    On 2026-07-28 this is carried as an `InputResponses` entry, not a JSON-RPC
    result. Deprecated in 2026-07-28 (SEP-2577).
    """

    roots: list[Root]

ListTasksRequest

Bases: PaginatedRequest[Literal['tasks/list']]

A request to retrieve a list of tasks (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
716
717
718
719
class ListTasksRequest(PaginatedRequest[Literal["tasks/list"]]):
    """A request to retrieve a list of tasks (2025-11-25 only)."""

    method: Literal["tasks/list"] = "tasks/list"

ListTasksResult

Bases: PaginatedResult

The response to a tasks/list request (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
722
723
724
725
class ListTasksResult(PaginatedResult):
    """The response to a tasks/list request (2025-11-25 only)."""

    tasks: list[Task]

ListToolsRequest

Bases: PaginatedRequest[Literal['tools/list']]

Sent from the client to request a list of tools the server has.

Source code in src/mcp-types/mcp_types/_types.py
1343
1344
1345
1346
class ListToolsRequest(PaginatedRequest[Literal["tools/list"]]):
    """Sent from the client to request a list of tools the server has."""

    method: Literal["tools/list"] = "tools/list"

ListToolsResult

Bases: PaginatedResult, CacheableResult

The server's response to a tools/list request from the client.

Source code in src/mcp-types/mcp_types/_types.py
1424
1425
1426
1427
1428
1429
1430
class ListToolsResult(PaginatedResult, CacheableResult):
    """The server's response to a tools/list request from the client."""

    tools: list[Tool]

    result_type: ResultType = "complete"
    """See `ResultType`. Always serialized; older peers ignore it."""

result_type class-attribute instance-attribute

result_type: ResultType = 'complete'

See ResultType. Always serialized; older peers ignore it.

LoggingCapability

Bases: MCPModel

Capability for logging operations.

Source code in src/mcp-types/mcp_types/_types.py
435
436
class LoggingCapability(MCPModel):
    """Capability for logging operations."""

LoggingLevel module-attribute

LoggingLevel = Literal[
    "debug",
    "info",
    "notice",
    "warning",
    "error",
    "critical",
    "alert",
    "emergency",
]

The severity of a log message.

These map to syslog severities (RFC-5424 section 6.2.1). Logging is deprecated in 2026-07-28 (SEP-2577); the level scale is unchanged across versions.

LoggingMessageNotification

Bases: Notification[LoggingMessageNotificationParams, Literal['notifications/message']]

Notification of a log message passed from server to client.

Through 2025-11-25 the client subscribes via logging/setLevel. On 2026-07-28 the client opts in per-request via _meta (LOG_LEVEL_META_KEY) and the server MUST NOT send this without it. Deprecated in 2026-07-28 (SEP-2577).

Source code in src/mcp-types/mcp_types/_types.py
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
class LoggingMessageNotification(Notification[LoggingMessageNotificationParams, Literal["notifications/message"]]):
    """Notification of a log message passed from server to client.

    Through 2025-11-25 the client subscribes via `logging/setLevel`. On
    2026-07-28 the client opts in per-request via `_meta` (`LOG_LEVEL_META_KEY`)
    and the server MUST NOT send this without it. Deprecated in 2026-07-28 (SEP-2577).
    """

    method: Literal["notifications/message"] = "notifications/message"
    params: LoggingMessageNotificationParams

LoggingMessageNotificationParams

Bases: NotificationParams

Source code in src/mcp-types/mcp_types/_types.py
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
class LoggingMessageNotificationParams(NotificationParams):
    level: LoggingLevel
    """The severity of this log message."""
    logger: str | None = None
    """An optional name of the logger issuing this message."""
    data: Any
    """
    The data to be logged, such as a string message or an object. Any JSON serializable
    type is allowed here.
    """

level instance-attribute

level: LoggingLevel

The severity of this log message.

logger class-attribute instance-attribute

logger: str | None = None

An optional name of the logger issuing this message.

data instance-attribute

data: Any

The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.

MissingRequiredClientCapabilityErrorData

Bases: MCPModel

Error data for the -32021 missing-required-client-capability error (2026-07-28).

Source code in src/mcp-types/mcp_types/_types.py
405
406
407
408
409
class MissingRequiredClientCapabilityErrorData(MCPModel):
    """Error data for the -32021 missing-required-client-capability error (2026-07-28)."""

    required_capabilities: ClientCapabilities
    """The capabilities the server requires from the client to process this request."""

required_capabilities instance-attribute

required_capabilities: ClientCapabilities

The capabilities the server requires from the client to process this request.

ModelHint

Bases: MCPModel

Hints to use for model selection.

Keys not declared here are up to the client to interpret. Deprecated in 2026-07-28 (SEP-2577) with the rest of sampling.

Source code in src/mcp-types/mcp_types/_types.py
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
class ModelHint(MCPModel):
    """Hints to use for model selection.

    Keys not declared here are up to the client to interpret. Deprecated in
    2026-07-28 (SEP-2577) with the rest of sampling.
    """

    name: str | None = None
    """A hint for a model name.

    The client SHOULD treat this as a substring (e.g. `sonnet` matches
    `claude-3-5-sonnet-20241022`) and MAY map it to another provider's model
    that fills a similar niche.
    """

name class-attribute instance-attribute

name: str | None = None

A hint for a model name.

The client SHOULD treat this as a substring (e.g. sonnet matches claude-3-5-sonnet-20241022) and MAY map it to another provider's model that fills a similar niche.

ModelPreferences

Bases: MCPModel

The server's preferences for model selection, requested of the client during sampling.

Because LLMs can vary along multiple dimensions, choosing the "best" model is rarely straightforward. Different models excel in different areas—some are faster but less capable, others are more capable but more expensive, and so on. This interface allows servers to express their priorities across multiple dimensions to help clients make an appropriate selection for their use case.

These preferences are always advisory. The client MAY ignore them. It is also up to the client to decide how to interpret these preferences and how to balance them against other considerations.

Deprecated in 2026-07-28 (SEP-2577) with the rest of sampling.

Source code in src/mcp-types/mcp_types/_types.py
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
class ModelPreferences(MCPModel):
    """The server's preferences for model selection, requested of the client during
    sampling.

    Because LLMs can vary along multiple dimensions, choosing the "best" model is
    rarely straightforward. Different models excel in different areas—some are
    faster but less capable, others are more capable but more expensive, and so
    on. This interface allows servers to express their priorities across multiple
    dimensions to help clients make an appropriate selection for their use case.

    These preferences are always advisory. The client MAY ignore them. It is also
    up to the client to decide how to interpret these preferences and how to
    balance them against other considerations.

    Deprecated in 2026-07-28 (SEP-2577) with the rest of sampling.
    """

    hints: list[ModelHint] | None = None
    """
    Optional hints to use for model selection.

    If multiple hints are specified, the client MUST evaluate them in order
    (such that the first match is taken).

    The client SHOULD prioritize these hints over the numeric priorities, but
    MAY still use the priorities to select from ambiguous matches.
    """

    cost_priority: float | None = None
    """
    How much to prioritize cost when selecting a model. A value of 0 means cost
    is not important, while a value of 1 means cost is the most important
    factor.
    """

    speed_priority: float | None = None
    """
    How much to prioritize sampling speed (latency) when selecting a model. A
    value of 0 means speed is not important, while a value of 1 means speed is
    the most important factor.
    """

    intelligence_priority: float | None = None
    """
    How much to prioritize intelligence and capabilities when selecting a
    model. A value of 0 means intelligence is not important, while a value of 1
    means intelligence is the most important factor.
    """

hints class-attribute instance-attribute

hints: list[ModelHint] | None = None

Optional hints to use for model selection.

If multiple hints are specified, the client MUST evaluate them in order (such that the first match is taken).

The client SHOULD prioritize these hints over the numeric priorities, but MAY still use the priorities to select from ambiguous matches.

cost_priority class-attribute instance-attribute

cost_priority: float | None = None

How much to prioritize cost when selecting a model. A value of 0 means cost is not important, while a value of 1 means cost is the most important factor.

speed_priority class-attribute instance-attribute

speed_priority: float | None = None

How much to prioritize sampling speed (latency) when selecting a model. A value of 0 means speed is not important, while a value of 1 means speed is the most important factor.

intelligence_priority class-attribute instance-attribute

intelligence_priority: float | None = None

How much to prioritize intelligence and capabilities when selecting a model. A value of 0 means intelligence is not important, while a value of 1 means intelligence is the most important factor.

Notification

Bases: MCPModel, Generic[NotificationParamsT, MethodT]

Base class for JSON-RPC notifications.

Source code in src/mcp-types/mcp_types/_types.py
140
141
142
143
144
class Notification(MCPModel, Generic[NotificationParamsT, MethodT]):
    """Base class for JSON-RPC notifications."""

    method: MethodT
    params: NotificationParamsT

NotificationParams

Bases: MCPModel

Source code in src/mcp-types/mcp_types/_types.py
108
109
110
111
112
113
class NotificationParams(MCPModel):
    meta: Meta | None = Field(alias="_meta", default=None)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See MCP specification for notes on _meta usage.

PaginatedRequest

Bases: Request[PaginatedRequestParams | None, MethodT], Generic[MethodT]

Base class for paginated requests, matching the schema's PaginatedRequest interface.

Source code in src/mcp-types/mcp_types/_types.py
132
133
134
135
136
137
class PaginatedRequest(Request[PaginatedRequestParams | None, MethodT], Generic[MethodT]):
    """Base class for paginated requests, matching the schema's PaginatedRequest interface."""

    params: PaginatedRequestParams | None = None
    """Pagination params. Required on the 2026-07-28+ wire (because `_meta` is);
    the session layer materializes it there. Optional on earlier versions."""

params class-attribute instance-attribute

params: PaginatedRequestParams | None = None

Pagination params. Required on the 2026-07-28+ wire (because _meta is); the session layer materializes it there. Optional on earlier versions.

PaginatedRequestParams

Bases: RequestParams

Source code in src/mcp-types/mcp_types/_types.py
100
101
102
103
104
105
class PaginatedRequestParams(RequestParams):
    cursor: str | None = None
    """An opaque token representing the current pagination position.

    If provided, the server should return results starting after this cursor.
    """

cursor class-attribute instance-attribute

cursor: str | None = None

An opaque token representing the current pagination position.

If provided, the server should return results starting after this cursor.

PaginatedResult

Bases: Result

Source code in src/mcp-types/mcp_types/_types.py
172
173
174
175
176
177
class PaginatedResult(Result):
    next_cursor: str | None = None
    """
    An opaque token representing the pagination position after the last returned result.
    If present, there may be more results available.
    """

next_cursor class-attribute instance-attribute

next_cursor: str | None = None

An opaque token representing the pagination position after the last returned result. If present, there may be more results available.

PingRequest

Bases: Request[RequestParams | None, Literal['ping']]

A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.

Source code in src/mcp-types/mcp_types/_types.py
551
552
553
554
555
556
557
558
559
class PingRequest(Request[RequestParams | None, Literal["ping"]]):
    """A ping, issued by either the server or the client, to check that the other party is
    still alive. The receiver must promptly respond, or else may be disconnected.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    """

    method: Literal["ping"] = "ping"
    params: RequestParams | None = None

ProgressNotification

Bases: Notification[ProgressNotificationParams, Literal['notifications/progress']]

An out-of-band notification used to inform the receiver of a progress update for a long-running request.

Source code in src/mcp-types/mcp_types/_types.py
750
751
752
753
754
class ProgressNotification(Notification[ProgressNotificationParams, Literal["notifications/progress"]]):
    """An out-of-band notification used to inform the receiver of a progress update for a long-running request."""

    method: Literal["notifications/progress"] = "notifications/progress"
    params: ProgressNotificationParams

ProgressNotificationParams

Bases: NotificationParams

Parameters for progress notifications.

Source code in src/mcp-types/mcp_types/_types.py
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
class ProgressNotificationParams(NotificationParams):
    """Parameters for progress notifications."""

    progress_token: ProgressToken
    """
    The progress token which was given in the initial request, used to associate this
    notification with the request that is proceeding.
    """
    progress: float
    """
    The progress thus far. This should increase every time progress is made, even if the
    total is unknown.
    """
    total: float | None = None
    """Total number of items to process (or total progress required), if known."""
    message: str | None = None
    """Message related to progress.

    This should provide relevant human-readable progress information.
    """

progress_token instance-attribute

progress_token: ProgressToken

The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.

progress instance-attribute

progress: float

The progress thus far. This should increase every time progress is made, even if the total is unknown.

total class-attribute instance-attribute

total: float | None = None

Total number of items to process (or total progress required), if known.

message class-attribute instance-attribute

message: str | None = None

Message related to progress.

This should provide relevant human-readable progress information.

ProgressToken module-attribute

ProgressToken = str | int

A progress token, used to associate progress notifications with the original request.

Prompt

Bases: BaseMetadata

A prompt or prompt template that the server offers.

Source code in src/mcp-types/mcp_types/_types.py
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
class Prompt(BaseMetadata):
    """A prompt or prompt template that the server offers."""

    description: str | None = None
    """An optional description of what this prompt provides."""
    arguments: list[PromptArgument] | None = None
    """A list of arguments to use for templating the prompt."""
    icons: list[Icon] | None = None
    """An optional list of icons for this prompt."""
    meta: Meta | None = Field(alias="_meta", default=None)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

description class-attribute instance-attribute

description: str | None = None

An optional description of what this prompt provides.

arguments class-attribute instance-attribute

arguments: list[PromptArgument] | None = None

A list of arguments to use for templating the prompt.

icons class-attribute instance-attribute

icons: list[Icon] | None = None

An optional list of icons for this prompt.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See MCP specification for notes on _meta usage.

PromptArgument

Bases: BaseMetadata

Describes an argument that a prompt can accept.

Source code in src/mcp-types/mcp_types/_types.py
1087
1088
1089
1090
1091
1092
1093
class PromptArgument(BaseMetadata):
    """Describes an argument that a prompt can accept."""

    description: str | None = None
    """A human-readable description of the argument."""
    required: bool | None = None
    """Whether this argument must be provided."""

description class-attribute instance-attribute

description: str | None = None

A human-readable description of the argument.

required class-attribute instance-attribute

required: bool | None = None

Whether this argument must be provided.

PromptListChangedNotification

Bases: Notification[NotificationParams | None, Literal['notifications/prompts/list_changed']]

An optional notification from the server to the client, informing it that the list of prompts it offers has changed.

May be sent spontaneously through 2025-11-25; on 2026-07-28 sessions the client must opt in via subscriptions/listen.

Source code in src/mcp-types/mcp_types/_types.py
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
class PromptListChangedNotification(
    Notification[NotificationParams | None, Literal["notifications/prompts/list_changed"]]
):
    """An optional notification from the server to the client, informing it that the list
    of prompts it offers has changed.

    May be sent spontaneously through 2025-11-25; on 2026-07-28 sessions the
    client must opt in via `subscriptions/listen`.
    """

    method: Literal["notifications/prompts/list_changed"] = "notifications/prompts/list_changed"
    params: NotificationParams | None = None

PromptMessage

Bases: MCPModel

Describes a message returned as part of a prompt.

Similar to SamplingMessage, but also supports embedded resources.

Source code in src/mcp-types/mcp_types/_types.py
1307
1308
1309
1310
1311
1312
1313
1314
class PromptMessage(MCPModel):
    """Describes a message returned as part of a prompt.

    Similar to `SamplingMessage`, but also supports embedded resources.
    """

    role: Role
    content: ContentBlock

PromptReference

Bases: MCPModel

Identifies a prompt.

Source code in src/mcp-types/mcp_types/_types.py
1735
1736
1737
1738
1739
1740
1741
1742
class PromptReference(MCPModel):
    """Identifies a prompt."""

    type: Literal["ref/prompt"] = "ref/prompt"
    name: str
    """The name of the prompt or prompt template."""
    title: str | None = None
    """Human-readable display title. If not provided, `name` should be used for display."""

name instance-attribute

name: str

The name of the prompt or prompt template.

title class-attribute instance-attribute

title: str | None = None

Human-readable display title. If not provided, name should be used for display.

PromptsCapability

Bases: MCPModel

Capability for prompts operations.

Source code in src/mcp-types/mcp_types/_types.py
412
413
414
415
416
class PromptsCapability(MCPModel):
    """Capability for prompts operations."""

    list_changed: bool | None = None
    """Whether this server supports notifications for changes to the prompt list."""

list_changed class-attribute instance-attribute

list_changed: bool | None = None

Whether this server supports notifications for changes to the prompt list.

ReadResourceRequest

Bases: Request[ReadResourceRequestParams, Literal['resources/read']]

Sent from the client to the server, to read a specific resource URI.

Source code in src/mcp-types/mcp_types/_types.py
877
878
879
880
881
class ReadResourceRequest(Request[ReadResourceRequestParams, Literal["resources/read"]]):
    """Sent from the client to the server, to read a specific resource URI."""

    method: Literal["resources/read"] = "resources/read"
    params: ReadResourceRequestParams

ReadResourceRequestParams

Bases: InputResponseRequestParams

Source code in src/mcp-types/mcp_types/_types.py
869
870
871
872
873
874
class ReadResourceRequestParams(InputResponseRequestParams):
    uri: str
    """
    The URI of the resource. The URI can use any protocol; it is up to the server
    how to interpret it.
    """

uri instance-attribute

uri: str

The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.

ReadResourceResult

Bases: CacheableResult

The server's response to a resources/read request from the client.

Source code in src/mcp-types/mcp_types/_types.py
915
916
917
918
919
920
921
922
class ReadResourceResult(CacheableResult):
    """The server's response to a resources/read request from the client."""

    contents: list[TextResourceContents | BlobResourceContents]
    """The contents of the resource or sub-resources that were read."""

    result_type: ResultType = "complete"
    """See `ResultType`. Always serialized; older peers ignore it."""

contents instance-attribute

The contents of the resource or sub-resources that were read.

result_type class-attribute instance-attribute

result_type: ResultType = 'complete'

See ResultType. Always serialized; older peers ignore it.

RelatedTaskMetadata

Bases: MCPModel

Associates a message with a task, via _meta["io.modelcontextprotocol/related-task"] (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
613
614
615
616
class RelatedTaskMetadata(MCPModel):
    """Associates a message with a task, via `_meta["io.modelcontextprotocol/related-task"]` (2025-11-25 only)."""

    task_id: str

Request

Bases: MCPModel, Generic[RequestParamsT, MethodT]

Base class for JSON-RPC requests.

The JSON-RPC envelope (jsonrpc, id) is attached by the session layer (see mcp_types.jsonrpc), not carried here.

Source code in src/mcp-types/mcp_types/_types.py
121
122
123
124
125
126
127
128
129
class Request(MCPModel, Generic[RequestParamsT, MethodT]):
    """Base class for JSON-RPC requests.

    The JSON-RPC envelope (`jsonrpc`, `id`) is attached by the session layer
    (see `mcp_types.jsonrpc`), not carried here.
    """

    method: MethodT
    params: RequestParamsT

RequestParams

Bases: MCPModel

Source code in src/mcp-types/mcp_types/_types.py
89
90
91
92
93
94
95
96
97
class RequestParams(MCPModel):
    meta: RequestParamsMeta | None = Field(alias="_meta", default=None)
    """Metadata reserved by MCP for protocol-level concerns (wire name `_meta`).

    Carries the optional progress token and, on 2026-07-28+ sessions, the
    reserved `io.modelcontextprotocol/*` keys. Required on the wire for
    2026-07-28+ client requests; the session layer supplies the reserved
    entries, so code sending through an SDK session leaves this unset.
    """

meta class-attribute instance-attribute

meta: RequestParamsMeta | None = Field(
    alias="_meta", default=None
)

Metadata reserved by MCP for protocol-level concerns (wire name _meta).

Carries the optional progress token and, on 2026-07-28+ sessions, the reserved io.modelcontextprotocol/* keys. Required on the wire for 2026-07-28+ client requests; the session layer supplies the reserved entries, so code sending through an SDK session leaves this unset.

RequestParamsMeta

Bases: TypedDict

The _meta object on request params (schema name: RequestMetaObject).

An open map: arbitrary keys round-trip via extra_items=Any. Read or set the reserved io.modelcontextprotocol/* keys via the *_META_KEY constants.

Source code in src/mcp-types/mcp_types/_types.py
73
74
75
76
77
78
79
80
81
82
83
84
85
86
class RequestParamsMeta(TypedDict, extra_items=Any):
    """The `_meta` object on request params (schema name: `RequestMetaObject`).

    An open map: arbitrary keys round-trip via `extra_items=Any`. Read or set
    the reserved `io.modelcontextprotocol/*` keys via the `*_META_KEY` constants.
    """

    progress_token: NotRequired[ProgressToken]
    """
    If specified, the caller requests out-of-band progress notifications for
    this request (as represented by notifications/progress). The value of this
    parameter is an opaque token that will be attached to any subsequent
    notifications. The receiver is not obligated to provide these notifications.
    """

progress_token instance-attribute

progress_token: NotRequired[ProgressToken]

If specified, the caller requests out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.

Resource

Bases: BaseMetadata

A known resource that the server is capable of reading.

Source code in src/mcp-types/mcp_types/_types.py
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
class Resource(BaseMetadata):
    """A known resource that the server is capable of reading."""

    uri: str
    """The URI of this resource."""

    description: str | None = None
    """A description of what this resource represents."""

    mime_type: str | None = None
    """The MIME type of this resource, if known."""

    size: int | None = None
    """The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.

    This can be used by Hosts to display file sizes and estimate context window usage.
    """

    icons: list[Icon] | None = None
    """Optional set of sized icons that the client can display in a user interface."""

    annotations: Annotations | None = None
    """Optional annotations for the client."""

    meta: Meta | None = Field(alias="_meta", default=None)
    """See the MCP specification for notes on `_meta` usage."""

uri instance-attribute

uri: str

The URI of this resource.

description class-attribute instance-attribute

description: str | None = None

A description of what this resource represents.

mime_type class-attribute instance-attribute

mime_type: str | None = None

The MIME type of this resource, if known.

size class-attribute instance-attribute

size: int | None = None

The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known.

This can be used by Hosts to display file sizes and estimate context window usage.

icons class-attribute instance-attribute

icons: list[Icon] | None = None

Optional set of sized icons that the client can display in a user interface.

annotations class-attribute instance-attribute

annotations: Annotations | None = None

Optional annotations for the client.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See the MCP specification for notes on _meta usage.

ResourceContents

Bases: MCPModel

The contents of a specific resource or sub-resource.

Source code in src/mcp-types/mcp_types/_types.py
884
885
886
887
888
889
890
891
892
893
894
895
class ResourceContents(MCPModel):
    """The contents of a specific resource or sub-resource."""

    uri: str
    """The URI of this resource."""
    mime_type: str | None = None
    """The MIME type of this resource, if known."""
    meta: Meta | None = Field(alias="_meta", default=None)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

uri instance-attribute

uri: str

The URI of this resource.

mime_type class-attribute instance-attribute

mime_type: str | None = None

The MIME type of this resource, if known.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See MCP specification for notes on _meta usage.

Bases: 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.

Source code in src/mcp-types/mcp_types/_types.py
1294
1295
1296
1297
1298
1299
1300
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"] = "resource_link"

ResourceListChangedNotification

Bases: Notification[NotificationParams | None, Literal['notifications/resources/list_changed']]

An optional notification from the server to the client, informing it that the list of resources it can read from has changed.

May be sent spontaneously through 2025-11-25; on 2026-07-28 sessions the client must opt in via subscriptions/listen.

Source code in src/mcp-types/mcp_types/_types.py
925
926
927
928
929
930
931
932
933
934
935
936
class ResourceListChangedNotification(
    Notification[NotificationParams | None, Literal["notifications/resources/list_changed"]]
):
    """An optional notification from the server to the client, informing it that the list
    of resources it can read from has changed.

    May be sent spontaneously through 2025-11-25; on 2026-07-28 sessions the
    client must opt in via `subscriptions/listen`.
    """

    method: Literal["notifications/resources/list_changed"] = "notifications/resources/list_changed"
    params: NotificationParams | None = None

ResourcesCapability

Bases: MCPModel

Capability for resources operations.

Source code in src/mcp-types/mcp_types/_types.py
419
420
421
422
423
424
425
class ResourcesCapability(MCPModel):
    """Capability for resources operations."""

    subscribe: bool | None = None
    """Whether this server supports subscribing to resource updates."""
    list_changed: bool | None = None
    """Whether this server supports notifications for changes to the resource list."""

subscribe class-attribute instance-attribute

subscribe: bool | None = None

Whether this server supports subscribing to resource updates.

list_changed class-attribute instance-attribute

list_changed: bool | None = None

Whether this server supports notifications for changes to the resource list.

ResourceTemplate

Bases: BaseMetadata

A template description for resources available on the server.

Source code in src/mcp-types/mcp_types/_types.py
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
class ResourceTemplate(BaseMetadata):
    """A template description for resources available on the server."""

    uri_template: str
    """A URI template (according to RFC 6570) that can be used to construct resource URIs."""

    description: str | None = None
    """A description of what this template is for."""

    mime_type: str | None = None
    """The MIME type for all resources that match this template.

    This should only be included if all resources matching this template have the same type.
    """

    icons: list[Icon] | None = None
    """An optional set of sized icons that the client can display in a user interface."""

    annotations: Annotations | None = None
    """Optional annotations for the client."""

    meta: Meta | None = Field(alias="_meta", default=None)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

uri_template instance-attribute

uri_template: str

A URI template (according to RFC 6570) that can be used to construct resource URIs.

description class-attribute instance-attribute

description: str | None = None

A description of what this template is for.

mime_type class-attribute instance-attribute

mime_type: str | None = None

The MIME type for all resources that match this template.

This should only be included if all resources matching this template have the same type.

icons class-attribute instance-attribute

icons: list[Icon] | None = None

An optional set of sized icons that the client can display in a user interface.

annotations class-attribute instance-attribute

annotations: Annotations | None = None

Optional annotations for the client.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See MCP specification for notes on _meta usage.

ResourceTemplateReference

Bases: MCPModel

A reference to a resource or resource template definition.

Source code in src/mcp-types/mcp_types/_types.py
1726
1727
1728
1729
1730
1731
class ResourceTemplateReference(MCPModel):
    """A reference to a resource or resource template definition."""

    type: Literal["ref/resource"] = "ref/resource"
    uri: str
    """The URI or URI template of the resource."""

uri instance-attribute

uri: str

The URI or URI template of the resource.

ResourceUpdatedNotification

Bases: Notification[ResourceUpdatedNotificationParams, Literal['notifications/resources/updated']]

A notification from the server to the client, informing it that a resource has changed and may need to be read again.

Only sent if the client subscribed: via resources/subscribe through 2025-11-25, or subscriptions/listen on 2026-07-28.

Source code in src/mcp-types/mcp_types/_types.py
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
class ResourceUpdatedNotification(
    Notification[ResourceUpdatedNotificationParams, Literal["notifications/resources/updated"]]
):
    """A notification from the server to the client, informing it that a resource has
    changed and may need to be read again.

    Only sent if the client subscribed: via `resources/subscribe` through
    2025-11-25, or `subscriptions/listen` on 2026-07-28.
    """

    method: Literal["notifications/resources/updated"] = "notifications/resources/updated"
    params: ResourceUpdatedNotificationParams

ResourceUpdatedNotificationParams

Bases: NotificationParams

Source code in src/mcp-types/mcp_types/_types.py
986
987
988
989
990
991
class ResourceUpdatedNotificationParams(NotificationParams):
    uri: str
    """
    The URI of the resource that has been updated. This might be a sub-resource of the
    one that the client actually subscribed to.
    """

uri instance-attribute

uri: str

The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.

Result

Bases: MCPModel

Base class for JSON-RPC results.

result_type is declared per concrete subclass, not here, because defaults differ: most results default to "complete", EmptyResult defaults to None (so it dumps as {}; some peer SDKs strict-validate empty results), and InputRequiredResult carries a literal.

Source code in src/mcp-types/mcp_types/_types.py
156
157
158
159
160
161
162
163
164
165
166
167
168
169
class Result(MCPModel):
    """Base class for JSON-RPC results.

    `result_type` is declared per concrete subclass, not here, because defaults
    differ: most results default to "complete", `EmptyResult` defaults to None
    (so it dumps as `{}`; some peer SDKs strict-validate empty results), and
    `InputRequiredResult` carries a literal.
    """

    meta: Meta | None = Field(alias="_meta", default=None)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See MCP specification for notes on _meta usage.

ResultType module-attribute

ResultType = Literal['complete', 'input_required'] | str

Tags a Result so the client knows how to parse it (2026-07-28).

"complete" means the result is final; "input_required" means it is an InputRequiredResult. The union is open (the tasks extension reserves "task"). Absent resultType is equivalent to "complete".

Role module-attribute

Role = Literal['user', 'assistant']

The sender or recipient of messages and data in a conversation.

Root

Bases: MCPModel

Represents a root directory or file that the server can operate on.

Deprecated in 2026-07-28 (SEP-2577) with the rest of roots.

Source code in src/mcp-types/mcp_types/_types.py
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
class Root(MCPModel):
    """Represents a root directory or file that the server can operate on.

    Deprecated in 2026-07-28 (SEP-2577) with the rest of roots.
    """

    uri: FileUrl
    """
    The URI identifying the root. This *must* start with file:// for now.
    This restriction may be relaxed in future versions of the protocol to allow
    other URI schemes.
    """
    name: str | None = None
    """
    An optional name for the root. This can be used to provide a human-readable
    identifier for the root, which may be useful for display purposes or for
    referencing the root in other parts of the application.
    """
    meta: Meta | None = Field(alias="_meta", default=None)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

uri instance-attribute

uri: FileUrl

The URI identifying the root. This must start with file:// for now. This restriction may be relaxed in future versions of the protocol to allow other URI schemes.

name class-attribute instance-attribute

name: str | None = None

An optional name for the root. This can be used to provide a human-readable identifier for the root, which may be useful for display purposes or for referencing the root in other parts of the application.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See MCP specification for notes on _meta usage.

RootsCapability

Bases: MCPModel

Capability for root operations.

Deprecated in protocol 2026-07-28 (SEP-2577) but still carried there as an empty object (list_changed exists only through 2025-11-25).

Source code in src/mcp-types/mcp_types/_types.py
265
266
267
268
269
270
271
272
273
class RootsCapability(MCPModel):
    """Capability for root operations.

    Deprecated in protocol 2026-07-28 (SEP-2577) but still carried there as an
    empty object (`list_changed` exists only through 2025-11-25).
    """

    list_changed: bool | None = None
    """Whether the client supports notifications for changes to the roots list."""

list_changed class-attribute instance-attribute

list_changed: bool | None = None

Whether the client supports notifications for changes to the roots list.

RootsListChangedNotification

Bases: Notification[NotificationParams | None, Literal['notifications/roots/list_changed']]

A notification from the client to the server, informing it that the list of roots has changed.

This notification should be sent whenever the client adds, removes, or modifies any root. The server should then request an updated list of roots using the ListRootsRequest.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.

Source code in src/mcp-types/mcp_types/_types.py
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
class RootsListChangedNotification(
    Notification[NotificationParams | None, Literal["notifications/roots/list_changed"]]
):
    """A notification from the client to the server, informing it that the list of
    roots has changed.

    This notification should be sent whenever the client adds, removes, or
    modifies any root. The server should then request an updated list of roots
    using the ListRootsRequest.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    """

    method: Literal["notifications/roots/list_changed"] = "notifications/roots/list_changed"
    params: NotificationParams | None = None

SamplingCapability

Bases: MCPModel

Sampling capability structure. Deprecated in 2026-07-28 (SEP-2577); shape unchanged.

Source code in src/mcp-types/mcp_types/_types.py
313
314
315
316
317
318
319
320
321
322
323
324
325
class SamplingCapability(MCPModel):
    """Sampling capability structure. Deprecated in 2026-07-28 (SEP-2577); shape unchanged."""

    context: SamplingContextCapability | None = None
    """
    Present if the client supports non-'none' values for includeContext parameter.
    SOFT-DEPRECATED: New implementations should use tools parameter instead.
    """
    tools: SamplingToolsCapability | None = None
    """
    Present if the client supports tools and toolChoice parameters in sampling requests.
    Presence indicates full tool calling support during sampling.
    """

context class-attribute instance-attribute

context: SamplingContextCapability | None = None

Present if the client supports non-'none' values for includeContext parameter. SOFT-DEPRECATED: New implementations should use tools parameter instead.

tools class-attribute instance-attribute

tools: SamplingToolsCapability | None = None

Present if the client supports tools and toolChoice parameters in sampling requests. Presence indicates full tool calling support during sampling.

SamplingContent module-attribute

SamplingContent: TypeAlias = (
    TextContent | ImageContent | AudioContent
)

Basic content types for sampling responses (without tool use).

Used for backwards-compatible CreateMessageResult when tools are not used.

SamplingContextCapability

Bases: MCPModel

Capability for context inclusion during sampling.

Indicates support for non-'none' values in the includeContext parameter. SOFT-DEPRECATED: New implementations should use tools parameter instead.

Source code in src/mcp-types/mcp_types/_types.py
276
277
278
279
280
281
class SamplingContextCapability(MCPModel):
    """Capability for context inclusion during sampling.

    Indicates support for non-'none' values in the includeContext parameter.
    SOFT-DEPRECATED: New implementations should use tools parameter instead.
    """

SamplingMessage

Bases: MCPModel

Describes a message issued to or received from an LLM API.

Source code in src/mcp-types/mcp_types/_types.py
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
class SamplingMessage(MCPModel):
    """Describes a message issued to or received from an LLM API."""

    role: Role
    content: SamplingMessageContentBlock | list[SamplingMessageContentBlock]
    """
    Message content. Can be a single content block or an array of content blocks
    for multi-modal messages and tool interactions.
    """
    meta: Meta | None = Field(alias="_meta", default=None)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

    @property
    def content_as_list(self) -> list[SamplingMessageContentBlock]:
        """Returns the content as a list of content blocks, regardless of whether
        it was originally a single block or a list."""
        return self.content if isinstance(self.content, list) else [self.content]

content instance-attribute

Message content. Can be a single content block or an array of content blocks for multi-modal messages and tool interactions.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See MCP specification for notes on _meta usage.

content_as_list property

Returns the content as a list of content blocks, regardless of whether it was originally a single block or a list.

SamplingMessageContentBlock module-attribute

Content block types allowed in sampling messages.

This is the widest (2025-11-25+) membership; older sessions allow only a subset on the wire. Serialization never narrows a value to fit; version gating is the session layer's responsibility. Deprecated in 2026-07-28 (SEP-2577).

SamplingToolsCapability

Bases: MCPModel

Capability indicating support for tool calling during sampling.

When present in ClientCapabilities.sampling, indicates that the client supports the tools and toolChoice parameters in sampling requests.

Source code in src/mcp-types/mcp_types/_types.py
284
285
286
287
288
289
class SamplingToolsCapability(MCPModel):
    """Capability indicating support for tool calling during sampling.

    When present in ClientCapabilities.sampling, indicates that the client
    supports the tools and toolChoice parameters in sampling requests.
    """

ServerCapabilities

Bases: MCPModel

Capabilities that a server may support. Not a closed set.

Source code in src/mcp-types/mcp_types/_types.py
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
class ServerCapabilities(MCPModel):
    """Capabilities that a server may support. Not a closed set."""

    experimental: dict[str, dict[str, Any]] | None = None
    """Experimental, non-standard capabilities that the server supports."""

    logging: LoggingCapability | None = None
    """Present if the server supports sending log messages to the client.
    Deprecated in 2026-07-28 (SEP-2577)."""

    prompts: PromptsCapability | None = None
    """Present if the server offers any prompt templates."""

    resources: ResourcesCapability | None = None
    """Present if the server offers any resources to read."""

    tools: ToolsCapability | None = None
    """Present if the server offers any tools to call."""

    completions: CompletionsCapability | None = None
    """Present if the server offers autocompletion suggestions for prompts and resources."""

    extensions: dict[str, dict[str, Any]] | None = None
    """MCP extensions the server supports (2026-07-28). Keys are extension
    identifiers; values are per-extension settings (empty object = no settings)."""

    tasks: ServerTasksCapability | None = None
    """Present if the server supports task-augmented requests (2025-11-25 only)."""

experimental class-attribute instance-attribute

experimental: dict[str, dict[str, Any]] | None = None

Experimental, non-standard capabilities that the server supports.

logging class-attribute instance-attribute

logging: LoggingCapability | None = None

Present if the server supports sending log messages to the client. Deprecated in 2026-07-28 (SEP-2577).

prompts class-attribute instance-attribute

prompts: PromptsCapability | None = None

Present if the server offers any prompt templates.

resources class-attribute instance-attribute

resources: ResourcesCapability | None = None

Present if the server offers any resources to read.

tools class-attribute instance-attribute

tools: ToolsCapability | None = None

Present if the server offers any tools to call.

completions class-attribute instance-attribute

completions: CompletionsCapability | None = None

Present if the server offers autocompletion suggestions for prompts and resources.

extensions class-attribute instance-attribute

extensions: dict[str, dict[str, Any]] | None = None

MCP extensions the server supports (2026-07-28). Keys are extension identifiers; values are per-extension settings (empty object = no settings).

tasks class-attribute instance-attribute

tasks: ServerTasksCapability | None = None

Present if the server supports task-augmented requests (2025-11-25 only).

ServerNotification module-attribute

Union of server-to-client notification payloads across all supported protocol versions.

TaskStatusNotification is deliberately excluded (types-only).

ServerRequest module-attribute

Union of standalone JSON-RPC requests a server can send to a client.

Live through 2025-11-25 only: 2026-07-28 has no server-to-client JSON-RPC requests (these payloads are embedded in InputRequiredResult instead).

ServerResult module-attribute

Union of every result payload a server can return for a client request.

InputRequiredResult is deliberately last: both of its fields are optional, so an earlier position would shadow other members during union resolution.

ServerTasksCapability

Bases: MCPModel

Capability for server tasks operations (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
459
460
461
462
463
464
class ServerTasksCapability(MCPModel):
    """Capability for server tasks operations (2025-11-25 only)."""

    list: TasksListCapability | None = None
    cancel: TasksCancelCapability | None = None
    requests: ServerTasksRequestsCapability | None = None

ServerTasksRequestsCapability

Bases: MCPModel

Specifies which request types the server can augment with tasks (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
453
454
455
456
class ServerTasksRequestsCapability(MCPModel):
    """Specifies which request types the server can augment with tasks (2025-11-25 only)."""

    tools: TasksToolsCapability | None = None

SetLevelRequest

Bases: Request[SetLevelRequestParams, Literal['logging/setLevel']]

A request from the client to the server, to enable or adjust logging.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25. On 2026-07-28 the client opts in per-request via _meta (LOG_LEVEL_META_KEY).

Source code in src/mcp-types/mcp_types/_types.py
1502
1503
1504
1505
1506
1507
1508
1509
1510
class SetLevelRequest(Request[SetLevelRequestParams, Literal["logging/setLevel"]]):
    """A request from the client to the server, to enable or adjust logging.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    On 2026-07-28 the client opts in per-request via `_meta` (`LOG_LEVEL_META_KEY`).
    """

    method: Literal["logging/setLevel"] = "logging/setLevel"
    params: SetLevelRequestParams

SetLevelRequestParams

Bases: RequestParams

Parameters for setting the logging level.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.

Source code in src/mcp-types/mcp_types/_types.py
1491
1492
1493
1494
1495
1496
1497
1498
1499
class SetLevelRequestParams(RequestParams):
    """Parameters for setting the logging level.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    """

    level: LoggingLevel
    """The level of logging that the client wants to receive from the server.
    The server should send all logs at this level and higher (more severe)."""

level instance-attribute

level: LoggingLevel

The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (more severe).

StopReason module-attribute

StopReason = (
    Literal[
        "endTurn", "stopSequence", "maxTokens", "toolUse"
    ]
    | str
)

The reason why sampling stopped, if known.

An open union to allow provider-specific stop reasons. "toolUse" is 2025-11-25+.

SubscribeRequest

Bases: Request[SubscribeRequestParams, Literal['resources/subscribe']]

Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25. On 2026-07-28 use subscriptions/listen instead.

Source code in src/mcp-types/mcp_types/_types.py
952
953
954
955
956
957
958
959
960
961
class SubscribeRequest(Request[SubscribeRequestParams, Literal["resources/subscribe"]]):
    """Sent from the client to request resources/updated notifications from the server
    whenever a particular resource changes.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    On 2026-07-28 use `subscriptions/listen` instead.
    """

    method: Literal["resources/subscribe"] = "resources/subscribe"
    params: SubscribeRequestParams

SubscribeRequestParams

Bases: RequestParams

Parameters for subscribing to a resource.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.

Source code in src/mcp-types/mcp_types/_types.py
939
940
941
942
943
944
945
946
947
948
949
class SubscribeRequestParams(RequestParams):
    """Parameters for subscribing to a resource.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    """

    uri: str
    """
    The URI of the resource to subscribe to. The URI can use any protocol; it is up to
    the server how to interpret it.
    """

uri instance-attribute

uri: str

The URI of the resource to subscribe to. The URI can use any protocol; it is up to the server how to interpret it.

SubscriptionFilter

Bases: MCPModel

The set of notification types a client opts in to via subscriptions/listen (2026-07-28).

Each type is opt-in; the server MUST NOT send types not requested here. Echoed back in notifications/subscriptions/acknowledged as the subset the server agreed to honor. Extensions merge additional keys (e.g. taskIds), so unknown keys round-trip.

Source code in src/mcp-types/mcp_types/_types.py
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
class SubscriptionFilter(MCPModel):
    """The set of notification types a client opts in to via `subscriptions/listen` (2026-07-28).

    Each type is opt-in; the server MUST NOT send types not requested here.
    Echoed back in `notifications/subscriptions/acknowledged` as the subset the
    server agreed to honor. Extensions merge additional keys (e.g. `taskIds`),
    so unknown keys round-trip.
    """

    model_config = ConfigDict(alias_generator=to_camel, populate_by_name=True, extra="allow")

    tools_list_changed: bool | None = None
    """If true, receive notifications/tools/list_changed."""

    prompts_list_changed: bool | None = None
    """If true, receive notifications/prompts/list_changed."""

    resources_list_changed: bool | None = None
    """If true, receive notifications/resources/list_changed."""

    resource_subscriptions: list[str] | None = None
    """Subscribe to notifications/resources/updated for these resource URIs."""

tools_list_changed class-attribute instance-attribute

tools_list_changed: bool | None = None

If true, receive notifications/tools/list_changed.

prompts_list_changed class-attribute instance-attribute

prompts_list_changed: bool | None = None

If true, receive notifications/prompts/list_changed.

resources_list_changed class-attribute instance-attribute

resources_list_changed: bool | None = None

If true, receive notifications/resources/list_changed.

resource_subscriptions class-attribute instance-attribute

resource_subscriptions: list[str] | None = None

Subscribe to notifications/resources/updated for these resource URIs.

SubscriptionsAcknowledgedNotification

Bases: Notification[SubscriptionsAcknowledgedNotificationParams, Literal['notifications/subscriptions/acknowledged']]

First message on a subscriptions/listen stream: acknowledges the subscription and reports which notification types the server will honor (2026-07-28).

Source code in src/mcp-types/mcp_types/_types.py
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
class SubscriptionsAcknowledgedNotification(
    Notification[
        SubscriptionsAcknowledgedNotificationParams,
        Literal["notifications/subscriptions/acknowledged"],
    ]
):
    """First message on a `subscriptions/listen` stream: acknowledges the
    subscription and reports which notification types the server will honor (2026-07-28).
    """

    method: Literal["notifications/subscriptions/acknowledged"] = "notifications/subscriptions/acknowledged"
    params: SubscriptionsAcknowledgedNotificationParams

SubscriptionsAcknowledgedNotificationParams

Bases: NotificationParams

Source code in src/mcp-types/mcp_types/_types.py
1046
1047
1048
1049
class SubscriptionsAcknowledgedNotificationParams(NotificationParams):
    notifications: SubscriptionFilter
    """The subset of requested notification types the server agreed to honor.
    Unsupported types are omitted."""

notifications instance-attribute

notifications: SubscriptionFilter

The subset of requested notification types the server agreed to honor. Unsupported types are omitted.

SubscriptionsListenRequest

Bases: Request[SubscriptionsListenRequestParams, Literal['subscriptions/listen']]

Opens a long-lived channel for receiving notifications outside the context of a specific request (2026-07-28).

Source code in src/mcp-types/mcp_types/_types.py
1037
1038
1039
1040
1041
1042
1043
class SubscriptionsListenRequest(Request[SubscriptionsListenRequestParams, Literal["subscriptions/listen"]]):
    """Opens a long-lived channel for receiving notifications outside the context
    of a specific request (2026-07-28).
    """

    method: Literal["subscriptions/listen"] = "subscriptions/listen"
    params: SubscriptionsListenRequestParams

SubscriptionsListenRequestParams

Bases: RequestParams

Source code in src/mcp-types/mcp_types/_types.py
1032
1033
1034
class SubscriptionsListenRequestParams(RequestParams):
    notifications: SubscriptionFilter
    """The notifications the client opts in to on this stream."""

notifications instance-attribute

notifications: SubscriptionFilter

The notifications the client opts in to on this stream.

SubscriptionsListenResult

Bases: Result

Signals that a subscriptions/listen stream has ended gracefully (2026-07-28).

Because the listen stream is long-lived, this result is sent only when the server tears the subscription down (for example during shutdown); an abrupt transport close carries no response. The body is otherwise empty: the _meta["io.modelcontextprotocol/subscriptionId"] key is required on the wire and equals the JSON-RPC id of the originating subscriptions/listen request.

Source code in src/mcp-types/mcp_types/_types.py
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
class SubscriptionsListenResult(Result):
    """Signals that a `subscriptions/listen` stream has ended gracefully (2026-07-28).

    Because the listen stream is long-lived, this result is sent only when the
    server tears the subscription down (for example during shutdown); an abrupt
    transport close carries no response. The body is otherwise empty: the
    `_meta["io.modelcontextprotocol/subscriptionId"]` key is required on the
    wire and equals the JSON-RPC id of the originating `subscriptions/listen`
    request.
    """

    result_type: ResultType = "complete"
    """See `ResultType`. Always serialized; older peers ignore it."""

result_type class-attribute instance-attribute

result_type: ResultType = 'complete'

See ResultType. Always serialized; older peers ignore it.

Task

Bases: MCPModel

Data associated with a task (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
class Task(MCPModel):
    """Data associated with a task (2025-11-25 only)."""

    task_id: str

    status: TaskStatus

    status_message: str | None = None
    """Optional human-readable message describing the current task state."""

    created_at: str
    """ISO 8601 timestamp when the task was created."""

    last_updated_at: str
    """ISO 8601 timestamp when the task was last updated."""

    ttl: int | None
    """Actual retention duration from creation in milliseconds, null for unlimited."""

    poll_interval: int | None = None
    """Suggested polling interval in milliseconds."""

status_message class-attribute instance-attribute

status_message: str | None = None

Optional human-readable message describing the current task state.

created_at instance-attribute

created_at: str

ISO 8601 timestamp when the task was created.

last_updated_at instance-attribute

last_updated_at: str

ISO 8601 timestamp when the task was last updated.

ttl instance-attribute

ttl: int | None

Actual retention duration from creation in milliseconds, null for unlimited.

poll_interval class-attribute instance-attribute

poll_interval: int | None = None

Suggested polling interval in milliseconds.

TaskMetadata

Bases: MCPModel

Metadata for augmenting a request with task execution (the task params field; 2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
606
607
608
609
610
class TaskMetadata(MCPModel):
    """Metadata for augmenting a request with task execution (the `task` params field; 2025-11-25 only)."""

    ttl: int | None = None
    """Requested duration in milliseconds to retain task from creation."""

ttl class-attribute instance-attribute

ttl: int | None = None

Requested duration in milliseconds to retain task from creation.

TasksCallCapability

Bases: MCPModel

Capability for task-augmented tools/call requests (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
443
444
class TasksCallCapability(MCPModel):
    """Capability for task-augmented tools/call requests (2025-11-25 only)."""

TasksCancelCapability

Bases: MCPModel

Capability for tasks cancel operations (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
332
333
class TasksCancelCapability(MCPModel):
    """Capability for tasks cancel operations (2025-11-25 only)."""

TasksCreateElicitationCapability

Bases: MCPModel

Capability for task-augmented elicitation/create requests (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
346
347
class TasksCreateElicitationCapability(MCPModel):
    """Capability for task-augmented elicitation/create requests (2025-11-25 only)."""

TasksCreateMessageCapability

Bases: MCPModel

Capability for task-augmented sampling/createMessage requests (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
336
337
class TasksCreateMessageCapability(MCPModel):
    """Capability for task-augmented sampling/createMessage requests (2025-11-25 only)."""

TasksElicitationCapability

Bases: MCPModel

Capability for task-augmented elicitation operations (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
350
351
352
353
class TasksElicitationCapability(MCPModel):
    """Capability for task-augmented elicitation operations (2025-11-25 only)."""

    create: TasksCreateElicitationCapability | None = None

TasksListCapability

Bases: MCPModel

Capability for tasks listing operations (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
328
329
class TasksListCapability(MCPModel):
    """Capability for tasks listing operations (2025-11-25 only)."""

TasksSamplingCapability

Bases: MCPModel

Capability for task-augmented sampling operations (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
340
341
342
343
class TasksSamplingCapability(MCPModel):
    """Capability for task-augmented sampling operations (2025-11-25 only)."""

    create_message: TasksCreateMessageCapability | None = None

TaskStatus module-attribute

TaskStatus = Literal[
    "working",
    "input_required",
    "completed",
    "failed",
    "cancelled",
]

The status of a task (2025-11-25 only).

TaskStatusNotification

Bases: Notification[TaskStatusNotificationParams, Literal['notifications/tasks/status']]

An optional notification informing the requestor that a task's status has changed (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
686
687
688
689
690
class TaskStatusNotification(Notification[TaskStatusNotificationParams, Literal["notifications/tasks/status"]]):
    """An optional notification informing the requestor that a task's status has changed (2025-11-25 only)."""

    method: Literal["notifications/tasks/status"] = "notifications/tasks/status"
    params: TaskStatusNotificationParams

TaskStatusNotificationParams

Bases: NotificationParams, Task

Parameters for a notifications/tasks/status notification.

Source code in src/mcp-types/mcp_types/_types.py
682
683
class TaskStatusNotificationParams(NotificationParams, Task):
    """Parameters for a `notifications/tasks/status` notification."""

TasksToolsCapability

Bases: MCPModel

Capability for task-augmented tool operations (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
447
448
449
450
class TasksToolsCapability(MCPModel):
    """Capability for task-augmented tool operations (2025-11-25 only)."""

    call: TasksCallCapability | None = None

TextContent

Bases: MCPModel

Text provided to or from an LLM.

Source code in src/mcp-types/mcp_types/_types.py
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
class TextContent(MCPModel):
    """Text provided to or from an LLM."""

    type: Literal["text"] = "text"
    text: str
    """The text content of the message."""
    annotations: Annotations | None = None
    """Optional annotations for the client."""
    meta: Meta | None = Field(alias="_meta", default=None)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

text instance-attribute

text: str

The text content of the message.

annotations class-attribute instance-attribute

annotations: Annotations | None = None

Optional annotations for the client.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See MCP specification for notes on _meta usage.

TextResourceContents

Bases: ResourceContents

Text contents of a resource.

Source code in src/mcp-types/mcp_types/_types.py
898
899
900
901
902
903
904
905
class TextResourceContents(ResourceContents):
    """Text contents of a resource."""

    text: str
    """
    The text of the item. This must only be set if the item can actually be represented
    as text (not binary data).
    """

text instance-attribute

text: str

The text of the item. This must only be set if the item can actually be represented as text (not binary data).

Tool

Bases: BaseMetadata

Definition for a tool the client can call.

Source code in src/mcp-types/mcp_types/_types.py
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
class Tool(BaseMetadata):
    """Definition for a tool the client can call."""

    description: str | None = None
    """A human-readable description of the tool."""
    input_schema: dict[str, Any]
    """A JSON Schema object defining the expected parameters for the tool.

    `type: "object"` is required at the root. 2026-07-28 allows any JSON Schema
    2020-12 keyword; earlier versions define only `type`/`properties`/`required`.
    """
    execution: ToolExecution | None = None
    """Execution-related properties (2025-11-25 only; removed in 2026-07-28)."""
    output_schema: dict[str, Any] | None = None
    """An optional JSON Schema object defining the structure of the tool's output
    returned in the `structured_content` field of a `CallToolResult`.

    Restricted to `type: "object"` at the root through 2025-11-25; any valid
    JSON Schema 2020-12 on 2026-07-28.
    """
    icons: list[Icon] | None = None
    """Optional set of sized icons for display (2025-11-25+)."""
    annotations: ToolAnnotations | None = None
    """Optional additional tool information.
    Display-name precedence: `title`, `annotations.title`, then `name`."""
    meta: Meta | None = Field(alias="_meta", default=None)
    """See the MCP specification for notes on `_meta` usage."""

description class-attribute instance-attribute

description: str | None = None

A human-readable description of the tool.

input_schema instance-attribute

input_schema: dict[str, Any]

A JSON Schema object defining the expected parameters for the tool.

type: "object" is required at the root. 2026-07-28 allows any JSON Schema 2020-12 keyword; earlier versions define only type/properties/required.

execution class-attribute instance-attribute

execution: ToolExecution | None = None

Execution-related properties (2025-11-25 only; removed in 2026-07-28).

output_schema class-attribute instance-attribute

output_schema: dict[str, Any] | None = None

An optional JSON Schema object defining the structure of the tool's output returned in the structured_content field of a CallToolResult.

Restricted to type: "object" at the root through 2025-11-25; any valid JSON Schema 2020-12 on 2026-07-28.

icons class-attribute instance-attribute

icons: list[Icon] | None = None

Optional set of sized icons for display (2025-11-25+).

annotations class-attribute instance-attribute

annotations: ToolAnnotations | None = None

Optional additional tool information. Display-name precedence: title, annotations.title, then name.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

See the MCP specification for notes on _meta usage.

ToolAnnotations

Bases: MCPModel

Additional properties describing a Tool to clients.

NOTE: all properties in ToolAnnotations are hints. They are not guaranteed to provide a faithful description of tool behavior (including descriptive properties like title).

Clients should never make tool use decisions based on ToolAnnotations received from untrusted servers.

Source code in src/mcp-types/mcp_types/_types.py
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
class ToolAnnotations(MCPModel):
    """Additional properties describing a Tool to clients.

    NOTE: all properties in ToolAnnotations are **hints**.
    They are not guaranteed to provide a faithful description of
    tool behavior (including descriptive properties like `title`).

    Clients should never make tool use decisions based on ToolAnnotations
    received from untrusted servers.
    """

    title: str | None = None
    """A human-readable title for the tool."""

    read_only_hint: bool | None = None
    """
    If true, the tool does not modify its environment.
    Default: false
    """

    destructive_hint: bool | None = None
    """
    If true, the tool may perform destructive updates to its environment.
    If false, the tool performs only additive updates.
    (This property is meaningful only when `read_only_hint == false`)
    Default: true
    """

    idempotent_hint: bool | None = None
    """
    If true, calling the tool repeatedly with the same arguments
    will have no additional effect on its environment.
    (This property is meaningful only when `read_only_hint == false`)
    Default: false
    """

    open_world_hint: bool | None = None
    """
    If true, this tool may interact with an "open world" of external
    entities. If false, the tool's domain of interaction is closed.
    For example, the world of a web search tool is open, whereas that
    of a memory tool is not.
    Default: true
    """

title class-attribute instance-attribute

title: str | None = None

A human-readable title for the tool.

read_only_hint class-attribute instance-attribute

read_only_hint: bool | None = None

If true, the tool does not modify its environment. Default: false

destructive_hint class-attribute instance-attribute

destructive_hint: bool | None = None

If true, the tool may perform destructive updates to its environment. If false, the tool performs only additive updates. (This property is meaningful only when read_only_hint == false) Default: true

idempotent_hint class-attribute instance-attribute

idempotent_hint: bool | None = None

If true, calling the tool repeatedly with the same arguments will have no additional effect on its environment. (This property is meaningful only when read_only_hint == false) Default: false

open_world_hint class-attribute instance-attribute

open_world_hint: bool | None = None

If true, this tool may interact with an "open world" of external entities. If false, the tool's domain of interaction is closed. For example, the world of a web search tool is open, whereas that of a memory tool is not. Default: true

ToolChoice

Bases: MCPModel

Controls tool selection behavior for sampling requests (2025-11-25+).

The client MUST return an error if this is received without the sampling.tools capability. Absent means {"mode": "auto"}.

Source code in src/mcp-types/mcp_types/_types.py
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
class ToolChoice(MCPModel):
    """Controls tool selection behavior for sampling requests (2025-11-25+).

    The client MUST return an error if this is received without the
    `sampling.tools` capability. Absent means `{"mode": "auto"}`.
    """

    mode: Literal["auto", "required", "none"] | None = None
    """
    Controls the tool use ability of the model:
    - "auto": Model decides whether to use tools (default)
    - "required": Model MUST use at least one tool before completing
    - "none": Model MUST NOT use any tools
    """

mode class-attribute instance-attribute

mode: Literal['auto', 'required', 'none'] | None = None

Controls the tool use ability of the model: - "auto": Model decides whether to use tools (default) - "required": Model MUST use at least one tool before completing - "none": Model MUST NOT use any tools

ToolExecution

Bases: MCPModel

Execution-related properties for a tool (2025-11-25 only).

Source code in src/mcp-types/mcp_types/_types.py
599
600
601
602
603
class ToolExecution(MCPModel):
    """Execution-related properties for a tool (2025-11-25 only)."""

    task_support: Literal["forbidden", "optional", "required"] | None = None
    """Whether this tool supports task-augmented execution. Absent means "forbidden"."""

task_support class-attribute instance-attribute

task_support: (
    Literal["forbidden", "optional", "required"] | None
) = None

Whether this tool supports task-augmented execution. Absent means "forbidden".

ToolListChangedNotification

Bases: Notification[NotificationParams | None, Literal['notifications/tools/list_changed']]

An optional notification from the server to the client, informing it that the list of tools it offers has changed.

May be sent spontaneously through 2025-11-25; on 2026-07-28 sessions the client must opt in via subscriptions/listen.

Source code in src/mcp-types/mcp_types/_types.py
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
class ToolListChangedNotification(Notification[NotificationParams | None, Literal["notifications/tools/list_changed"]]):
    """An optional notification from the server to the client, informing it that the list
    of tools it offers has changed.

    May be sent spontaneously through 2025-11-25; on 2026-07-28 sessions the
    client must opt in via `subscriptions/listen`.
    """

    method: Literal["notifications/tools/list_changed"] = "notifications/tools/list_changed"
    params: NotificationParams | None = None

ToolResultContent

Bases: MCPModel

The result of a tool use, provided by the user back to the assistant (2025-11-25+).

Appears in sampling messages as a response to a ToolUseContent block. Requires the sampling.tools client capability. Deprecated in 2026-07-28 (SEP-2577).

Source code in src/mcp-types/mcp_types/_types.py
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
class ToolResultContent(MCPModel):
    """The result of a tool use, provided by the user back to the assistant (2025-11-25+).

    Appears in sampling messages as a response to a `ToolUseContent` block.
    Requires the `sampling.tools` client capability. Deprecated in 2026-07-28 (SEP-2577).
    """

    type: Literal["tool_result"] = "tool_result"
    """Discriminator for tool result content."""

    tool_use_id: str
    """The `id` of the `ToolUseContent` this result corresponds to."""

    content: list[ContentBlock] = []
    """The unstructured result content (same format as `CallToolResult.content`)."""

    structured_content: Any = None
    """An optional structured result value. Any JSON value on 2026-07-28;
    restricted to a JSON object on 2025-11-25."""

    is_error: bool | None = None
    """Whether the tool use resulted in an error. Absent is equivalent to false."""

    meta: Meta | None = Field(alias="_meta", default=None)
    """Optional metadata. Clients SHOULD preserve this in subsequent sampling
    requests to enable caching optimizations."""

type class-attribute instance-attribute

type: Literal['tool_result'] = 'tool_result'

Discriminator for tool result content.

tool_use_id instance-attribute

tool_use_id: str

The id of the ToolUseContent this result corresponds to.

content class-attribute instance-attribute

content: list[ContentBlock] = []

The unstructured result content (same format as CallToolResult.content).

structured_content class-attribute instance-attribute

structured_content: Any = None

An optional structured result value. Any JSON value on 2026-07-28; restricted to a JSON object on 2025-11-25.

is_error class-attribute instance-attribute

is_error: bool | None = None

Whether the tool use resulted in an error. Absent is equivalent to false.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

Optional metadata. Clients SHOULD preserve this in subsequent sampling requests to enable caching optimizations.

ToolsCapability

Bases: MCPModel

Capability for tools operations.

Source code in src/mcp-types/mcp_types/_types.py
428
429
430
431
432
class ToolsCapability(MCPModel):
    """Capability for tools operations."""

    list_changed: bool | None = None
    """Whether this server supports notifications for changes to the tool list."""

list_changed class-attribute instance-attribute

list_changed: bool | None = None

Whether this server supports notifications for changes to the tool list.

ToolUseContent

Bases: MCPModel

An assistant's request to invoke a tool during sampling (2025-11-25+).

Appears in sampling/createMessage results and replayed assistant messages. The server should execute the tool and return a ToolResultContent in the next user message. Deprecated in 2026-07-28 (SEP-2577).

Source code in src/mcp-types/mcp_types/_types.py
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
class ToolUseContent(MCPModel):
    """An assistant's request to invoke a tool during sampling (2025-11-25+).

    Appears in `sampling/createMessage` results and replayed assistant messages.
    The server should execute the tool and return a `ToolResultContent` in the
    next user message. Deprecated in 2026-07-28 (SEP-2577).
    """

    type: Literal["tool_use"] = "tool_use"
    """Discriminator for tool use content."""

    name: str
    """The name of the tool to invoke. Must match a tool name from the request's tools array."""

    id: str
    """Unique identifier for this tool call, used to correlate with ToolResultContent."""

    input: dict[str, Any]
    """Arguments to pass to the tool. Must conform to the tool's inputSchema."""

    meta: Meta | None = Field(alias="_meta", default=None)
    """Optional metadata. Clients SHOULD preserve this in subsequent sampling
    requests to enable caching optimizations."""

type class-attribute instance-attribute

type: Literal['tool_use'] = 'tool_use'

Discriminator for tool use content.

name instance-attribute

name: str

The name of the tool to invoke. Must match a tool name from the request's tools array.

id instance-attribute

id: str

Unique identifier for this tool call, used to correlate with ToolResultContent.

input instance-attribute

input: dict[str, Any]

Arguments to pass to the tool. Must conform to the tool's inputSchema.

meta class-attribute instance-attribute

meta: Meta | None = Field(alias='_meta', default=None)

Optional metadata. Clients SHOULD preserve this in subsequent sampling requests to enable caching optimizations.

UnsubscribeRequest

Bases: Request[UnsubscribeRequestParams, Literal['resources/unsubscribe']]

Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25. On 2026-07-28 use subscriptions/listen instead.

Source code in src/mcp-types/mcp_types/_types.py
974
975
976
977
978
979
980
981
982
983
class UnsubscribeRequest(Request[UnsubscribeRequestParams, Literal["resources/unsubscribe"]]):
    """Sent from the client to request cancellation of resources/updated notifications
    from the server. This should follow a previous resources/subscribe request.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    On 2026-07-28 use `subscriptions/listen` instead.
    """

    method: Literal["resources/unsubscribe"] = "resources/unsubscribe"
    params: UnsubscribeRequestParams

UnsubscribeRequestParams

Bases: RequestParams

Parameters for a resources/unsubscribe request.

Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.

Source code in src/mcp-types/mcp_types/_types.py
964
965
966
967
968
969
970
971
class UnsubscribeRequestParams(RequestParams):
    """Parameters for a resources/unsubscribe request.

    Removed in protocol 2026-07-28; sent/received on sessions negotiating <= 2025-11-25.
    """

    uri: str
    """The URI of the resource to unsubscribe from."""

uri instance-attribute

uri: str

The URI of the resource to unsubscribe from.

UnsupportedProtocolVersionErrorData

Bases: MCPModel

Error data for the -32022 unsupported-protocol-version error (2026-07-28).

Source code in src/mcp-types/mcp_types/_types.py
396
397
398
399
400
401
402
class UnsupportedProtocolVersionErrorData(MCPModel):
    """Error data for the -32022 unsupported-protocol-version error (2026-07-28)."""

    supported: list[str]
    """Protocol versions the server supports; the client should pick one and retry."""

    requested: str

supported instance-attribute

supported: list[str]

Protocol versions the server supports; the client should pick one and retry.

UrlElicitationCapability

Bases: MCPModel

Capability for URL mode elicitation (2025-11-25+).

Source code in src/mcp-types/mcp_types/_types.py
296
297
class UrlElicitationCapability(MCPModel):
    """Capability for URL mode elicitation (2025-11-25+)."""

CONNECTION_CLOSED module-attribute

CONNECTION_CLOSED = -32000

SDK-only: the connection closed before a response arrived; never emitted on the wire.

HEADER_MISMATCH module-attribute

HEADER_MISMATCH = -32020

HTTP headers do not match the request body, or required headers are missing/malformed (protocol 2026-07-28).

INTERNAL_ERROR module-attribute

INTERNAL_ERROR = -32603

Standard JSON-RPC: an internal error occurred on the receiver.

The SDK uses the generic ErrorData envelope; the schema's per-code wrapper types are not constructed.

INVALID_PARAMS module-attribute

INVALID_PARAMS = -32602

Standard JSON-RPC: invalid method parameters.

INVALID_REQUEST module-attribute

INVALID_REQUEST = -32600

Standard JSON-RPC: the message is not a valid request object.

JSONRPC_VERSION module-attribute

JSONRPC_VERSION: Final[Literal['2.0']] = '2.0'

The JSON-RPC version string carried by every MCP message envelope.

METHOD_NOT_FOUND module-attribute

METHOD_NOT_FOUND = -32601

Standard JSON-RPC: the requested method does not exist or is not available.

MISSING_REQUIRED_CLIENT_CAPABILITY module-attribute

MISSING_REQUIRED_CLIENT_CAPABILITY = -32021

The server requires a client capability the request did not declare (protocol 2026-07-28).

PARSE_ERROR module-attribute

PARSE_ERROR = -32700

Standard JSON-RPC: invalid JSON was received.

REQUEST_TIMEOUT module-attribute

REQUEST_TIMEOUT = -32001

SDK-only: a request timed out waiting for its response.

UNSUPPORTED_PROTOCOL_VERSION module-attribute

UNSUPPORTED_PROTOCOL_VERSION = -32022

The request's protocol version is not supported by the server (protocol 2026-07-28).

URL_ELICITATION_REQUIRED module-attribute

URL_ELICITATION_REQUIRED = -32042

A URL-mode elicitation is required before the request can be processed (protocol 2025-11-25 only).

ErrorData

Bases: BaseModel

Error information for JSON-RPC error responses.

Source code in src/mcp-types/mcp_types/jsonrpc.py
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
class ErrorData(BaseModel):
    """Error information for JSON-RPC error responses."""

    code: int
    """The error type that occurred."""

    message: str
    """A short description of the error.

    The message SHOULD be limited to a concise single sentence.
    """

    data: Any = None
    """Additional information about the error.

    The value of this member is defined by the sender (e.g. detailed error information, nested errors, etc.).
    """

code instance-attribute

code: int

The error type that occurred.

message instance-attribute

message: str

A short description of the error.

The message SHOULD be limited to a concise single sentence.

data class-attribute instance-attribute

data: Any = None

Additional information about the error.

The value of this member is defined by the sender (e.g. detailed error information, nested errors, etc.).

JSONRPCError

Bases: BaseModel

A response to a request that indicates an error occurred.

Source code in src/mcp-types/mcp_types/jsonrpc.py
109
110
111
112
113
114
115
116
117
118
119
class JSONRPCError(BaseModel):
    """A response to a request that indicates an error occurred."""

    jsonrpc: Literal["2.0"]
    id: RequestId | None
    """The id of the request this error responds to.

    Required but nullable per JSON-RPC 2.0: `None` encodes `"id": null` (the id could not be determined).
    """

    error: ErrorData

id instance-attribute

id: RequestId | None

The id of the request this error responds to.

Required but nullable per JSON-RPC 2.0: None encodes "id": null (the id could not be determined).

JSONRPCMessage module-attribute

Any JSON-RPC envelope that can be decoded off the wire or encoded to be sent.

JSONRPCNotification

Bases: BaseModel

A JSON-RPC notification which does not expect a response.

Source code in src/mcp-types/mcp_types/jsonrpc.py
25
26
27
28
29
30
class JSONRPCNotification(BaseModel):
    """A JSON-RPC notification which does not expect a response."""

    jsonrpc: Literal["2.0"]
    method: str
    params: dict[str, Any] | None = None

JSONRPCRequest

Bases: BaseModel

A JSON-RPC request that expects a response.

Source code in src/mcp-types/mcp_types/jsonrpc.py
16
17
18
19
20
21
22
class JSONRPCRequest(BaseModel):
    """A JSON-RPC request that expects a response."""

    jsonrpc: Literal["2.0"]
    id: RequestId
    method: str
    params: dict[str, Any] | None = None

JSONRPCResponse

Bases: BaseModel

A successful (non-error) response to a request.

Named JSONRPCResultResponse in the 2025-11-25+ schemas; the SDK keeps the original name.

Source code in src/mcp-types/mcp_types/jsonrpc.py
33
34
35
36
37
38
39
40
41
class JSONRPCResponse(BaseModel):
    """A successful (non-error) response to a request.

    Named `JSONRPCResultResponse` in the 2025-11-25+ schemas; the SDK keeps the original name.
    """

    jsonrpc: Literal["2.0"]
    id: RequestId
    result: dict[str, Any]

RequestId module-attribute

RequestId = Annotated[int, Field(strict=True)] | str

The ID of a JSON-RPC request.

LATEST_PROTOCOL_VERSION module-attribute

LATEST_PROTOCOL_VERSION: Final[str] = (
    KNOWN_PROTOCOL_VERSIONS[-1]
)

Newest protocol revision this SDK speaks (any era).