JSON-RPC
JSONRPCErrorResponse
JSONRPCMessage
Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.
JSONRPCNotification
A notification which does not expect a response.
JSONRPCRequest
method: string;
params?: { [key: string]: any };
jsonrpc: “2.0”;
id: RequestId;
}
A request that expects a response.
JSONRPCResultResponse
A successful (non-error) response to a request.
Common Types
Annotations
Optional annotations for the client. The client can use annotations to inform how objects are used or displayed
Describes who the intended audience of this object or data is.
It can include multiple entries to indicate content useful for multiple audiences (e.g., [“user”, “assistant”]).
Describes how important this data is for operating the server.
A value of 1 means “most important,” and indicates that the data is effectively required, while 0 means “least important,” and indicates that the data is entirely optional.
The moment the resource was last modified, as an ISO 8601 formatted string.
Should be an ISO 8601 formatted string (e.g., “2025-01-12T15:00:58Z”).
Examples: last activity timestamp in an open file, timestamp when the resource was attached, etc.
Icon
An optionally-sized icon that can be displayed in a user interface.
A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a data: URI with Base64-encoded image data.
Consumers SHOULD takes steps to ensure URLs serving icons are from the same domain as the client/server or a trusted domain.
Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain executable JavaScript.
Optional MIME type override if the source MIME type is missing or generic.
For example: “image/png”, “image/jpeg”, or “image/svg+xml”.
Optional array of strings that specify sizes at which the icon can be used.
Each string should be in WxH format (e.g., “48x48”, “96x96”) or “any” for scalable formats like SVG.
If not provided, the client should assume that the icon can be used at any size.
Optional specifier for the theme this icon is designed for. “light” indicates
the icon is designed to be used with a light background, and “dark” indicates
the icon is designed to be used with a dark background.
If not provided, the client should assume the icon can be used with any theme.
LoggingLevel
| “debug”
| “info”
| “notice”
| “warning”
| “error”
| “critical”
| “alert”
| “emergency”
The severity of a log message.
These map to syslog message severities, as specified in RFC-5424: https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1
MetaObject
Represents the contents of a _meta field, which clients and servers use to attach additional metadata to their interactions.
Certain key names are reserved by MCP for protocol-level metadata; implementations MUST NOT make assumptions about values at these keys. Additionally, specific schema definitions may reserve particular names for purpose-specific metadata, as declared in those definitions.
Valid keys have two segments:
Prefix:
- Optional — if specified, MUST be a series of labels separated by dots (
.), followed by a slash (/). - Labels MUST start with a letter and end with a letter or digit. Interior characters may be letters, digits, or hyphens (
-). - Any prefix consisting of zero or more labels, followed by
modelcontextprotocolormcp, followed by any label, is reserved for MCP use. For example:modelcontextprotocol.io/,mcp.dev/,api.modelcontextprotocol.org/, andtools.mcp.com/are all reserved.
Name:
- Unless empty, MUST start and end with an alphanumeric character (
[a-z0-9A-Z]). - Interior characters may be alphanumeric, hyphens (
-), underscores (_), or dots (.).
General fields: _meta for more details.
NotificationParams
Common params for any notification.
PaginatedRequestParams
Common params for paginated requests.
An opaque token representing the current pagination position. If provided, the server should return results starting after this cursor.
ProgressToken
A progress token, used to associate progress notifications with the original request.
RequestMetaObject
Extends MetaObject with additional request-specific fields. All key naming rules from MetaObject apply.
- MetaObject for key naming rules and reserved prefixes.
- General fields:
_metafor more details.
If specified, the caller is requesting 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.
RequestParams
Common params for any request.
Result
Common result fields.
Errors
Error
The error type that occurred.
A short description of the error. The message SHOULD be limited to a concise single sentence.
Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
InternalError
A JSON-RPC error indicating that an internal error occurred on the receiver. This error is returned when the receiver encounters an unexpected condition that prevents it from fulfilling the request.
A short description of the error. The message SHOULD be limited to a concise single sentence.
Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
The error type that occurred.
InvalidParamsError
A JSON-RPC error indicating that the method parameters are invalid or malformed.
In MCP, this error is returned in various contexts when request parameters fail validation:
- Tools: Unknown tool name or invalid tool arguments
- Prompts: Unknown prompt name or missing required arguments
- Pagination: Invalid or expired cursor values
- Logging: Invalid log level
- Tasks: Invalid or nonexistent task ID, invalid cursor, or attempting to cancel a task already in a terminal status
- Elicitation: Server requests an elicitation mode not declared in client capabilities
- Sampling: Missing tool result or tool results mixed with other content
A short description of the error. The message SHOULD be limited to a concise single sentence.
Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
The error type that occurred.
InvalidRequestError
A JSON-RPC error indicating that the request is not a valid request object. This error is returned when the message structure does not conform to the JSON-RPC 2.0 specification requirements for a request (e.g., missing required fields like jsonrpc or method, or using invalid types for these fields).
A short description of the error. The message SHOULD be limited to a concise single sentence.
Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
The error type that occurred.
MethodNotFoundError
A JSON-RPC error indicating that the requested method does not exist or is not available.
In MCP, this error is returned when a request is made for a method that requires a capability that has not been declared. This can occur in either direction:
- A server returning this error when the client requests a capability it doesn’t support (e.g., requesting completions when the
completionscapability was not advertised) - A client returning this error when the server requests a capability it doesn’t support (e.g., requesting roots when the client did not declare the
rootscapability)
A short description of the error. The message SHOULD be limited to a concise single sentence.
Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
The error type that occurred.
ParseError
A JSON-RPC error indicating that invalid JSON was received by the server. This error is returned when the server cannot parse the JSON text of a message.
A short description of the error. The message SHOULD be limited to a concise single sentence.
Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).
The error type that occurred.
Content
AudioContent
type: “audio”;
data: string;
mimeType: string;
annotations?: Annotations;
_meta?: MetaObject;
}
Audio provided to or from an LLM.
The base64-encoded audio data.
The MIME type of the audio. Different providers may support different audio types.
Optional annotations for the client.
BlobResourceContents
The URI of this resource.
The MIME type of this resource, if known.
A base64-encoded string representing the binary data of the item.
ContentBlock
EmbeddedResource
type: “resource”;
resource: TextResourceContents | BlobResourceContents;
annotations?: Annotations;
_meta?: MetaObject;
}
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.
Example: Embedded file resource with annotations
{
“type”: “resource”,
“resource”: {
“uri”: “file:///project/src/main.rs”,
“mimeType”: “text/x-rust”,
“text”: “fn main() {\n println!(\“Hello world!\”);\n}”,
“annotations”: {
“audience”: [“user”, “assistant”],
“priority”: 0.7,
“lastModified”: “2025-05-03T14:30:00Z”
}
}
} Optional annotations for the client.
ImageContent
type: “image”;
data: string;
mimeType: string;
annotations?: Annotations;
_meta?: MetaObject;
}
An image provided to or from an LLM.
The base64-encoded image data.
The MIME type of the image. Different providers may support different image types.
Optional annotations for the client.
ResourceLink
icons?: Icon[];
name: string;
title?: string;
uri: string;
description?: string;
mimeType?: string;
annotations?: Annotations;
size?: number;
_meta?: MetaObject;
type: “resource_link”;
}
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.
Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
image/png- PNG images (safe, universal compatibility)image/jpeg(andimage/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
image/svg+xml- SVG images (scalable but requires security precautions)image/webp- WebP images (modern, efficient format)
Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
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).
The URI of this resource.
A description of what this resource represents.
This can be used by clients to improve the LLM’s understanding of available resources. It can be thought of like a “hint” to the model.
The MIME type of this resource, if known.
Optional annotations for the client.
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.
TextContent
Text provided to or from an LLM.
The text content of the message.
Optional annotations for the client.
TextResourceContents
The URI of this resource.
The MIME type of this resource, if known.
The text of the item. This must only be set if the item can actually be represented as text (not binary data).
completion/complete
CompleteRequest
jsonrpc: “2.0”;
id: RequestId;
method: “completion/complete”;
params: CompleteRequestParams;
}
A request from the client to the server, to ask for completion options.
CompleteRequestParams
_meta?: RequestMetaObject;
ref: PromptReference | ResourceTemplateReference;
argument: { name: string; value: string };
context?: { arguments?: { [key: string]: string } };
}
Parameters for a completion/complete request.
The argument’s information
- name: string
The name of the argument
- value: string
The value of the argument to use for completion matching.
Additional, optional context for completions
Optionalarguments?: { [key: string]: string }Previously-resolved variables in a URI template or prompt.
CompleteResult
_meta?: MetaObject;
completion: { values: string[]; total?: number; hasMore?: boolean };
[key: string]: unknown;
}
The result returned by the server for a completion/complete request.
- values: string[]
An array of completion values. Must not exceed 100 items.
Optionaltotal?: numberThe total number of completion options available. This can exceed the number of values actually sent in the response.
OptionalhasMore?: booleanIndicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
PromptReference
Identifies a prompt.
Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
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).
ResourceTemplateReference
A reference to a resource or resource template definition.
The URI or URI template of the resource.
elicitation/create
ElicitRequest
jsonrpc: “2.0”;
id: RequestId;
method: “elicitation/create”;
params: ElicitRequestParams;
}
A request from the server to elicit additional information from the user via the client.
ElicitRequestParams
The parameters for a request to elicit additional information from the user via the client.
ElicitResult
_meta?: MetaObject;
action: “accept” | “decline” | “cancel”;
content?: { [key: string]: string | number | boolean | string[] };
[key: string]: unknown;
}
The result returned by the client for an elicitation/create request.
Example: Input multiple fields
{
“action”: “accept”,
“content”: {
“name”: “Monalisa Octocat”,
“email”: “[email protected]”,
“age”: 30
}
} The user action in response to the elicitation.
“accept”: User submitted the form/confirmed the action“decline”: User explicitly declined the action“cancel”: User dismissed without making an explicit choice
The submitted form data, only present when action is “accept” and mode was “form”.
Contains values matching the requested schema.
Omitted for out-of-band mode responses.
BooleanSchema
type: “boolean”;
title?: string;
description?: string;
default?: boolean;
}
ElicitRequestFormParams
task?: TaskMetadata;
_meta?: RequestMetaObject;
mode?: “form”;
message: string;
requestedSchema: {
$schema?: string;
type: “object”;
properties: { [key: string]: PrimitiveSchemaDefinition };
required?: string[];
};
}
The parameters for a request to elicit non-sensitive information from the user via a form in the client.
Example: Elicit single field
{
“mode”: “form”,
“message”: “Please provide your GitHub username”,
“requestedSchema”: {
“type”: “object”,
“properties”: {
“name”: {
“type”: “string”
}
},
“required”: [“name”]
}
} Example: Elicit multiple fields
{
“mode”: “form”,
“message”: “Please provide your contact information”,
“requestedSchema”: {
“type”: “object”,
“properties”: {
“name”: {
“type”: “string”,
“description”: “Your full name”
},
“email”: {
“type”: “string”,
“format”: “email”,
“description”: “Your email address”
},
“age”: {
“type”: “number”,
“minimum”: 18,
“description”: “Your age”
}
},
“required”: [“name”, “email”]
}
} 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.
The elicitation mode.
The message to present to the user describing what information is being requested.
A restricted subset of JSON Schema. Only top-level properties are allowed, without nesting.
ElicitRequestURLParams
task?: TaskMetadata;
_meta?: RequestMetaObject;
mode: “url”;
message: string;
elicitationId: string;
url: string;
}
The parameters for a request to elicit information from the user via a URL in the client.
Example: Elicit sensitive data
{
“mode”: “url”,
“elicitationId”: “550e8400-e29b-41d4-a716-446655440000”,
“url”: “https://mcp.example.com/ui/set_api_key”,
“message”: “Please provide your API key to continue.”
} 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.
The elicitation mode.
The message to present to the user explaining why the interaction is needed.
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.
The URL that the user should navigate to.
EnumSchema
LegacyTitledEnumSchema
type: “string”;
title?: string;
description?: string;
enum: string[];
enumNames?: string[];
default?: string;
}
Use TitledSingleSelectEnumSchema instead. This interface will be removed in a future version.
(Legacy) Display names for enum values. Non-standard according to JSON schema 2020-12.
MultiSelectEnumSchema
NumberSchema
type: “number” | “integer”;
title?: string;
description?: string;
minimum?: number;
maximum?: number;
default?: number;
}
PrimitiveSchemaDefinition
Restricted schema definitions that only allow primitive types without nested objects or arrays.
SingleSelectEnumSchema
StringSchema
type: “string”;
title?: string;
description?: string;
minLength?: number;
maxLength?: number;
format?: “uri” | “email” | “date” | “date-time”;
default?: string;
}
Example: Email input schema
{
“type”: “string”,
“title”: “Display Name”,
“description”: “Description text”,
“minLength”: 3,
“maxLength”: 50,
“format”: “email”,
“default”: “[email protected]”
} TitledMultiSelectEnumSchema
type: “array”;
title?: string;
description?: string;
minItems?: number;
maxItems?: number;
items: { anyOf: { const: string; title: string }[] };
default?: string[];
}
Schema for multiple-selection enumeration with display titles for each option.
Example: Titled color multi-select schema
{
“type”: “array”,
“title”: “Color Selection”,
“description”: “Choose your favorite colors”,
“minItems”: 1,
“maxItems”: 2,
“items”: {
“anyOf”: [
{ “const”: “#FF0000”, “title”: “Red” },
{ “const”: “#00FF00”, “title”: “Green” },
{ “const”: “#0000FF”, “title”: “Blue” }
]
},
“default”: [“#FF0000”, “#00FF00”]
} Optional title for the enum field.
Optional description for the enum field.
Minimum number of items to select.
Maximum number of items to select.
Schema for array items with enum options and display labels.
- anyOf: { const: string; title: string }[]
Array of enum options with values and display labels.
Optional default value.
TitledSingleSelectEnumSchema
type: “string”;
title?: string;
description?: string;
oneOf: { const: string; title: string }[];
default?: string;
}
Schema for single-selection enumeration with display titles for each option.
Optional title for the enum field.
Optional description for the enum field.
Array of enum options with values and display labels.
- const: string
The enum value.
- title: string
Display label for this option.
Optional default value.
UntitledMultiSelectEnumSchema
type: “array”;
title?: string;
description?: string;
minItems?: number;
maxItems?: number;
items: { type: “string”; enum: string[] };
default?: string[];
}
Schema for multiple-selection enumeration without display titles for options.
Optional title for the enum field.
Optional description for the enum field.
Minimum number of items to select.
Maximum number of items to select.
Schema for the array items.
- type: “string”
- enum: string[]
Array of enum values to choose from.
Optional default value.
UntitledSingleSelectEnumSchema
type: “string”;
title?: string;
description?: string;
enum: string[];
default?: string;
}
Schema for single-selection enumeration without display titles for options.
Optional title for the enum field.
Optional description for the enum field.
Array of enum values to choose from.
Optional default value.
initialize
InitializeRequest
jsonrpc: “2.0”;
id: RequestId;
method: “initialize”;
params: InitializeRequestParams;
}
This request is sent from the client to the server when it first connects, asking it to begin initialization.
Example: Initialize request
{
“jsonrpc”: “2.0”,
“id”: “initialize-example”,
“method”: “initialize”,
“params”: {
“protocolVersion”: “2024-11-05”,
“capabilities”: {
“roots”: {
“listChanged”: true
},
“sampling”: {},
“elicitation”: {
“form”: {},
“url”: {}
},
“tasks”: {
“requests”: {
“elicitation”: {
“create”: {}
},
“sampling”: {
“createMessage”: {}
}
}
}
},
“clientInfo”: {
“name”: “ExampleClient”,
“title”: “Example Client Display Name”,
“version”: “1.0.0”,
“description”: “An example MCP client application”,
“icons”: [
{
“src”: “https://example.com/icon.png”,
“mimeType”: “image/png”,
“sizes”: [“48x48”]
}
],
“websiteUrl”: “https://example.com”
}
}
} InitializeRequestParams
_meta?: RequestMetaObject;
protocolVersion: string;
capabilities: ClientCapabilities;
clientInfo: Implementation;
}
Parameters for an initialize request.
Example: Full client capabilities
{
“protocolVersion”: “2024-11-05”,
“capabilities”: {
“roots”: {
“listChanged”: true
},
“sampling”: {},
“elicitation”: {
“form”: {},
“url”: {}
},
“tasks”: {
“requests”: {
“elicitation”: {
“create”: {}
},
“sampling”: {
“createMessage”: {}
}
}
}
},
“clientInfo”: {
“name”: “ExampleClient”,
“title”: “Example Client Display Name”,
“version”: “1.0.0”,
“description”: “An example MCP client application”,
“icons”: [
{
“src”: “https://example.com/icon.png”,
“mimeType”: “image/png”,
“sizes”: [“48x48”]
}
],
“websiteUrl”: “https://example.com”
}
} The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
InitializeResultResponse
A successful response from the server for a initialize request.
Example: Initialize result response
{
“jsonrpc”: “2.0”,
“id”: “initialize-example”,
“result”: {
“protocolVersion”: “2024-11-05”,
“capabilities”: {
“logging”: {},
“prompts”: {
“listChanged”: true
},
“resources”: {
“subscribe”: true,
“listChanged”: true
},
“tools”: {
“listChanged”: true
},
“tasks”: {
“list”: {},
“cancel”: {},
“requests”: {
“tools”: {
“call”: {}
}
}
}
},
“serverInfo”: {
“name”: “ExampleServer”,
“title”: “Example Server Display Name”,
“version”: “1.0.0”,
“description”: “An example MCP server providing tools and resources”,
“icons”: [
{
“src”: “https://example.com/server-icon.svg”,
“mimeType”: “image/svg+xml”,
“sizes”: [“any”]
}
],
“websiteUrl”: “https://example.com/server”
},
“instructions”: “Optional instructions for the client”
}
} InitializeResult
_meta?: MetaObject;
protocolVersion: string;
capabilities: ServerCapabilities;
serverInfo: Implementation;
instructions?: string;
[key: string]: unknown;
}
The result returned by the server for an initialize request.
Example: Full server capabilities
{
“protocolVersion”: “2024-11-05”,
“capabilities”: {
“logging”: {},
“prompts”: {
“listChanged”: true
},
“resources”: {
“subscribe”: true,
“listChanged”: true
},
“tools”: {
“listChanged”: true
},
“tasks”: {
“list”: {},
“cancel”: {},
“requests”: {
“tools”: {
“call”: {}
}
}
}
},
“serverInfo”: {
“name”: “ExampleServer”,
“title”: “Example Server Display Name”,
“version”: “1.0.0”,
“description”: “An example MCP server providing tools and resources”,
“icons”: [
{
“src”: “https://example.com/server-icon.svg”,
“mimeType”: “image/svg+xml”,
“sizes”: [“any”]
}
],
“websiteUrl”: “https://example.com/server”
},
“instructions”: “Optional instructions for the client”
} The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect.
Instructions describing how to use the server and its features.
This can be used by clients to improve the LLM’s understanding of available tools, resources, etc. It can be thought of like a “hint” to the model. For example, this information MAY be added to the system prompt.
ClientCapabilities
experimental?: { [key: string]: object };
roots?: { listChanged?: boolean };
sampling?: { context?: object; tools?: object };
elicitation?: { form?: object; url?: object };
tasks?: {
list?: object;
cancel?: object;
requests?: {
sampling?: { createMessage?: object };
elicitation?: { create?: object };
};
};
}
Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
Experimental, non-standard capabilities that the client supports.
Present if the client supports listing roots.
OptionallistChanged?: booleanWhether the client supports notifications for changes to the roots list.
Present if the client supports sampling from an LLM.
Optionalcontext?: objectWhether the client supports context inclusion via
includeContextparameter. If not declared, servers SHOULD only useincludeContext: “none”(or omit it).Optionaltools?: objectWhether the client supports tool use via
toolsandtoolChoiceparameters.
Present if the client supports elicitation from the server.
Present if the client supports task-augmented requests.
Optionallist?: objectWhether this client supports tasks/list.
Optionalcancel?: objectWhether this client supports tasks/cancel.
Optionalrequests?: { sampling?: { createMessage?: object }; elicitation?: { create?: object } }Specifies which request types can be augmented with tasks.
Optionalsampling?: { createMessage?: object }Task support for sampling-related requests.
OptionalcreateMessage?: objectWhether the client supports task-augmented
sampling/createMessagerequests.
Optionalelicitation?: { create?: object }Task support for elicitation-related requests.
Optionalcreate?: objectWhether the client supports task-augmented elicitation/create requests.
Implementation
icons?: Icon[];
name: string;
title?: string;
version: string;
description?: string;
websiteUrl?: string;
}
Describes the MCP implementation.
Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
image/png- PNG images (safe, universal compatibility)image/jpeg(andimage/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
image/svg+xml- SVG images (scalable but requires security precautions)image/webp- WebP images (modern, efficient format)
Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
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).
An optional human-readable description of what this implementation does.
This can be used by clients or servers to provide context about their purpose and capabilities. For example, a server might describe the types of resources or tools it provides, while a client might describe its intended use case.
An optional URL of the website for this implementation.
ServerCapabilities
experimental?: { [key: string]: object };
logging?: object;
completions?: object;
prompts?: { listChanged?: boolean };
resources?: { subscribe?: boolean; listChanged?: boolean };
tools?: { listChanged?: boolean };
tasks?: {
list?: object;
cancel?: object;
requests?: { tools?: { call?: object } };
};
}
Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
Experimental, non-standard capabilities that the server supports.
Present if the server supports sending log messages to the client.
Present if the server supports argument autocompletion suggestions.
Present if the server offers any prompt templates.
OptionallistChanged?: booleanWhether this server supports notifications for changes to the prompt list.
Present if the server offers any resources to read.
Optionalsubscribe?: booleanWhether this server supports subscribing to resource updates.
OptionallistChanged?: booleanWhether this server supports notifications for changes to the resource list.
Present if the server offers any tools to call.
OptionallistChanged?: booleanWhether this server supports notifications for changes to the tool list.
Present if the server supports task-augmented requests.
Optionallist?: objectWhether this server supports tasks/list.
Optionalcancel?: objectWhether this server supports tasks/cancel.
Optionalrequests?: { tools?: { call?: object } }Specifies which request types can be augmented with tasks.
Optionaltools?: { call?: object }Task support for tool-related requests.
Optionalcall?: objectWhether the server supports task-augmented tools/call requests.
logging/setLevel
SetLevelRequest
jsonrpc: “2.0”;
id: RequestId;
method: “logging/setLevel”;
params: SetLevelRequestParams;
}
A request from the client to the server, to enable or adjust logging.
SetLevelRequestParams
Parameters for a logging/setLevel request.
The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.
notifications/cancelled
CancelledNotification
jsonrpc: “2.0”;
method: “notifications/cancelled”;
params: CancelledNotificationParams;
}
This notification can be sent by either side to indicate that it is cancelling a previously-issued request.
The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished.
This notification indicates that the result will be unused, so any associated processing SHOULD cease.
A client MUST NOT attempt to cancel its initialize request.
For task cancellation, use the tasks/cancel request instead of this notification.
CancelledNotificationParams
_meta?: MetaObject;
requestId?: RequestId;
reason?: string;
}
Parameters for a notifications/cancelled notification.
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).
An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.
notifications/initialized
InitializedNotification
jsonrpc: “2.0”;
method: “notifications/initialized”;
params?: NotificationParams;
}
This notification is sent from the client to the server after initialization has finished.
notifications/tasks/status
TaskStatusNotification
jsonrpc: “2.0”;
method: “notifications/tasks/status”;
params: TaskStatusNotificationParams;
}
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.
TaskStatusNotificationParams
Parameters for a notifications/tasks/status notification.
notifications/message
LoggingMessageNotification
jsonrpc: “2.0”;
method: “notifications/message”;
params: LoggingMessageNotificationParams;
}
JSONRPCNotification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically.
LoggingMessageNotificationParams
_meta?: MetaObject;
level: LoggingLevel;
logger?: string;
data: unknown;
}
Parameters for a notifications/message notification.
The severity of this log message.
An optional name of the logger issuing this message.
The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here.
notifications/progress
ProgressNotification
jsonrpc: “2.0”;
method: “notifications/progress”;
params: ProgressNotificationParams;
}
An out-of-band notification used to inform the receiver of a progress update for a long-running request.
ProgressNotificationParams
_meta?: MetaObject;
progressToken: ProgressToken;
progress: number;
total?: number;
message?: string;
}
Parameters for a notifications/progress notification.
The progress token which was given in the initial request, used to associate this notification with the request that is proceeding.
The progress thus far. This should increase every time progress is made, even if the total is unknown.
Total number of items to process (or total progress required), if known.
An optional message describing the current progress.
notifications/prompts/list_changed
PromptListChangedNotification
jsonrpc: “2.0”;
method: “notifications/prompts/list_changed”;
params?: NotificationParams;
}
An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client.
notifications/resources/list_changed
ResourceListChangedNotification
jsonrpc: “2.0”;
method: “notifications/resources/list_changed”;
params?: NotificationParams;
}
An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.
notifications/resources/updated
ResourceUpdatedNotification
jsonrpc: “2.0”;
method: “notifications/resources/updated”;
params: ResourceUpdatedNotificationParams;
}
A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request.
ResourceUpdatedNotificationParams
Parameters for a notifications/resources/updated notification.
The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to.
notifications/roots/list_changed
RootsListChangedNotification
jsonrpc: “2.0”;
method: “notifications/roots/list_changed”;
params?: NotificationParams;
}
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.
notifications/tools/list_changed
ToolListChangedNotification
jsonrpc: “2.0”;
method: “notifications/tools/list_changed”;
params?: NotificationParams;
}
An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client.
notifications/elicitation/complete
ElicitationCompleteNotification
jsonrpc: “2.0”;
method: “notifications/elicitation/complete”;
params: { elicitationId: string };
}
An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request.
- elicitationId: string
The ID of the elicitation that completed.
ping
PingRequest
A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
tasks
CreateTaskResultResponse
A successful response for a task-augmented request.
CreateTaskResult
The result returned for a task-augmented request.
RelatedTaskMetadata
Metadata for associating messages with a task.
Include this in the _meta field under the key io.modelcontextprotocol/related-task.
The task identifier this message is associated with.
Task
taskId: string;
status: TaskStatus;
statusMessage?: string;
createdAt: string;
lastUpdatedAt: string;
ttl: number | null;
pollInterval?: number;
}
Data associated with a task.
The task identifier.
Current task state.
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)
ISO 8601 timestamp when the task was created.
ISO 8601 timestamp when the task was last updated.
Actual retention duration from creation in milliseconds, null for unlimited.
Suggested polling interval in milliseconds.
TaskMetadata
Metadata for augmenting a request with task execution.
Include this in the task field of the request parameters.
Requested duration in milliseconds to retain task from creation.
TaskStatus
The status of a task.
tasks/get
GetTaskRequest
jsonrpc: “2.0”;
id: RequestId;
method: “tasks/get”;
params: { taskId: string };
}
A request to retrieve the state of a task.
- taskId: string
The task identifier to query.
tasks/result
GetTaskPayloadRequest
jsonrpc: “2.0”;
id: RequestId;
method: “tasks/result”;
params: { taskId: string };
}
A request to retrieve the result of a completed task.
- taskId: string
The task identifier to retrieve results for.
GetTaskPayloadResultResponse
jsonrpc: “2.0”;
id: RequestId;
result: GetTaskPayloadResult;
}
A successful response for a tasks/result request.
GetTaskPayloadResult
The result returned for 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.
tasks/list
ListTasksRequest
jsonrpc: “2.0”;
id: RequestId;
params?: PaginatedRequestParams;
method: “tasks/list”;
}
A request to retrieve a list of tasks.
ListTasksResult
_meta?: MetaObject;
nextCursor?: string;
tasks: Task[];
[key: string]: unknown;
}
The result returned for a tasks/list request.
An opaque token representing the pagination position after the last returned result. If present, there may be more results available.
tasks/cancel
CancelTaskRequest
jsonrpc: “2.0”;
id: RequestId;
method: “tasks/cancel”;
params: { taskId: string };
}
A request to cancel a task.
- taskId: string
The task identifier to cancel.
prompts/get
GetPromptRequest
jsonrpc: “2.0”;
id: RequestId;
method: “prompts/get”;
params: GetPromptRequestParams;
}
Used by the client to get a prompt provided by the server.
GetPromptRequestParams
_meta?: RequestMetaObject;
name: string;
arguments?: { [key: string]: string };
}
Parameters for a prompts/get request.
The name of the prompt or prompt template.
Arguments to use for templating the prompt.
GetPromptResult
_meta?: MetaObject;
description?: string;
messages: PromptMessage[];
[key: string]: unknown;
}
The result returned by the server for a prompts/get request.
An optional description for the prompt.
PromptMessage
Describes a message returned as part of a prompt.
This is similar to SamplingMessage, but also supports the embedding of resources from the MCP server.
prompts/list
ListPromptsRequest
jsonrpc: “2.0”;
id: RequestId;
params?: PaginatedRequestParams;
method: “prompts/list”;
}
Sent from the client to request a list of prompts and prompt templates the server has.
ListPromptsResultResponse
A successful response from the server for a prompts/list request.
Example: List prompts result response
{
“jsonrpc”: “2.0”,
“id”: “list-prompts-example”,
“result”: {
“prompts”: [
{
“name”: “code_review”,
“title”: “Request Code Review”,
“description”: “Asks the LLM to analyze code quality and suggest improvements”,
“arguments”: [
{
“name”: “code”,
“description”: “The code to review”,
“required”: true
}
],
“icons”: [
{
“src”: “https://example.com/review-icon.svg”,
“mimeType”: “image/svg+xml”,
“sizes”: [“any”]
}
]
}
],
“nextCursor”: “next-page-cursor”
}
} ListPromptsResult
_meta?: MetaObject;
nextCursor?: string;
prompts: Prompt[];
[key: string]: unknown;
}
The result returned by the server for a prompts/list request.
Example: Prompts list with cursor
{
“prompts”: [
{
“name”: “code_review”,
“title”: “Request Code Review”,
“description”: “Asks the LLM to analyze code quality and suggest improvements”,
“arguments”: [
{
“name”: “code”,
“description”: “The code to review”,
“required”: true
}
],
“icons”: [
{
“src”: “https://example.com/review-icon.svg”,
“mimeType”: “image/svg+xml”,
“sizes”: [“any”]
}
]
}
],
“nextCursor”: “next-page-cursor”
} An opaque token representing the pagination position after the last returned result. If present, there may be more results available.
Prompt
icons?: Icon[];
name: string;
title?: string;
description?: string;
arguments?: PromptArgument[];
_meta?: MetaObject;
}
A prompt or prompt template that the server offers.
Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
image/png- PNG images (safe, universal compatibility)image/jpeg(andimage/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
image/svg+xml- SVG images (scalable but requires security precautions)image/webp- WebP images (modern, efficient format)
Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
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).
An optional description of what this prompt provides
A list of arguments to use for templating the prompt.
PromptArgument
Describes an argument that a prompt can accept.
Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
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).
A human-readable description of the argument.
Whether this argument must be provided.
resources/list
ListResourcesRequest
jsonrpc: “2.0”;
id: RequestId;
params?: PaginatedRequestParams;
method: “resources/list”;
}
Sent from the client to request a list of resources the server has.
ListResourcesResultResponse
jsonrpc: “2.0”;
id: RequestId;
result: ListResourcesResult;
}
A successful response from the server for a resources/list request.
Example: List resources result response
{
“jsonrpc”: “2.0”,
“id”: “list-resources-example”,
“result”: {
“resources”: [
{
“uri”: “file:///project/src/main.rs”,
“name”: “main.rs”,
“title”: “Rust Software Application Main File”,
“description”: “Primary application entry point”,
“mimeType”: “text/x-rust”,
“icons”: [
{
“src”: “https://example.com/rust-file-icon.png”,
“mimeType”: “image/png”,
“sizes”: [“48x48”]
}
]
}
],
“nextCursor”: “eyJwYWdlIjogM30=”
}
} ListResourcesResult
_meta?: MetaObject;
nextCursor?: string;
resources: Resource[];
[key: string]: unknown;
}
The result returned by the server for a resources/list request.
Example: Resources list with cursor
{
“resources”: [
{
“uri”: “file:///project/src/main.rs”,
“name”: “main.rs”,
“title”: “Rust Software Application Main File”,
“description”: “Primary application entry point”,
“mimeType”: “text/x-rust”,
“icons”: [
{
“src”: “https://example.com/rust-file-icon.png”,
“mimeType”: “image/png”,
“sizes”: [“48x48”]
}
]
}
],
“nextCursor”: “eyJwYWdlIjogM30=”
} An opaque token representing the pagination position after the last returned result. If present, there may be more results available.
Resource
icons?: Icon[];
name: string;
title?: string;
uri: string;
description?: string;
mimeType?: string;
annotations?: Annotations;
size?: number;
_meta?: MetaObject;
}
A known resource that the server is capable of reading.
Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
image/png- PNG images (safe, universal compatibility)image/jpeg(andimage/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
image/svg+xml- SVG images (scalable but requires security precautions)image/webp- WebP images (modern, efficient format)
Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
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).
The URI of this resource.
A description of what this resource represents.
This can be used by clients to improve the LLM’s understanding of available resources. It can be thought of like a “hint” to the model.
The MIME type of this resource, if known.
Optional annotations for the client.
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.
resources/read
ReadResourceRequest
jsonrpc: “2.0”;
id: RequestId;
method: “resources/read”;
params: ReadResourceRequestParams;
}
Sent from the client to the server, to read a specific resource URI.
ReadResourceRequestParams
Parameters for a resources/read request.
The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
ReadResourceResult
_meta?: MetaObject;
contents: (TextResourceContents | BlobResourceContents)[];
[key: string]: unknown;
}
The result returned by the server for a resources/read request.
resources/subscribe
SubscribeRequest
jsonrpc: “2.0”;
id: RequestId;
method: “resources/subscribe”;
params: SubscribeRequestParams;
}
Sent from the client to request resources/updated notifications from the server whenever a particular resource changes.
SubscribeRequestParams
Parameters for a resources/subscribe request.
The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
resources/templates/list
ListResourceTemplatesRequest
jsonrpc: “2.0”;
id: RequestId;
params?: PaginatedRequestParams;
method: “resources/templates/list”;
}
Sent from the client to request a list of resource templates the server has.
ListResourceTemplatesResultResponse
jsonrpc: “2.0”;
id: RequestId;
result: ListResourceTemplatesResult;
}
A successful response from the server for a resources/templates/list request.
Example: List resource templates result response
{
“jsonrpc”: “2.0”,
“id”: “list-resource-templates-example”,
“result”: {
“resourceTemplates”: [
{
“uriTemplate”: “file:///{path}”,
“name”: “Project Files”,
“title”: “Project Files”,
“description”: “Access files in the project directory”,
“mimeType”: “application/octet-stream”,
“icons”: [
{
“src”: “https://example.com/folder-icon.png”,
“mimeType”: “image/png”,
“sizes”: [“48x48”]
}
]
}
]
}
} ListResourceTemplatesResult
_meta?: MetaObject;
nextCursor?: string;
resourceTemplates: ResourceTemplate[];
[key: string]: unknown;
}
The result returned by the server for a resources/templates/list request.
Example: Resource templates list
{
“resourceTemplates”: [
{
“uriTemplate”: “file:///{path}”,
“name”: “Project Files”,
“title”: ”📁 Project Files”,
“description”: “Access files in the project directory”,
“mimeType”: “application/octet-stream”,
“icons”: [
{
“src”: “https://example.com/folder-icon.png”,
“mimeType”: “image/png”,
“sizes”: [“48x48”]
}
]
}
]
} An opaque token representing the pagination position after the last returned result. If present, there may be more results available.
ResourceTemplate
icons?: Icon[];
name: string;
title?: string;
uriTemplate: string;
description?: string;
mimeType?: string;
annotations?: Annotations;
_meta?: MetaObject;
}
A template description for resources available on the server.
Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
image/png- PNG images (safe, universal compatibility)image/jpeg(andimage/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
image/svg+xml- SVG images (scalable but requires security precautions)image/webp- WebP images (modern, efficient format)
Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
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).
A URI template (according to RFC 6570) that can be used to construct resource URIs.
A description of what this template is for.
This can be used by clients to improve the LLM’s understanding of available resources. It can be thought of like a “hint” to the model.
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.
Optional annotations for the client.
resources/unsubscribe
UnsubscribeRequest
jsonrpc: “2.0”;
id: RequestId;
method: “resources/unsubscribe”;
params: UnsubscribeRequestParams;
}
Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.
UnsubscribeRequestParams
Parameters for a resources/unsubscribe request.
The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it.
roots/list
ListRootsRequest
jsonrpc: “2.0”;
id: RequestId;
method: “roots/list”;
params?: RequestParams;
}
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.
ListRootsResult
The result returned by the client for a roots/list request. This result contains an array of Root objects, each representing a root directory or file that the server can operate on.
Root
Represents a root directory or file that the server can operate on.
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.
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.
sampling/createMessage
CreateMessageRequest
jsonrpc: “2.0”;
id: RequestId;
method: “sampling/createMessage”;
params: CreateMessageRequestParams;
}
A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it.
Example: Sampling request
{
“jsonrpc”: “2.0”,
“id”: “sampling-example”,
“method”: “sampling/createMessage”,
“params”: {
“messages”: [
{
“role”: “user”,
“content”: {
“type”: “text”,
“text”: “What is the capital of France?”
}
}
],
“modelPreferences”: {
“hints”: [
{
“name”: “claude-3-sonnet”
}
],
“intelligencePriority”: 0.8,
“speedPriority”: 0.5
},
“systemPrompt”: “You are a helpful assistant.”,
“maxTokens”: 100
}
} CreateMessageRequestParams
task?: TaskMetadata;
_meta?: RequestMetaObject;
messages: SamplingMessage[];
modelPreferences?: ModelPreferences;
systemPrompt?: string;
includeContext?: “none” | “thisServer” | “allServers”;
temperature?: number;
maxTokens: number;
stopSequences?: string[];
metadata?: object;
tools?: Tool[];
toolChoice?: ToolChoice;
}
Parameters for a sampling/createMessage request.
Example: Basic request
{
“messages”: [
{
“role”: “user”,
“content”: {
“type”: “text”,
“text”: “What is the capital of France?”
}
}
],
“modelPreferences”: {
“hints”: [
{
“name”: “claude-3-sonnet”
}
],
“intelligencePriority”: 0.8,
“speedPriority”: 0.5
},
“systemPrompt”: “You are a helpful assistant.”,
“maxTokens”: 100
} Example: Request with tools
{
“messages”: [
{
“role”: “user”,
“content”: {
“type”: “text”,
“text”: “What’s the weather like in Paris and London?”
}
}
],
“tools”: [
{
“name”: “get_weather”,
“description”: “Get current weather for a city”,
“inputSchema”: {
“type”: “object”,
“properties”: {
“city”: {
“type”: “string”,
“description”: “City name”
}
},
“required”: [“city”]
}
}
],
“toolChoice”: {
“mode”: “auto”
},
“maxTokens”: 1000
} Example: Follow-up request with tool results
{
“messages”: [
{
“role”: “user”,
“content”: {
“type”: “text”,
“text”: “What’s the weather like in Paris and London?”
}
},
{
“role”: “assistant”,
“content”: [
{
“type”: “tool_use”,
“id”: “call_abc123”,
“name”: “get_weather”,
“input”: { “city”: “Paris” }
},
{
“type”: “tool_use”,
“id”: “call_def456”,
“name”: “get_weather”,
“input”: { “city”: “London” }
}
]
},
{
“role”: “user”,
“content”: [
{
“type”: “tool_result”,
“toolUseId”: “call_abc123”,
“content”: [
{
“type”: “text”,
“text”: “Weather in Paris: 18°C, partly cloudy”
}
]
},
{
“type”: “tool_result”,
“toolUseId”: “call_def456”,
“content”: [
{
“type”: “text”,
“text”: “Weather in London: 15°C, rainy”
}
]
}
]
}
],
“tools”: [
{
“name”: “get_weather”,
“description”: “Get current weather for a city”,
“inputSchema”: {
“type”: “object”,
“properties”: {
“city”: { “type”: “string” }
},
“required”: [“city”]
}
}
],
“maxTokens”: 1000
} 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.
The server’s preferences for which model to select. The client MAY ignore these preferences.
An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
Default is “none”. Values “thisServer” and “allServers” are soft-deprecated. Servers SHOULD only use these values if the client
declares ClientCapabilities.sampling.context. These values may be removed in future spec releases.
The requested maximum number of tokens to sample (to prevent runaway completions).
The client MAY choose to sample fewer tokens than the requested maximum.
Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
Tools that the model may use during generation. The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
Controls how the model uses tools.
The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.
Default is { mode: “auto” }.
CreateMessageResultResponse
jsonrpc: “2.0”;
id: RequestId;
result: CreateMessageResult;
}
A successful response from the client for a sampling/createMessage request.
CreateMessageResult
_meta?: MetaObject;
model: string;
stopReason?: string;
role: Role;
content: SamplingMessageContentBlock | SamplingMessageContentBlock[];
[key: string]: unknown;
}
The result returned by the client for a sampling/createMessage request. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
Example: Text response
{
“role”: “assistant”,
“content”: {
“type”: “text”,
“text”: “The capital of France is Paris.”
},
“model”: “claude-3-sonnet-20240307”,
“stopReason”: “endTurn”
} Example: Tool use response
{
“role”: “assistant”,
“content”: [
{
“type”: “tool_use”,
“id”: “call_abc123”,
“name”: “get_weather”,
“input”: {
“city”: “Paris”
}
},
{
“type”: “tool_use”,
“id”: “call_def456”,
“name”: “get_weather”,
“input”: {
“city”: “London”
}
}
],
“model”: “claude-3-sonnet-20240307”,
“stopReason”: “toolUse”
} Example: Final response after tool use
{
“role”: “assistant”,
“content”: {
“type”: “text”,
“text”: “Based on the current weather data:\n\n- **Paris**: 18°C and partly cloudy - quite pleasant!\n- **London**: 15°C and rainy - you’ll want an umbrella.\n\nParis has slightly warmer and drier conditions today.”
},
“model”: “claude-3-sonnet-20240307”,
“stopReason”: “endTurn”
} The name of the model that generated the message.
The reason why sampling stopped, if known.
Standard values:
“endTurn”: Natural end of the assistant’s turn“stopSequence”: A stop sequence was encountered“maxTokens”: Maximum token limit was reached“toolUse”: The model wants to use one or more tools
This field is an open string to allow for provider-specific stop reasons.
ModelHint
Hints to use for model selection.
Keys not declared here are currently left unspecified by the spec and are up to the client to interpret.
A hint for a model name.
The client SHOULD treat this as a substring of a model name; for example:
claude-3-5-sonnetshould matchclaude-3-5-sonnet-20241022sonnetshould matchclaude-3-5-sonnet-20241022,claude-3-sonnet-20240229, etc.claudeshould match any Claude model
The client MAY also map the string to a different provider’s model name or a different model family, as long as it fills a similar niche; for example:
gemini-1.5-flashcould matchclaude-3-haiku-20240307
ModelPreferences
hints?: ModelHint[];
costPriority?: number;
speedPriority?: number;
intelligencePriority?: number;
}
The server’s preferences for model selection, requested of the client during sampling.
Because LLMs can vary along multiple dimensions, choosing the “best” model is rarely straightforward. Different models excel in different areas—some are faster but less capable, others are more capable but more expensive, and so on. This interface allows servers to express their priorities across multiple dimensions to help clients make an appropriate selection for their use case.
These preferences are always advisory. The client MAY ignore them. It is also up to the client to decide how to interpret these preferences and how to balance them against other considerations.
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.
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.
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.
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.
SamplingMessage
role: Role;
content: SamplingMessageContentBlock | SamplingMessageContentBlock[];
_meta?: MetaObject;
}
Describes a message issued to or received from an LLM API.
ToolChoice
Controls tool selection behavior for sampling requests.
Controls the tool use ability of the model:
“auto”: Model decides whether to use tools (default)“required”: Model MUST use at least one tool before completing“none”: Model MUST NOT use any tools
ToolResultContent
type: “tool_result”;
toolUseId: string;
content: ContentBlock[];
structuredContent?: { [key: string]: unknown };
isError?: boolean;
_meta?: MetaObject;
}
The result of a tool use, provided by the user back to the assistant.
The ID of the tool use this result corresponds to.
This MUST match the ID from a previous ToolUseContent.
The unstructured result content of the tool use.
This has the same format as CallToolResult.content and can include text, images, audio, resource links, and embedded resources.
An optional structured result object.
If the tool defined an Tool.outputSchema, this SHOULD conform to that schema.
Whether the tool use resulted in an error.
If true, the content typically describes the error that occurred. Default: false
Optional metadata about the tool result. Clients SHOULD preserve this field when including tool results in subsequent sampling requests to enable caching optimizations.
ToolUseContent
type: “tool_use”;
id: string;
name: string;
input: { [key: string]: unknown };
_meta?: MetaObject;
}
A request from the assistant to call a tool.
A unique identifier for this tool use.
This ID is used to match tool results to their corresponding tool uses.
The name of the tool to call.
The arguments to pass to the tool, conforming to the tool’s input schema.
Optional metadata about the tool use. Clients SHOULD preserve this field when including tool uses in subsequent sampling requests to enable caching optimizations.
tools/call
CallToolRequest
jsonrpc: “2.0”;
id: RequestId;
method: “tools/call”;
params: CallToolRequestParams;
}
Used by the client to invoke a tool provided by the server.
CallToolRequestParams
task?: TaskMetadata;
_meta?: RequestMetaObject;
name: string;
arguments?: { [key: string]: unknown };
}
Parameters for a tools/call request.
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.
The name of the tool.
Arguments to use for the tool call.
CallToolResult
_meta?: MetaObject;
content: ContentBlock[];
structuredContent?: { [key: string]: unknown };
isError?: boolean;
[key: string]: unknown;
}
The result returned by the server for a tools/call request.
Example: Result with unstructured text
{
“content”: [
{
“type”: “text”,
“text”: “Current weather in New York:\nTemperature: 72°F\nConditions: Partly cloudy”
}
],
“isError”: false
} A list of content objects that represent the unstructured result of the tool call.
An optional JSON object that represents the structured result of the tool call.
Whether the tool call ended in an error.
If not set, this is assumed to be false (the call was successful).
Any errors that originate from the tool SHOULD be reported inside the result
object, with isError set to true, not as an MCP protocol-level error
response. Otherwise, the LLM would not be able to see that an error occurred
and self-correct.
However, any errors in finding the tool, an error indicating that the server does not support tool calls, or any other exceptional conditions, should be reported as an MCP error response.
tools/list
ListToolsRequest
jsonrpc: “2.0”;
id: RequestId;
params?: PaginatedRequestParams;
method: “tools/list”;
}
Sent from the client to request a list of tools the server has.
ListToolsResultResponse
A successful response from the server for a tools/list request.
Example: List tools result response
{
“jsonrpc”: “2.0”,
“id”: “list-tools-example”,
“result”: {
“tools”: [
{
“name”: “get_weather”,
“title”: “Weather Information Provider”,
“description”: “Get current weather information for a location”,
“inputSchema”: {
“type”: “object”,
“properties”: {
“location”: {
“type”: “string”,
“description”: “City name or zip code”
}
},
“required”: [“location”]
},
“icons”: [
{
“src”: “https://example.com/weather-icon.png”,
“mimeType”: “image/png”,
“sizes”: [“48x48”]
}
]
}
],
“nextCursor”: “next-page-cursor”
}
} ListToolsResult
_meta?: MetaObject;
nextCursor?: string;
tools: Tool[];
[key: string]: unknown;
}
The result returned by the server for a tools/list request.
Example: Tools list with cursor
{
“tools”: [
{
“name”: “get_weather”,
“title”: “Weather Information Provider”,
“description”: “Get current weather information for a location”,
“inputSchema”: {
“type”: “object”,
“properties”: {
“location”: {
“type”: “string”,
“description”: “City name or zip code”
}
},
“required”: [“location”]
},
“icons”: [
{
“src”: “https://example.com/weather-icon.png”,
“mimeType”: “image/png”,
“sizes”: [“48x48”]
}
]
}
],
“nextCursor”: “next-page-cursor”
} An opaque token representing the pagination position after the last returned result. If present, there may be more results available.
Tool
icons?: Icon[];
name: string;
title?: string;
description?: string;
inputSchema: {
$schema?: string;
type: “object”;
properties?: { [key: string]: object };
required?: string[];
};
execution?: ToolExecution;
outputSchema?: {
$schema?: string;
type: “object”;
properties?: { [key: string]: object };
required?: string[];
};
annotations?: ToolAnnotations;
_meta?: MetaObject;
}
Definition for a tool the client can call.
Example: With default 2020-12 input schema
{
“name”: “calculate_sum”,
“description”: “Add two numbers”,
“inputSchema”: {
“type”: “object”,
“properties”: {
“a”: { “type”: “number” },
“b”: { “type”: “number” }
},
“required”: [“a”, “b”]
}
} Example: With explicit draft-07 input schema
{
“name”: “calculate_sum”,
“description”: “Add two numbers”,
“inputSchema”: {
“$schema”: “http://json-schema.org/draft-07/schema#”,
“type”: “object”,
“properties”: {
“a”: { “type”: “number” },
“b”: { “type”: “number” }
},
“required”: [“a”, “b”]
}
} Example: With no parameters
{
“name”: “get_current_time”,
“description”: “Returns the current server time”,
“inputSchema”: {
“type”: “object”,
“additionalProperties”: false
}
} Example: With output schema for structured content
{
“name”: “get_weather_data”,
“title”: “Weather Data Retriever”,
“description”: “Get current weather data for a location”,
“inputSchema”: {
“type”: “object”,
“properties”: {
“location”: {
“type”: “string”,
“description”: “City name or zip code”
}
},
“required”: [“location”]
},
“outputSchema”: {
“type”: “object”,
“properties”: {
“temperature”: {
“type”: “number”,
“description”: “Temperature in celsius”
},
“conditions”: {
“type”: “string”,
“description”: “Weather conditions description”
},
“humidity”: {
“type”: “number”,
“description”: “Humidity percentage”
}
},
“required”: [“temperature”, “conditions”, “humidity”]
}
} Optional set of sized icons that the client can display in a user interface.
Clients that support rendering icons MUST support at least the following MIME types:
image/png- PNG images (safe, universal compatibility)image/jpeg(andimage/jpg) - JPEG images (safe, universal compatibility)
Clients that support rendering icons SHOULD also support:
image/svg+xml- SVG images (scalable but requires security precautions)image/webp- WebP images (modern, efficient format)
Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present).
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).
A human-readable description of the tool.
This can be used by clients to improve the LLM’s understanding of available tools. It can be thought of like a “hint” to the model.
A JSON Schema object defining the expected parameters for the tool.
Execution-related properties for this tool.
An optional JSON Schema object defining the structure of the tool’s output returned in the structuredContent field of a CallToolResult.
Defaults to JSON Schema 2020-12 when no explicit $schema is provided.
Currently restricted to type: “object” at the root level.
Optional additional tool information.
Display name precedence order is: title, annotations.title, then name.
ToolAnnotations
title?: string;
readOnlyHint?: boolean;
destructiveHint?: boolean;
idempotentHint?: boolean;
openWorldHint?: boolean;
}
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.
A human-readable title for the tool.
If true, the tool does not modify its environment.
Default: false
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 readOnlyHint == false)
Default: true
If true, calling the tool repeatedly with the same arguments will have no additional effect on its environment.
(This property is meaningful only when readOnlyHint == false)
Default: false
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
ToolExecution
Execution-related properties for a tool.
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”
A response to a request that indicates an error occurred.