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/2025-11-25/schema.json

DEFAULT_NEGOTIATED_VERSION module-attribute

DEFAULT_NEGOTIATED_VERSION = '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.

LATEST_PROTOCOL_VERSION module-attribute

LATEST_PROTOCOL_VERSION = '2025-11-25'

The latest version of the Model Context Protocol.

You can find the latest specification at https://modelcontextprotocol.io/specification/latest.

AudioContent

Bases: MCPModel

Audio content for a message.

Source code in src/mcp/types/_types.py
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
class AudioContent(MCPModel):
    """Audio content for a message."""

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

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 name and optional title fields.

Source code in src/mcp/types/_types.py
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
class BaseMetadata(MCPModel):
    """Base class for entities with name and optional title fields."""

    name: str
    """The programmatic name of the entity."""

    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

The programmatic name of the entity.

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/_types.py
748
749
750
751
752
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.

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/_types.py
1191
1192
1193
1194
1195
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: RequestParams

Parameters for calling a tool.

Source code in src/mcp/types/_types.py
1184
1185
1186
1187
1188
class CallToolRequestParams(RequestParams):
    """Parameters for calling a tool."""

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

CallToolResult

Bases: Result

The server's response to a tool call.

Source code in src/mcp/types/_types.py
1198
1199
1200
1201
1202
1203
1204
class CallToolResult(Result):
    """The server's response to a tool call."""

    content: list[ContentBlock]
    structured_content: dict[str, Any] | None = None
    """An optional JSON object that represents the structured result of the tool call."""
    is_error: bool = False

structured_content class-attribute instance-attribute

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

An optional JSON object that represents the structured result of the tool call.

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.

Source code in src/mcp/types/_types.py
1564
1565
1566
1567
1568
1569
1570
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.
    """

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

CancelledNotificationParams

Bases: NotificationParams

Parameters for cancellation notifications.

Source code in src/mcp/types/_types.py
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
class CancelledNotificationParams(NotificationParams):
    """Parameters for cancellation notifications."""

    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.
    This MUST be provided for cancelling non-task requests.
    This MUST NOT be used for cancelling tasks (use the `tasks/cancel` request instead).
    """
    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. This MUST be provided for cancelling non-task requests. This MUST NOT be used for cancelling tasks (use the tasks/cancel request instead).

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.

Source code in src/mcp/types/_types.py
509
510
511
512
513
class CancelTaskRequest(Request[CancelTaskRequestParams, Literal["tasks/cancel"]]):
    """A request to cancel a task."""

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

CancelTaskRequestParams

Bases: RequestParams

Source code in src/mcp/types/_types.py
504
505
506
class CancelTaskRequestParams(RequestParams):
    task_id: str
    """The task identifier to cancel."""

task_id instance-attribute

task_id: str

The task identifier to cancel.

CancelTaskResult

Bases: Result, Task

The response to a tasks/cancel request.

Source code in src/mcp/types/_types.py
516
517
class CancelTaskResult(Result, Task):
    """The response to a tasks/cancel request."""

ClientCapabilities

Bases: MCPModel

Capabilities a client may support.

Source code in src/mcp/types/_types.py
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
class ClientCapabilities(MCPModel):
    """Capabilities a client may support."""

    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."""
    tasks: ClientTasksCapability | None = None
    """Present if the client supports task-augmented requests."""

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.

tasks class-attribute instance-attribute

tasks: ClientTasksCapability | None = None

Present if the client supports task-augmented requests.

ClientTasksCapability

Bases: MCPModel

Capability for client tasks operations.

Source code in src/mcp/types/_types.py
297
298
299
300
301
302
303
304
305
306
307
class ClientTasksCapability(MCPModel):
    """Capability for client tasks operations."""

    list: TasksListCapability | None = None
    """Whether this client supports tasks/list."""

    cancel: TasksCancelCapability | None = None
    """Whether this client supports tasks/cancel."""

    requests: ClientTasksRequestsCapability | None = None
    """Specifies which request types can be augmented with tasks."""

list class-attribute instance-attribute

list: TasksListCapability | None = None

Whether this client supports tasks/list.

cancel class-attribute instance-attribute

cancel: TasksCancelCapability | None = None

Whether this client supports tasks/cancel.

requests class-attribute instance-attribute

requests: ClientTasksRequestsCapability | None = None

Specifies which request types can be augmented with tasks.

ClientTasksRequestsCapability

Bases: MCPModel

Capability for tasks requests operations.

Source code in src/mcp/types/_types.py
289
290
291
292
293
294
class ClientTasksRequestsCapability(MCPModel):
    """Capability for tasks requests operations."""

    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/_types.py
1458
1459
1460
1461
1462
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

Parameters for completion requests.

Source code in src/mcp/types/_types.py
1449
1450
1451
1452
1453
1454
1455
class CompleteRequestParams(RequestParams):
    """Parameters for completion requests."""

    ref: ResourceTemplateReference | PromptReference
    argument: CompletionArgument
    context: CompletionContext | None = None
    """Additional, optional context for completions."""

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/_types.py
1482
1483
1484
1485
class CompleteResult(Result):
    """The server's response to a completion/complete request."""

    completion: Completion

Completion

Bases: MCPModel

Completion information.

Source code in src/mcp/types/_types.py
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
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/_types.py
1433
1434
1435
1436
1437
1438
1439
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/_types.py
1442
1443
1444
1445
1446
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/_types.py
355
356
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.

Source code in src/mcp/types/_types.py
1362
1363
1364
1365
1366
class CreateMessageRequest(Request[CreateMessageRequestParams, Literal["sampling/createMessage"]]):
    """A request from the server to sample an LLM via the client."""

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

CreateMessageRequestParams

Bases: RequestParams

Parameters for creating a message.

Source code in src/mcp/types/_types.py
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
class CreateMessageRequestParams(RequestParams):
    """Parameters for creating a message."""

    messages: list[SamplingMessage]
    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.
    """
    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."""
    tools: list[Tool] | None = None
    """
    Tool definitions for the LLM to use during sampling.
    Requires clientCapabilities.sampling.tools to be present.
    """
    tool_choice: ToolChoice | None = None
    """
    Controls tool usage behavior.
    Requires clientCapabilities.sampling.tools and the tools parameter to be present.
    """

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.

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.

tools class-attribute instance-attribute

tools: list[Tool] | None = None

Tool definitions for the LLM to use during sampling. Requires clientCapabilities.sampling.tools to be present.

tool_choice class-attribute instance-attribute

tool_choice: ToolChoice | None = None

Controls tool usage behavior. Requires clientCapabilities.sampling.tools and the tools parameter to be present.

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.

Source code in src/mcp/types/_types.py
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
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.
    """

    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.

Source code in src/mcp/types/_types.py
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
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.
    """

    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.

Source code in src/mcp/types/_types.py
459
460
461
462
class CreateTaskResult(Result):
    """A response to a task-augmented request."""

    task: Task

ElicitationCapability

Bases: MCPModel

Capability for elicitation operations.

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

Source code in src/mcp/types/_types.py
233
234
235
236
237
238
239
240
241
242
243
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."""

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.

ElicitationRequiredErrorData

Bases: MCPModel

Error data for URLElicitationRequiredError.

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

Source code in src/mcp/types/_types.py
1708
1709
1710
1711
1712
1713
1714
1715
1716
class ElicitationRequiredErrorData(MCPModel):
    """Error data for URLElicitationRequiredError.

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

    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.

Source code in src/mcp/types/_types.py
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
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.
    """

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

ElicitCompleteNotificationParams

Bases: NotificationParams

Parameters for elicitation completion notifications.

Source code in src/mcp/types/_types.py
1573
1574
1575
1576
1577
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 information from the client.

Source code in src/mcp/types/_types.py
1681
1682
1683
1684
1685
class ElicitRequest(Request[ElicitRequestParams, Literal["elicitation/create"]]):
    """A request from the server to elicit information from the client."""

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

ElicitRequestedSchema module-attribute

ElicitRequestedSchema: TypeAlias = dict[str, Any]

Schema for elicitation requests.

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/_types.py
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
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.
    """

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.

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.

Source code in src/mcp/types/_types.py
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
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.
    """

    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
    """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.
    """

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 instance-attribute

elicitation_id: str

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.

ElicitResult

Bases: Result

The client's response to an elicitation request.

Source code in src/mcp/types/_types.py
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
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/_types.py
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
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
    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.

EmptyResult

Bases: Result

A response that indicates success but carries no data.

Source code in src/mcp/types/_types.py
141
142
class EmptyResult(Result):
    """A response that indicates success but carries no data."""

FormElicitationCapability

Bases: MCPModel

Capability for form mode elicitation.

Source code in src/mcp/types/_types.py
225
226
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/_types.py
876
877
878
879
880
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: RequestParams

Parameters for getting a prompt.

Source code in src/mcp/types/_types.py
867
868
869
870
871
872
873
class GetPromptRequestParams(RequestParams):
    """Parameters for getting a prompt."""

    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/_types.py
1065
1066
1067
1068
1069
1070
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]

description class-attribute instance-attribute

description: str | None = None

An optional description for the prompt.

GetTaskPayloadRequest

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

A request to retrieve the result of a completed task.

Source code in src/mcp/types/_types.py
487
488
489
490
491
class GetTaskPayloadRequest(Request[GetTaskPayloadRequestParams, Literal["tasks/result"]]):
    """A request to retrieve the result of a completed task."""

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

GetTaskPayloadRequestParams

Bases: RequestParams

Source code in src/mcp/types/_types.py
482
483
484
class GetTaskPayloadRequestParams(RequestParams):
    task_id: str
    """The task identifier to retrieve results for."""

task_id instance-attribute

task_id: str

The task identifier to retrieve results for.

GetTaskPayloadResult

Bases: Result

The response to a tasks/result request.

The structure matches the result type of the original request. For example, a tools/call task would return the CallToolResult structure.

Source code in src/mcp/types/_types.py
494
495
496
497
498
499
500
501
class GetTaskPayloadResult(Result):
    """The response to a tasks/result request.

    The structure matches the result type of the original request.
    For example, a tools/call task would return the CallToolResult structure.
    """

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

GetTaskRequest

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

A request to retrieve the state of a task.

Source code in src/mcp/types/_types.py
470
471
472
473
474
475
class GetTaskRequest(Request[GetTaskRequestParams, Literal["tasks/get"]]):
    """A request to retrieve the state of a task."""

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

    params: GetTaskRequestParams

GetTaskRequestParams

Bases: RequestParams

Source code in src/mcp/types/_types.py
465
466
467
class GetTaskRequestParams(RequestParams):
    task_id: str
    """The task identifier to query."""

task_id instance-attribute

task_id: str

The task identifier to query.

GetTaskResult

Bases: Result, Task

The response to a tasks/get request.

Source code in src/mcp/types/_types.py
478
479
class GetTaskResult(Result, Task):
    """The response to a tasks/get request."""

Icon

Bases: MCPModel

An icon for display in user interfaces.

Source code in src/mcp/types/_types.py
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
class Icon(MCPModel):
    """An icon for display in user interfaces."""

    src: str
    """URL or data URI for the icon."""

    mime_type: str | None = None
    """Optional MIME type for the icon."""

    sizes: list[str] | None = None
    """Optional list of strings specifying icon dimensions (e.g., ["48x48", "96x96"])."""

    theme: IconTheme | None = None
    """Optional theme specifier.

    `"light"` indicates the icon is designed for a light background, `"dark"` indicates the icon
    is designed for a dark background.

    See https://modelcontextprotocol.io/specification/2025-11-25/schema#icon for more details.
    """

src instance-attribute

src: str

URL or data URI for the icon.

mime_type class-attribute instance-attribute

mime_type: str | None = None

Optional MIME type for the icon.

sizes class-attribute instance-attribute

sizes: list[str] | None = None

Optional list of strings specifying icon dimensions (e.g., ["48x48", "96x96"]).

theme class-attribute instance-attribute

theme: IconTheme | None = None

Optional theme specifier.

"light" indicates the icon is designed for a light background, "dark" indicates the icon is designed for a dark background.

See https://modelcontextprotocol.io/specification/2025-11-25/schema#icon for more details.

ImageContent

Bases: MCPModel

Image content for a message.

Source code in src/mcp/types/_types.py
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
class ImageContent(MCPModel):
    """Image content for a message."""

    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
    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 image data.

mime_type instance-attribute

mime_type: str

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

meta class-attribute instance-attribute

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

See MCP specification for notes on _meta usage.

Implementation

Bases: BaseMetadata

Describes the name and version of an MCP implementation.

Source code in src/mcp/types/_types.py
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
class Implementation(BaseMetadata):
    """Describes the name and version of an MCP implementation."""

    version: str

    title: str | None = None
    """An optional human-readable title for this implementation."""

    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
    """An optional list of icons for this implementation."""

title class-attribute instance-attribute

title: str | None = None

An optional human-readable title for this implementation.

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

An optional list of icons for this implementation.

InitializedNotification

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

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

Source code in src/mcp/types/_types.py
574
575
576
577
578
579
580
class InitializedNotification(Notification[NotificationParams | None, Literal["notifications/initialized"]]):
    """This notification is sent from the client to the server after initialization has
    finished.
    """

    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.

Source code in src/mcp/types/_types.py
554
555
556
557
558
559
560
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.
    """

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

InitializeRequestParams

Bases: RequestParams

Parameters for the initialize request.

Source code in src/mcp/types/_types.py
545
546
547
548
549
550
551
class InitializeRequestParams(RequestParams):
    """Parameters for the initialize request."""

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

protocol_version instance-attribute

protocol_version: str | int

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.

Source code in src/mcp/types/_types.py
563
564
565
566
567
568
569
570
571
class InitializeResult(Result):
    """After receiving an initialize request from the client, the server sends this."""

    protocol_version: str | int
    """The version of the Model Context Protocol that the server wants to use."""
    capabilities: ServerCapabilities
    server_info: Implementation
    instructions: str | None = None
    """Instructions describing how to use the server and its features."""

protocol_version instance-attribute

protocol_version: str | int

The version of the Model Context Protocol that the server wants to use.

instructions class-attribute instance-attribute

instructions: str | None = None

Instructions describing how to use the server and its features.

ListPromptsRequest

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

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

Source code in src/mcp/types/_types.py
828
829
830
831
class ListPromptsRequest(PaginatedRequest[Literal["prompts/list"]]):
    """Sent from the client to request a list of prompts and prompt templates."""

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

ListPromptsResult

Bases: PaginatedResult

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

Source code in src/mcp/types/_types.py
861
862
863
864
class ListPromptsResult(PaginatedResult):
    """The server's response to a prompts/list request from the client."""

    prompts: list[Prompt]

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/_types.py
621
622
623
624
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

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

Source code in src/mcp/types/_types.py
689
690
691
692
class ListResourcesResult(PaginatedResult):
    """The server's response to a resources/list request from the client."""

    resources: list[Resource]

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/_types.py
695
696
697
698
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

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

Source code in src/mcp/types/_types.py
701
702
703
704
class ListResourceTemplatesResult(PaginatedResult):
    """The server's response to a resources/templates/list request from the client."""

    resource_templates: list[ResourceTemplate]

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.

Source code in src/mcp/types/_types.py
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
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.
    """

    method: Literal["roots/list"] = "roots/list"
    params: RequestParams | None = None

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.

Source code in src/mcp/types/_types.py
1524
1525
1526
1527
1528
1529
1530
1531
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.
    """

    roots: list[Root]

ListTasksRequest

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

A request to retrieve a list of tasks.

Source code in src/mcp/types/_types.py
520
521
522
523
class ListTasksRequest(PaginatedRequest[Literal["tasks/list"]]):
    """A request to retrieve a list of tasks."""

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

ListTasksResult

Bases: PaginatedResult

The response to a tasks/list request.

Source code in src/mcp/types/_types.py
526
527
528
529
class ListTasksResult(PaginatedResult):
    """The response to a tasks/list request."""

    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/_types.py
1084
1085
1086
1087
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

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

Source code in src/mcp/types/_types.py
1178
1179
1180
1181
class ListToolsResult(PaginatedResult):
    """The server's response to a tools/list request from the client."""

    tools: list[Tool]

LoggingCapability

Bases: MCPModel

Capability for logging operations.

Source code in src/mcp/types/_types.py
351
352
class LoggingCapability(MCPModel):
    """Capability for logging operations."""

LoggingMessageNotification

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

Notification of a log message passed from server to client.

Source code in src/mcp/types/_types.py
1247
1248
1249
1250
1251
class LoggingMessageNotification(Notification[LoggingMessageNotificationParams, Literal["notifications/message"]]):
    """Notification of a log message passed from server to client."""

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

LoggingMessageNotificationParams

Bases: NotificationParams

Parameters for logging message notifications.

Source code in src/mcp/types/_types.py
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
class LoggingMessageNotificationParams(NotificationParams):
    """Parameters for logging message notifications."""

    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.

ModelHint

Bases: MCPModel

Hints to use for model selection.

Source code in src/mcp/types/_types.py
1257
1258
1259
1260
1261
class ModelHint(MCPModel):
    """Hints to use for model selection."""

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

name class-attribute instance-attribute

name: str | None = None

A hint for a model name.

ModelPreferences

Bases: MCPModel

The server's preferences for model selection, requested by 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.

Source code in src/mcp/types/_types.py
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
class ModelPreferences(MCPModel):
    """The server's preferences for model selection, requested by 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.
    """

    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/_types.py
116
117
118
119
120
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/_types.py
90
91
92
93
94
95
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/_types.py
110
111
112
113
class PaginatedRequest(Request[PaginatedRequestParams | None, MethodT], Generic[MethodT]):
    """Base class for paginated requests, matching the schema's PaginatedRequest interface."""

    params: PaginatedRequestParams | None = None

PaginatedRequestParams

Bases: RequestParams

Source code in src/mcp/types/_types.py
82
83
84
85
86
87
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/_types.py
133
134
135
136
137
138
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.

Source code in src/mcp/types/_types.py
583
584
585
586
587
588
589
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.
    """

    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/_types.py
614
615
616
617
618
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/_types.py
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
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.

Prompt

Bases: BaseMetadata

A prompt or prompt template that the server offers.

Source code in src/mcp/types/_types.py
845
846
847
848
849
850
851
852
853
854
855
856
857
858
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: MCPModel

An argument for a prompt template.

Source code in src/mcp/types/_types.py
834
835
836
837
838
839
840
841
842
class PromptArgument(MCPModel):
    """An argument for a prompt template."""

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

name instance-attribute

name: str

The name of the argument.

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.

Source code in src/mcp/types/_types.py
1073
1074
1075
1076
1077
1078
1079
1080
1081
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.
    """

    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.

Source code in src/mcp/types/_types.py
1058
1059
1060
1061
1062
class PromptMessage(MCPModel):
    """Describes a message returned as part of a prompt."""

    role: Role
    content: ContentBlock

PromptReference

Bases: MCPModel

Identifies a prompt.

Source code in src/mcp/types/_types.py
1425
1426
1427
1428
1429
1430
class PromptReference(MCPModel):
    """Identifies a prompt."""

    type: Literal["ref/prompt"] = "ref/prompt"
    name: str
    """The name of the prompt or prompt template."""

name instance-attribute

name: str

The name of the prompt or prompt template.

PromptsCapability

Bases: MCPModel

Capability for prompts operations.

Source code in src/mcp/types/_types.py
328
329
330
331
332
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/_types.py
717
718
719
720
721
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: RequestParams

Parameters for reading a resource.

Source code in src/mcp/types/_types.py
707
708
709
710
711
712
713
714
class ReadResourceRequestParams(RequestParams):
    """Parameters for reading a resource."""

    uri: str
    """
    The URI of the resource to read. 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 read. The URI can use any protocol; it is up to the server how to interpret it.

ReadResourceResult

Bases: Result

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

Source code in src/mcp/types/_types.py
755
756
757
758
class ReadResourceResult(Result):
    """The server's response to a resources/read request from the client."""

    contents: list[TextResourceContents | BlobResourceContents]

RelatedTaskMetadata

Bases: MCPModel

Metadata for associating messages with a task.

Include this in the _meta field under the key io.modelcontextprotocol/related-task.

Source code in src/mcp/types/_types.py
418
419
420
421
422
423
424
425
class RelatedTaskMetadata(MCPModel):
    """Metadata for associating messages with a task.

    Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`.
    """

    task_id: str
    """The task identifier this message is associated with."""

task_id instance-attribute

task_id: str

The task identifier this message is associated with.

Request

Bases: MCPModel, Generic[RequestParamsT, MethodT]

Base class for JSON-RPC requests.

Source code in src/mcp/types/_types.py
103
104
105
106
107
class Request(MCPModel, Generic[RequestParamsT, MethodT]):
    """Base class for JSON-RPC requests."""

    method: MethodT
    params: RequestParamsT

RequestParams

Bases: MCPModel

Source code in src/mcp/types/_types.py
68
69
70
71
72
73
74
75
76
77
78
79
class RequestParams(MCPModel):
    task: TaskMetadata | None = None
    """
    If specified, the caller is requesting task-augmented execution for this request.
    The request will return a CreateTaskResult immediately, and the actual result can be
    retrieved later via tasks/result.

    Task augmentation is subject to capability negotiation - receivers MUST declare support
    for task augmentation of specific request types in their capabilities.
    """

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

task class-attribute instance-attribute

task: TaskMetadata | None = None

If specified, the caller is requesting task-augmented execution for this request. The request will return a CreateTaskResult immediately, and the actual result can be retrieved later via tasks/result.

Task augmentation is subject to capability negotiation - receivers MUST declare support for task augmentation of specific request types in their capabilities.

RequestParamsMeta

Bases: TypedDict

Source code in src/mcp/types/_types.py
48
49
50
51
52
53
54
55
class RequestParamsMeta(TypedDict, extra_items=Any):
    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/_types.py
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
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
    """An optional list of icons for this resource."""

    annotations: Annotations | None = None

    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.

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

An optional list of icons for this resource.

meta class-attribute instance-attribute

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

See 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/_types.py
724
725
726
727
728
729
730
731
732
733
734
735
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/_types.py
1045
1046
1047
1048
1049
1050
1051
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.

Source code in src/mcp/types/_types.py
761
762
763
764
765
766
767
768
769
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.
    """

    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/_types.py
335
336
337
338
339
340
341
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/_types.py
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
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 human-readable 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 list of icons for this resource template."""

    annotations: Annotations | None = None

    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 human-readable 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 list of icons for this resource template.

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/_types.py
1417
1418
1419
1420
1421
1422
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.

Source code in src/mcp/types/_types.py
817
818
819
820
821
822
823
824
825
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.
    """

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

ResourceUpdatedNotificationParams

Bases: NotificationParams

Parameters for resource update notifications.

Source code in src/mcp/types/_types.py
807
808
809
810
811
812
813
814
class ResourceUpdatedNotificationParams(NotificationParams):
    """Parameters for resource update notifications."""

    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.

Source code in src/mcp/types/_types.py
123
124
125
126
127
128
129
130
class Result(MCPModel):
    """Base class for JSON-RPC results."""

    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.

Root

Bases: MCPModel

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

Source code in src/mcp/types/_types.py
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
class Root(MCPModel):
    """Represents a root directory or file that the server can operate on."""

    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.

Source code in src/mcp/types/_types.py
202
203
204
205
206
class RootsCapability(MCPModel):
    """Capability for root operations."""

    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.

Source code in src/mcp/types/_types.py
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
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.
    """

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

SamplingCapability

Bases: MCPModel

Sampling capability structure, allowing fine-grained capability advertisement.

Source code in src/mcp/types/_types.py
246
247
248
249
250
251
252
253
254
255
256
257
258
class SamplingCapability(MCPModel):
    """Sampling capability structure, allowing fine-grained capability advertisement."""

    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/_types.py
209
210
211
212
213
214
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/_types.py
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
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.

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/_types.py
217
218
219
220
221
222
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.

Source code in src/mcp/types/_types.py
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
class ServerCapabilities(MCPModel):
    """Capabilities that a server may support."""

    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."""

    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."""

    tasks: ServerTasksCapability | None = None
    """Present if the server supports task-augmented requests."""

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.

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.

tasks class-attribute instance-attribute

tasks: ServerTasksCapability | None = None

Present if the server supports task-augmented requests.

ServerTasksCapability

Bases: MCPModel

Capability for server tasks operations.

Source code in src/mcp/types/_types.py
375
376
377
378
379
380
class ServerTasksCapability(MCPModel):
    """Capability for server tasks operations."""

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

ServerTasksRequestsCapability

Bases: MCPModel

Capability for tasks requests operations.

Source code in src/mcp/types/_types.py
369
370
371
372
class ServerTasksRequestsCapability(MCPModel):
    """Capability for tasks requests operations."""

    tools: TasksToolsCapability | None = None

SetLevelRequest

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

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

Source code in src/mcp/types/_types.py
1226
1227
1228
1229
1230
class SetLevelRequest(Request[SetLevelRequestParams, Literal["logging/setLevel"]]):
    """A request from the client to the server, to enable or adjust logging."""

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

SetLevelRequestParams

Bases: RequestParams

Parameters for setting the logging level.

Source code in src/mcp/types/_types.py
1219
1220
1221
1222
1223
class SetLevelRequestParams(RequestParams):
    """Parameters for setting the logging level."""

    level: LoggingLevel
    """The level of logging that the client wants to receive from the server."""

level instance-attribute

level: LoggingLevel

The level of logging that the client wants to receive from the server.

SubscribeRequest

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

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

Source code in src/mcp/types/_types.py
782
783
784
785
786
787
788
class SubscribeRequest(Request[SubscribeRequestParams, Literal["resources/subscribe"]]):
    """Sent from the client to request resources/updated notifications from the server
    whenever a particular resource changes.
    """

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

SubscribeRequestParams

Bases: RequestParams

Parameters for subscribing to a resource.

Source code in src/mcp/types/_types.py
772
773
774
775
776
777
778
779
class SubscribeRequestParams(RequestParams):
    """Parameters for subscribing to a resource."""

    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.

Task

Bases: MCPModel

Data associated with a task.

Source code in src/mcp/types/_types.py
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
class Task(MCPModel):
    """Data associated with a task."""

    task_id: str
    """The task identifier."""

    status: TaskStatus
    """Current task state."""

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

    This can provide context for any status, including:
    - Reasons for "cancelled" status
    - Summaries for "completed" status
    - Diagnostic information for "failed" status (e.g., error details, what went wrong)
    """

    created_at: datetime  # Pydantic will enforce ISO 8601 and re-serialize as a string later
    """ISO 8601 timestamp when the task was created."""

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

    ttl: Annotated[int, Field(strict=True)] | None
    """Actual retention duration from creation in milliseconds, null for unlimited."""

    poll_interval: Annotated[int, Field(strict=True)] | None = None
    """Suggested polling interval in milliseconds."""

task_id instance-attribute

task_id: str

The task identifier.

status instance-attribute

status: TaskStatus

Current task state.

status_message class-attribute instance-attribute

status_message: str | None = None

Optional human-readable message describing the current task state.

This can provide context for any status, including: - Reasons for "cancelled" status - Summaries for "completed" status - Diagnostic information for "failed" status (e.g., error details, what went wrong)

created_at instance-attribute

created_at: datetime

ISO 8601 timestamp when the task was created.

last_updated_at instance-attribute

last_updated_at: datetime

ISO 8601 timestamp when the task was last updated.

ttl instance-attribute

ttl: Annotated[int, Field(strict=True)] | None

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

poll_interval class-attribute instance-attribute

poll_interval: Annotated[int, Field(strict=True)] | None = (
    None
)

Suggested polling interval in milliseconds.

TaskMetadata

Bases: MCPModel

Metadata for augmenting a request with task execution.

Include this in the task field of the request parameters.

Source code in src/mcp/types/_types.py
58
59
60
61
62
63
64
65
class TaskMetadata(MCPModel):
    """Metadata for augmenting a request with task execution.

    Include this in the `task` field of the request parameters.
    """

    ttl: Annotated[int, Field(strict=True)] | None = None
    """Requested duration in milliseconds to retain task from creation."""

ttl class-attribute instance-attribute

ttl: Annotated[int, Field(strict=True)] | None = None

Requested duration in milliseconds to retain task from creation.

TasksCallCapability

Bases: MCPModel

Capability for tasks call operations.

Source code in src/mcp/types/_types.py
359
360
class TasksCallCapability(MCPModel):
    """Capability for tasks call operations."""

TasksCancelCapability

Bases: MCPModel

Capability for tasks cancel operations.

Source code in src/mcp/types/_types.py
265
266
class TasksCancelCapability(MCPModel):
    """Capability for tasks cancel operations."""

TasksCreateElicitationCapability

Bases: MCPModel

Capability for tasks create elicitation operations.

Source code in src/mcp/types/_types.py
279
280
class TasksCreateElicitationCapability(MCPModel):
    """Capability for tasks create elicitation operations."""

TasksCreateMessageCapability

Bases: MCPModel

Capability for tasks create messages.

Source code in src/mcp/types/_types.py
269
270
class TasksCreateMessageCapability(MCPModel):
    """Capability for tasks create messages."""

TasksElicitationCapability

Bases: MCPModel

Capability for tasks elicitation operations.

Source code in src/mcp/types/_types.py
283
284
285
286
class TasksElicitationCapability(MCPModel):
    """Capability for tasks elicitation operations."""

    create: TasksCreateElicitationCapability | None = None

TasksListCapability

Bases: MCPModel

Capability for tasks listing operations.

Source code in src/mcp/types/_types.py
261
262
class TasksListCapability(MCPModel):
    """Capability for tasks listing operations."""

TasksSamplingCapability

Bases: MCPModel

Capability for tasks sampling operations.

Source code in src/mcp/types/_types.py
273
274
275
276
class TasksSamplingCapability(MCPModel):
    """Capability for tasks sampling operations."""

    create_message: TasksCreateMessageCapability | None = None

TaskStatusNotification

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

An optional notification from the receiver to the requestor, informing them that a task's status has changed. Receivers are not required to send these notifications.

Source code in src/mcp/types/_types.py
536
537
538
539
540
541
542
class TaskStatusNotification(Notification[TaskStatusNotificationParams, Literal["notifications/tasks/status"]]):
    """An optional notification from the receiver to the requestor, informing them that a task's status has changed.
    Receivers are not required to send these notifications.
    """

    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/_types.py
532
533
class TaskStatusNotificationParams(NotificationParams, Task):
    """Parameters for a `notifications/tasks/status` notification."""

TasksToolsCapability

Bases: MCPModel

Capability for tasks tools operations.

Source code in src/mcp/types/_types.py
363
364
365
366
class TasksToolsCapability(MCPModel):
    """Capability for tasks tools operations."""

    call: TasksCallCapability | None = None

TextContent

Bases: MCPModel

Text content for a message.

Source code in src/mcp/types/_types.py
883
884
885
886
887
888
889
890
891
892
893
894
class TextContent(MCPModel):
    """Text content for a message."""

    type: Literal["text"] = "text"
    text: str
    """The text content of the message."""
    annotations: Annotations | None = None
    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.

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/_types.py
738
739
740
741
742
743
744
745
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/_types.py
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
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."""
    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.
    """
    icons: list[Icon] | None = None
    """An optional list of icons for this tool."""
    annotations: ToolAnnotations | None = None
    """Optional additional tool information."""
    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.
    """

    execution: ToolExecution | None = None

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.

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.

icons class-attribute instance-attribute

icons: list[Icon] | None = None

An optional list of icons for this tool.

annotations class-attribute instance-attribute

annotations: ToolAnnotations | None = None

Optional additional tool information.

meta class-attribute instance-attribute

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

See 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/_types.py
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
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 usage behavior during sampling.

Allows the server to specify whether and how the LLM should use tools in its response.

Source code in src/mcp/types/_types.py
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
class ToolChoice(MCPModel):
    """Controls tool usage behavior during sampling.

    Allows the server to specify whether and how the LLM should use tools
    in its response.
    """

    mode: Literal["auto", "required", "none"] | None = None
    """
    Controls when tools are used:
    - "auto": Model decides whether to use tools (default)
    - "required": Model MUST use at least one tool before completing
    - "none": Model should not use tools
    """

mode class-attribute instance-attribute

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

Controls when tools are used: - "auto": Model decides whether to use tools (default) - "required": Model MUST use at least one tool before completing - "none": Model should not use tools

ToolExecution

Bases: MCPModel

Execution-related properties for a tool.

Source code in src/mcp/types/_types.py
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
class ToolExecution(MCPModel):
    """Execution-related properties for a tool."""

    task_support: TaskExecutionMode | None = None
    """
    Indicates whether this tool supports task-augmented execution.
    This allows clients to handle long-running operations through polling
    the task system.

    - "forbidden": Tool does not support task-augmented execution (default when absent)
    - "optional": Tool may support task-augmented execution
    - "required": Tool requires task-augmented execution

    Default: "forbidden"
    """

task_support class-attribute instance-attribute

task_support: TaskExecutionMode | None = None

Indicates whether this tool supports task-augmented execution. This allows clients to handle long-running operations through polling the task system.

  • "forbidden": Tool does not support task-augmented execution (default when absent)
  • "optional": Tool may support task-augmented execution
  • "required": Tool requires task-augmented execution

Default: "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.

Source code in src/mcp/types/_types.py
1207
1208
1209
1210
1211
1212
1213
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.
    """

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

ToolResultContent

Bases: MCPModel

Content representing the result of a tool execution.

This content type appears in user messages as a response to a ToolUseContent from the assistant. It contains the output of executing the requested tool.

Source code in src/mcp/types/_types.py
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
class ToolResultContent(MCPModel):
    """Content representing the result of a tool execution.

    This content type appears in user messages as a response to a ToolUseContent
    from the assistant. It contains the output of executing the requested tool.
    """

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

    tool_use_id: str
    """The unique identifier that corresponds to the tool call's id field."""

    content: list[ContentBlock] = []
    """
    A list of content objects representing the tool result.
    Defaults to empty list if not provided.
    """

    structured_content: dict[str, Any] | None = None
    """
    Optional structured tool output that matches the tool's outputSchema (if defined).
    """

    is_error: bool | None = None
    """Whether the tool execution resulted in an error."""

    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.
    """

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 unique identifier that corresponds to the tool call's id field.

content class-attribute instance-attribute

content: list[ContentBlock] = []

A list of content objects representing the tool result. Defaults to empty list if not provided.

structured_content class-attribute instance-attribute

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

Optional structured tool output that matches the tool's outputSchema (if defined).

is_error class-attribute instance-attribute

is_error: bool | None = None

Whether the tool execution resulted in an error.

meta class-attribute instance-attribute

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

See MCP specification for notes on _meta usage.

ToolsCapability

Bases: MCPModel

Capability for tools operations.

Source code in src/mcp/types/_types.py
344
345
346
347
348
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

Content representing an assistant's request to invoke a tool.

This content type appears in assistant messages when the LLM wants to call a tool during sampling. The server should execute the tool and return a ToolResultContent in the next user message.

Source code in src/mcp/types/_types.py
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
class ToolUseContent(MCPModel):
    """Content representing an assistant's request to invoke a tool.

    This content type appears in assistant messages when the LLM wants to call a tool
    during sampling. The server should execute the tool and return a ToolResultContent
    in the next user message.
    """

    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)
    """
    See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
    for notes on _meta usage.
    """

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)

See MCP specification for notes on _meta usage.

UnsubscribeRequest

Bases: Request[UnsubscribeRequestParams, Literal['resources/unsubscribe']]

Sent from the client to request cancellation of resources/updated notifications from the server.

Source code in src/mcp/types/_types.py
798
799
800
801
802
803
804
class UnsubscribeRequest(Request[UnsubscribeRequestParams, Literal["resources/unsubscribe"]]):
    """Sent from the client to request cancellation of resources/updated notifications from
    the server.
    """

    method: Literal["resources/unsubscribe"] = "resources/unsubscribe"
    params: UnsubscribeRequestParams

UnsubscribeRequestParams

Bases: RequestParams

Parameters for unsubscribing from a resource.

Source code in src/mcp/types/_types.py
791
792
793
794
795
class UnsubscribeRequestParams(RequestParams):
    """Parameters for unsubscribing from a resource."""

    uri: str
    """The URI of the resource to unsubscribe from."""

uri instance-attribute

uri: str

The URI of the resource to unsubscribe from.

UrlElicitationCapability

Bases: MCPModel

Capability for URL mode elicitation.

Source code in src/mcp/types/_types.py
229
230
class UrlElicitationCapability(MCPModel):
    """Capability for URL mode elicitation."""

URL_ELICITATION_REQUIRED module-attribute

URL_ELICITATION_REQUIRED = -32042

Error code indicating that a URL mode elicitation is required before the request can be processed.

ErrorData

Bases: BaseModel

Error information for JSON-RPC error responses.

Source code in src/mcp/types/jsonrpc.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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/jsonrpc.py
74
75
76
77
78
79
class JSONRPCError(BaseModel):
    """A response to a request that indicates an error occurred."""

    jsonrpc: Literal["2.0"]
    id: RequestId | None
    error: ErrorData

JSONRPCNotification

Bases: BaseModel

A JSON-RPC notification which does not expect a response.

Source code in src/mcp/types/jsonrpc.py
22
23
24
25
26
27
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/jsonrpc.py
13
14
15
16
17
18
19
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.

Source code in src/mcp/types/jsonrpc.py
31
32
33
34
35
36
class JSONRPCResponse(BaseModel):
    """A successful (non-error) response to a request."""

    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.