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 | |
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 | |
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 | |
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 | |
CallToolRequestParams
Bases: RequestParams
Parameters for calling a tool.
Source code in src/mcp/types/_types.py
1184 1185 1186 1187 1188 | |
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 | |
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 | |
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 | |
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 | |
CancelTaskRequestParams
Bases: RequestParams
Source code in src/mcp/types/_types.py
504 505 506 | |
CancelTaskResult
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 | |
experimental
class-attribute
instance-attribute
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 | |
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 | |
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 | |
CompleteRequestParams
Bases: RequestParams
Parameters for completion requests.
Source code in src/mcp/types/_types.py
1449 1450 1451 1452 1453 1454 1455 | |
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 | |
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 | |
values
instance-attribute
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 | |
CompletionContext
Bases: MCPModel
Additional, optional context for completions.
Source code in src/mcp/types/_types.py
1442 1443 1444 1445 1446 | |
CompletionsCapability
Bases: MCPModel
Capability for completions operations.
Source code in src/mcp/types/_types.py
355 356 | |
ContentBlock
module-attribute
ContentBlock = (
TextContent
| ImageContent
| AudioContent
| ResourceLink
| EmbeddedResource
)
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 | |
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 | |
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
Optional metadata to pass through to the LLM provider.
tools
class-attribute
instance-attribute
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 | |
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).
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 | |
role
instance-attribute
role: Role
The role of the message sender (typically 'assistant' for LLM responses).
content
instance-attribute
content: (
SamplingMessageContentBlock
| list[SamplingMessageContentBlock]
)
Response content. May be a single content block or an array. May include ToolUseContent if stop_reason is 'toolUse'.
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
content_as_list: list[SamplingMessageContentBlock]
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 | |
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 | |
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 | |
elicitations
instance-attribute
elicitations: list[ElicitRequestURLParams]
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 | |
ElicitCompleteNotificationParams
Bases: NotificationParams
Parameters for elicitation completion notifications.
Source code in src/mcp/types/_types.py
1573 1574 1575 1576 1577 | |
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 | |
ElicitRequestedSchema
module-attribute
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 | |
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
ElicitRequestParams: TypeAlias = (
ElicitRequestURLParams | ElicitRequestFormParams
)
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 | |
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.
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 | |
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
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 | |
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 | |
FormElicitationCapability
Bases: MCPModel
Capability for form mode elicitation.
Source code in src/mcp/types/_types.py
225 226 | |
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 | |
GetPromptRequestParams
Bases: RequestParams
Parameters for getting a prompt.
Source code in src/mcp/types/_types.py
867 868 869 870 871 872 873 | |
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 | |
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 | |
GetTaskPayloadRequestParams
Bases: RequestParams
Source code in src/mcp/types/_types.py
482 483 484 | |
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 | |
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 | |
GetTaskRequestParams
Bases: RequestParams
Source code in src/mcp/types/_types.py
465 466 467 | |
GetTaskResult
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 | |
mime_type
class-attribute
instance-attribute
mime_type: str | None = None
Optional MIME type for the icon.
sizes
class-attribute
instance-attribute
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 | |
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 | |
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.
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 | |
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 | |
InitializeRequestParams
Bases: RequestParams
Parameters for the initialize request.
Source code in src/mcp/types/_types.py
545 546 547 548 549 550 551 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
ListTasksResult
Bases: PaginatedResult
The response to a tasks/list request.
Source code in src/mcp/types/_types.py
526 527 528 529 | |
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 | |
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 | |
LoggingCapability
Bases: MCPModel
Capability for logging operations.
Source code in src/mcp/types/_types.py
351 352 | |
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 | |
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 | |
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 | |
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 | |
hints
class-attribute
instance-attribute
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 | |
NotificationParams
Bases: MCPModel
Source code in src/mcp/types/_types.py
90 91 92 93 94 95 | |
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 | |
PaginatedRequestParams
Bases: RequestParams
Source code in src/mcp/types/_types.py
82 83 84 85 86 87 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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
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 | |
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 | |
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 | |
PromptReference
Bases: MCPModel
Identifies a prompt.
Source code in src/mcp/types/_types.py
1425 1426 1427 1428 1429 1430 | |
PromptsCapability
Bases: MCPModel
Capability for prompts operations.
Source code in src/mcp/types/_types.py
328 329 330 331 332 | |
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 | |
ReadResourceRequestParams
Bases: RequestParams
Parameters for reading a resource.
Source code in src/mcp/types/_types.py
707 708 709 710 711 712 713 714 | |
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 | |
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 | |
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 | |
RequestParams
Bases: MCPModel
Source code in src/mcp/types/_types.py
68 69 70 71 72 73 74 75 76 77 78 79 | |
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 | |
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 | |
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
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 | |
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.
ResourceLink
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 | |
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 | |
ResourcesCapability
Bases: MCPModel
Capability for resources operations.
Source code in src/mcp/types/_types.py
335 336 337 338 339 340 341 | |
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 | |
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
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 | |
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 | |
ResourceUpdatedNotificationParams
Bases: NotificationParams
Parameters for resource update notifications.
Source code in src/mcp/types/_types.py
807 808 809 810 811 812 813 814 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
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 | |
content
instance-attribute
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
class-attribute
instance-attribute
meta: Meta | None = Field(alias='_meta', default=None)
See MCP specification for notes on _meta usage.
content_as_list
property
content_as_list: list[SamplingMessageContentBlock]
Returns the content as a list of content blocks, regardless of whether it was originally a single block or a list.
SamplingMessageContentBlock
module-attribute
SamplingMessageContentBlock: TypeAlias = (
TextContent
| ImageContent
| AudioContent
| ToolUseContent
| ToolResultContent
)
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 | |
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 | |
experimental
class-attribute
instance-attribute
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 | |
ServerTasksRequestsCapability
Bases: MCPModel
Capability for tasks requests operations.
Source code in src/mcp/types/_types.py
369 370 371 372 | |
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 | |
SetLevelRequestParams
Bases: RequestParams
Parameters for setting the logging level.
Source code in src/mcp/types/_types.py
1219 1220 1221 1222 1223 | |
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 | |
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 | |
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 | |
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)
last_updated_at
instance-attribute
last_updated_at: datetime
ISO 8601 timestamp when the task was last updated.
ttl
instance-attribute
Actual retention duration from creation in milliseconds, null for unlimited.
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 | |
TasksCallCapability
Bases: MCPModel
Capability for tasks call operations.
Source code in src/mcp/types/_types.py
359 360 | |
TasksCancelCapability
Bases: MCPModel
Capability for tasks cancel operations.
Source code in src/mcp/types/_types.py
265 266 | |
TasksCreateElicitationCapability
Bases: MCPModel
Capability for tasks create elicitation operations.
Source code in src/mcp/types/_types.py
279 280 | |
TasksCreateMessageCapability
Bases: MCPModel
Capability for tasks create messages.
Source code in src/mcp/types/_types.py
269 270 | |
TasksElicitationCapability
Bases: MCPModel
Capability for tasks elicitation operations.
Source code in src/mcp/types/_types.py
283 284 285 286 | |
TasksListCapability
Bases: MCPModel
Capability for tasks listing operations.
Source code in src/mcp/types/_types.py
261 262 | |
TasksSamplingCapability
Bases: MCPModel
Capability for tasks sampling operations.
Source code in src/mcp/types/_types.py
273 274 275 276 | |
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 | |
TaskStatusNotificationParams
Bases: NotificationParams, Task
Parameters for a notifications/tasks/status notification.
Source code in src/mcp/types/_types.py
532 533 | |
TasksToolsCapability
Bases: MCPModel
Capability for tasks tools operations.
Source code in src/mcp/types/_types.py
363 364 365 366 | |
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 | |
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 | |
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 | |
description
class-attribute
instance-attribute
description: str | None = None
A human-readable description of the tool.
input_schema
instance-attribute
A JSON Schema object defining the expected parameters for the tool.
output_schema
class-attribute
instance-attribute
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
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 | |
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 | |
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 | |
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 | |
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 | |
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
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 | |
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 | |
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
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 | |
UnsubscribeRequestParams
Bases: RequestParams
Parameters for unsubscribing from a resource.
Source code in src/mcp/types/_types.py
791 792 793 794 795 | |
UrlElicitationCapability
Bases: MCPModel
Capability for URL mode elicitation.
Source code in src/mcp/types/_types.py
229 230 | |
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 | |
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 | |
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 | |
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 | |
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 | |