Skip to main content

JSON-RPC

JSONRPCErrorResponse

interface JSONRPCErrorResponse {
  jsonrpc: “2.0”;
  id?: RequestId;
  error: Error;
}

A response to a request that indicates an error occurred.

JSONRPCMessage

Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent.

JSONRPCNotification

interface JSONRPCNotification {
  method: string;
  params?: { [key: string]: any };
  jsonrpc: “2.0”;
}

A notification which does not expect a response.

JSONRPCRequest

interface JSONRPCRequest {
  method: string;
  params?: { [key: string]: any };
  jsonrpc: “2.0”;
  id: RequestId;
}

A request that expects a response.

JSONRPCResultResponse

interface JSONRPCResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: Result;
}

A successful (non-error) response to a request.

Common Types

Annotations

interface Annotations {
  audience?: Role[];
  priority?: number;
  lastModified?: string;
}

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.

Cursor

Cursor: string

An opaque token used to represent a cursor for pagination.

EmptyResult

EmptyResult: Result

A result that indicates success but carries no data.

Icon

interface Icon {
  src: string;
  mimeType?: string;
  sizes?: string[];
  theme?: “light” | “dark”;
}

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

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

MetaObject: Record<string, unknown>

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 modelcontextprotocol or mcp, followed by any label, is reserved for MCP use. For example: modelcontextprotocol.io/, mcp.dev/, api.modelcontextprotocol.org/, and tools.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

interface NotificationParams {
  _meta?: MetaObject;
}

Common params for any notification.

PaginatedRequestParams

interface PaginatedRequestParams {
  _meta?: RequestMetaObject;
  cursor?: string;
}

Common params for paginated requests.

Example: List request with cursor
{
“cursor”: “eyJwYWdlIjogMn0=”
}

An opaque token representing the current pagination position. If provided, the server should return results starting after this cursor.

ProgressToken

ProgressToken: string | number

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

RequestId

RequestId: string | number

A uniquely identifying ID for a request in JSON-RPC.

RequestMetaObject

interface RequestMetaObject {
  progressToken?: ProgressToken;
  [key: string]: unknown;
}

Extends MetaObject with additional request-specific fields. All key naming rules from MetaObject apply.

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

interface RequestParams {
  _meta?: RequestMetaObject;
}

Common params for any request.

Result

interface Result {
  _meta?: MetaObject;
  [key: string]: unknown;
}

Common result fields.

Role

Role: “user” | “assistant”

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

Errors

Error

interface Error {
  code: number;
  message: string;
  data?: unknown;
}

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

interface InternalError {
  message: string;
  data?: unknown;
  code: -32603;
}

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.

Example: Unexpected error
{
“code”: -32603,
“message”: “Internal error”
}

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

interface InvalidParamsError {
  message: string;
  data?: unknown;
  code: -32602;
}

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
Example: Unknown tool
{
“code”: -32602,
“message”: “Unknown tool: invalid_tool_name”
}
Example: Invalid tool arguments
{
“code”: -32602,
“message”: “Invalid arguments for tool calculate: Missing required property ‘expression’”
}
Example: Unknown prompt
{
“code”: -32602,
“message”: “Unknown prompt: invalid_prompt_name”
}
Example: Invalid cursor
{
“code”: -32602,
“message”: “Invalid cursor”
}

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

interface InvalidRequestError {
  message: string;
  data?: unknown;
  code: -32600;
}

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

interface MethodNotFoundError {
  message: string;
  data?: unknown;
  code: -32601;
}

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 completions capability 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 roots capability)
Example: Roots not supported
{
“code”: -32601,
“message”: “Roots not supported”,
“data”: {
“reason”: “Client does not have roots capability”
}
}

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

interface ParseError {
  message: string;
  data?: unknown;
  code: -32700;
}

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.

Example: Invalid JSON
{
“code”: -32700,
“message”: “Parse error: Invalid JSON”
}

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

interface AudioContent {
  type: “audio”;
  data: string;
  mimeType: string;
  annotations?: Annotations;
  _meta?: MetaObject;
}

Audio provided to or from an LLM.

Example: `audio/wav` content
{
“type”: “audio”,
“data”: “UklGRiQAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQAAAAA=”,
“mimeType”: “audio/wav”
}

The base64-encoded audio data.

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

Optional annotations for the client.

BlobResourceContents

interface BlobResourceContents {
  uri: string;
  mimeType?: string;
  _meta?: MetaObject;
  blob: string;
}
Example: Image file contents
{
“uri”: “file:///example.png”,
“mimeType”: “image/png”,
“blob”: “iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==”
}

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

ContentBlock:
  | TextContent
  | ImageContent
  | AudioContent
  | ResourceLink
  | EmbeddedResource

EmbeddedResource

interface 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

interface ImageContent {
  type: “image”;
  data: string;
  mimeType: string;
  annotations?: Annotations;
  _meta?: MetaObject;
}

An image provided to or from an LLM.

Example: `image/png` content with annotations
{
“type”: “image”,
“data”: “iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==”,
“mimeType”: “image/png”,
“annotations”: {
“audience”: [“user”],
“priority”: 0.9
}
}

The base64-encoded image data.

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

Optional annotations for the client.

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

Example: File resource link

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 (and image/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

interface TextContent {
  type: “text”;
  text: string;
  annotations?: Annotations;
  _meta?: MetaObject;
}

Text provided to or from an LLM.

Example: Text content
{
“type”: “text”,
“text”: “Tool result text”
}

The text content of the message.

Optional annotations for the client.

TextResourceContents

interface TextResourceContents {
  uri: string;
  mimeType?: string;
  _meta?: MetaObject;
  text: string;
}
Example: Text file contents
{
“uri”: “file:///example.txt”,
“mimeType”: “text/plain”,
“text”: “Resource content”
}

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

interface CompleteRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  method: “completion/complete”;
  params: CompleteRequestParams;
}

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

Example: Completion request
{
“jsonrpc”: “2.0”,
“id”: “completion-example”,
“method”: “completion/complete”,
“params”: {
“ref”: {
“type”: “ref/prompt”,
“name”: “code_review”
},
“argument”: {
“name”: “language”,
“value”: “py”
}
}
}

CompleteRequestParams

interface CompleteRequestParams {
  _meta?: RequestMetaObject;
  ref: PromptReference | ResourceTemplateReference;
  argument: { name: string; value: string };
  context?: { arguments?: { [key: string]: string } };
}

Parameters for a completion/complete request.

Example: Prompt argument completion
{
“ref”: {
“type”: “ref/prompt”,
“name”: “code_review”
},
“argument”: {
“name”: “language”,
“value”: “py”
}
}
Example: Prompt argument completion with context
{
“ref”: {
“type”: “ref/prompt”,
“name”: “code_review”
},
“argument”: {
“name”: “framework”,
“value”: “fla”
},
“context”: {
“arguments”: {
“language”: “python”
}
}
}

The argument’s information

Type Declaration
  • name: string

    The name of the argument

  • value: string

    The value of the argument to use for completion matching.

Additional, optional context for completions

Type Declaration
  • Optionalarguments?: { [key: string]: string }

    Previously-resolved variables in a URI template or prompt.

CompleteResultResponse

interface CompleteResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: CompleteResult;
}

A successful response from the server for a completion/complete request.

Example: Completion result response
{
“jsonrpc”: “2.0”,
“id”: “completion-example”,
“result”: {
“completion”: {
“values”: [“flask”],
“total”: 1,
“hasMore”: false
}
}
}

CompleteResult

interface CompleteResult {
  _meta?: MetaObject;
  completion: { values: string[]; total?: number; hasMore?: boolean };
  [key: string]: unknown;
}

The result returned by the server for a completion/complete request.

Example: Single completion value
{
“completion”: {
“values”: [“flask”],
“total”: 1,
“hasMore”: false
}
}
Example: Multiple completion values with more available
{
“completion”: {
“values”: [“python”, “pytorch”, “pyside”],
“total”: 10,
“hasMore”: true
}
}
Type Declaration
  • values: string[]

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

  • Optionaltotal?: number

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

  • OptionalhasMore?: boolean

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

PromptReference

interface PromptReference {
  name: string;
  title?: string;
  type: “ref/prompt”;
}

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

interface ResourceTemplateReference {
  type: “ref/resource”;
  uri: string;
}

A reference to a resource or resource template definition.

The URI or URI template of the resource.

elicitation/create

ElicitRequest

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

Example: Elicitation request
{
“jsonrpc”: “2.0”,
“id”: “elicitation-example”,
“method”: “elicitation/create”,
“params”: {
“mode”: “form”,
“message”: “Please provide your GitHub username”,
“requestedSchema”: {
“type”: “object”,
“properties”: {
“name”: {
“type”: “string”
}
},
“required”: [“name”]
}
}
}

ElicitRequestParams

The parameters for a request to elicit additional information from the user via the client.

ElicitResultResponse

interface ElicitResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: ElicitResult;
}

A successful response from the client for a elicitation/create request.

Example: Elicitation result response
{
“jsonrpc”: “2.0”,
“id”: “elicitation-example”,
“result”: {
“action”: “accept”,
“content”: {
“name”: “octocat”
}
}
}

ElicitResult

interface 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 single field
{
“action”: “accept”,
“content”: {
“name”: “octocat”
}
}
Example: Input multiple fields
{
“action”: “accept”,
“content”: {
“name”: “Monalisa Octocat”,
“email”: [email protected],
“age”: 30
}
}
Example: Accept URL mode (no content)
{
“action”: “accept”
}

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

interface BooleanSchema {
  type: “boolean”;
  title?: string;
  description?: string;
  default?: boolean;
}
Example: Boolean input schema
{
“type”: “boolean”,
“title”: “Display Name”,
“description”: “Description text”,
“default”: false
}

ElicitRequestFormParams

interface 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

interface 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&#x5F;api&#x5F;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.

LegacyTitledEnumSchema

interface 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

interface NumberSchema {
  type: “number” | “integer”;
  title?: string;
  description?: string;
  minimum?: number;
  maximum?: number;
  default?: number;
}
Example: Number input schema
{
“type”: “number”,
“title”: “Display Name”,
“description”: “Description text”,
“minimum”: 0,
“maximum”: 100,
“default”: 50
}

PrimitiveSchemaDefinition

PrimitiveSchemaDefinition:
  | StringSchema
  | NumberSchema
  | BooleanSchema
  | EnumSchema

Restricted schema definitions that only allow primitive types without nested objects or arrays.

SingleSelectEnumSchema

StringSchema

interface 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

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

Type Declaration
  • anyOf: { const: string; title: string }[]

    Array of enum options with values and display labels.

Optional default value.

TitledSingleSelectEnumSchema

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

Example: Titled color select schema
{
“type”: “string”,
“title”: “Color Selection”,
“description”: “Choose your favorite color”,
“oneOf”: [
{ “const”: “#FF0000”, “title”: “Red” },
{ “const”: “#00FF00”, “title”: “Green” },
{ “const”: “#0000FF”, “title”: “Blue” }
],
“default”: “#FF0000”
}

Optional title for the enum field.

Optional description for the enum field.

Array of enum options with values and display labels.

Type Declaration
  • const: string

    The enum value.

  • title: string

    Display label for this option.

Optional default value.

UntitledMultiSelectEnumSchema

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

Example: Color multi-select schema
{
“type”: “array”,
“title”: “Color Selection”,
“description”: “Choose your favorite colors”,
“minItems”: 1,
“maxItems”: 2,
“items”: {
“type”: “string”,
“enum”: [“Red”, “Green”, “Blue”]
},
“default”: [“Red”, “Green”]
}

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 Declaration
  • type: “string”
  • enum: string[]

    Array of enum values to choose from.

Optional default value.

UntitledSingleSelectEnumSchema

interface UntitledSingleSelectEnumSchema {
  type: “string”;
  title?: string;
  description?: string;
  enum: string[];
  default?: string;
}

Schema for single-selection enumeration without display titles for options.

Example: Color select schema
{
“type”: “string”,
“title”: “Color Selection”,
“description”: “Choose your favorite color”,
“enum”: [“Red”, “Green”, “Blue”],
“default”: “Red”
}

Optional title for the enum field.

Optional description for the enum field.

Array of enum values to choose from.

Optional default value.

initialize

InitializeRequest

interface 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

interface 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

interface InitializeResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: InitializeResult;
}

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

interface 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

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

Type Declaration
  • OptionallistChanged?: boolean

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

Example: Roots — minimum baseline support
{
“roots”: {}
}
Example: Roots — list changed notifications
{
“roots”: {
“listChanged”: true
}
}

Present if the client supports sampling from an LLM.

Type Declaration
  • Optionalcontext?: object

    Whether the client supports context inclusion via includeContext parameter. If not declared, servers SHOULD only use includeContext: “none” (or omit it).

  • Optionaltools?: object

    Whether the client supports tool use via tools and toolChoice parameters.

Example: Sampling — minimum baseline support
{
“sampling”: {}
}
Example: Sampling — tool use support
{
“sampling”: {
“tools”: {}
}
}
Example: Sampling — context inclusion support (soft-deprecated)
{
“sampling”: {
“context”: {}
}
}

Present if the client supports elicitation from the server.

Example: Elicitation — form and URL mode support
{
“elicitation”: {
“form”: {},
“url”: {}
}
}
Example: Elicitation — form mode only (implicit)
{
“elicitation”: {}
}

Present if the client supports task-augmented requests.

Type Declaration
  • Optionallist?: object

    Whether this client supports tasks/list.

  • Optionalcancel?: object

    Whether 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?: object

        Whether the client supports task-augmented sampling/createMessage requests.

    • Optionalelicitation?: { create?: object }

      Task support for elicitation-related requests.

      • Optionalcreate?: object

        Whether the client supports task-augmented elicitation/create requests.

Implementation

interface 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 (and image/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

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

Example: Logging — minimum baseline support
{
“logging”: {}
}

Present if the server supports argument autocompletion suggestions.

Example: Completions — minimum baseline support
{
“completions”: {}
}

Present if the server offers any prompt templates.

Type Declaration
  • OptionallistChanged?: boolean

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

Example: Prompts — minimum baseline support
{
“prompts”: {}
}
Example: Prompts — list changed notifications
{
“prompts”: {
“listChanged”: true
}
}

Present if the server offers any resources to read.

Type Declaration
  • Optionalsubscribe?: boolean

    Whether this server supports subscribing to resource updates.

  • OptionallistChanged?: boolean

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

Example: Resources — minimum baseline support
{
“resources”: {}
}
Example: Resources — subscription to individual resource updates (only)
{
“resources”: {
“subscribe”: true
}
}
Example: Resources — list changed notifications (only)
{
“resources”: {
“listChanged”: true
}
}
Example: Resources — all notifications
{
“resources”: {
“subscribe”: true,
“listChanged”: true
}
}

Present if the server offers any tools to call.

Type Declaration
  • OptionallistChanged?: boolean

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

Example: Tools — minimum baseline support
{
“tools”: {}
}
Example: Tools — list changed notifications
{
“tools”: {
“listChanged”: true
}
}

Present if the server supports task-augmented requests.

Type Declaration
  • Optionallist?: object

    Whether this server supports tasks/list.

  • Optionalcancel?: object

    Whether 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?: object

        Whether the server supports task-augmented tools/call requests.

logging/setLevel

SetLevelRequest

interface SetLevelRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  method: “logging/setLevel”;
  params: SetLevelRequestParams;
}

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

Example: Set logging level request
{
“jsonrpc”: “2.0”,
“id”: “set-logging-level-example”,
“method”: “logging/setLevel”,
“params”: {
“level”: “info”
}
}

SetLevelRequestParams

interface SetLevelRequestParams {
  _meta?: RequestMetaObject;
  level: LoggingLevel;
}

Parameters for a logging/setLevel request.

Example: Set log level to “info”
{
“level”: “info”
}

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.

SetLevelResultResponse

interface SetLevelResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: Result;
}

A successful response from the server for a logging/setLevel request.

Example: Set logging level result response
{
“jsonrpc”: “2.0”,
“id”: “set-logging-level-example”,
“result”: {}
}

notifications/cancelled

CancelledNotification

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

Example: User-requested cancellation
{
“jsonrpc”: “2.0”,
“method”: “notifications/cancelled”,
“params”: {
“requestId”: “123”,
“reason”: “User requested cancellation”
}
}

CancelledNotificationParams

interface CancelledNotificationParams {
  _meta?: MetaObject;
  requestId?: RequestId;
  reason?: string;
}

Parameters for a notifications/cancelled notification.

Example: User-requested cancellation
{
“requestId”: “123”,
“reason”: “User requested cancellation”
}

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

interface InitializedNotification {
  jsonrpc: “2.0”;
  method: “notifications/initialized”;
  params?: NotificationParams;
}

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

Example: Initialized notification
{
“jsonrpc”: “2.0”,
“method”: “notifications/initialized”
}

notifications/tasks/status

TaskStatusNotification

interface 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

TaskStatusNotificationParams: NotificationParams & Task

Parameters for a notifications/tasks/status notification.

notifications/message

LoggingMessageNotification

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

Example: Log database connection failed
{
“jsonrpc”: “2.0”,
“method”: “notifications/message”,
“params”: {
“level”: “error”,
“logger”: “database”,
“data”: {
“error”: “Connection failed”,
“details”: {
“host”: “localhost”,
“port”: 5432
}
}
}
}

LoggingMessageNotificationParams

interface LoggingMessageNotificationParams {
  _meta?: MetaObject;
  level: LoggingLevel;
  logger?: string;
  data: unknown;
}

Parameters for a notifications/message notification.

Example: Log database connection failed
{
“level”: “error”,
“logger”: “database”,
“data”: {
“error”: “Connection failed”,
“details”: {
“host”: “localhost”,
“port”: 5432
}
}
}

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

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

Example: Progress message
{
“jsonrpc”: “2.0”,
“method”: “notifications/progress”,
“params”: {
“progressToken”: “oivaizmir”,
“progress”: 50,
“total”: 100,
“message”: “Reticulating splines…”
}
}

ProgressNotificationParams

interface ProgressNotificationParams {
  _meta?: MetaObject;
  progressToken: ProgressToken;
  progress: number;
  total?: number;
  message?: string;
}

Parameters for a notifications/progress notification.

Example: Progress message
{
“progressToken”: “oivaizmir”,
“progress”: 50,
“total”: 100,
“message”: “Reticulating splines…”
}

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

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

Example: Prompts list changed
{
“jsonrpc”: “2.0”,
“method”: “notifications/prompts/list_changed”
}

notifications/resources/list_changed

ResourceListChangedNotification

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

Example: Resources list changed
{
“jsonrpc”: “2.0”,
“method”: “notifications/resources/list_changed”
}

notifications/resources/updated

ResourceUpdatedNotification

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

Example: File resource updated notification
{
“jsonrpc”: “2.0”,
“method”: “notifications/resources/updated”,
“params”: {
“uri”: “file:///project/src/main.rs”
}
}

ResourceUpdatedNotificationParams

interface ResourceUpdatedNotificationParams {
  _meta?: MetaObject;
  uri: string;
}

Parameters for a notifications/resources/updated notification.

Example: File resource updated
{
“uri”: “file:///project/src/main.rs”
}

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

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

Example: Roots list changed
{
“jsonrpc”: “2.0”,
“method”: “notifications/roots/list_changed”
}

notifications/tools/list_changed

ToolListChangedNotification

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

Example: Tools list changed
{
“jsonrpc”: “2.0”,
“method”: “notifications/tools/list_changed”
}

notifications/elicitation/complete

ElicitationCompleteNotification

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

Example: Elicitation complete
{
“jsonrpc”: “2.0”,
“method”: “notifications/elicitation/complete”,
“params”: {
“elicitationId”: “550e8400-e29b-41d4-a716-446655440000”
}
}
Type Declaration
  • elicitationId: string

    The ID of the elicitation that completed.

ping

PingRequest

interface PingRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  method: “ping”;
  params?: RequestParams;
}

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.

Example: Ping request
{
“jsonrpc”: “2.0”,
“id”: “ping-example”,
“method”: “ping”
}

PingResultResponse

interface PingResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: Result;
}

A successful response for a ping request.

Example: Ping result response
{
“jsonrpc”: “2.0”,
“id”: “ping-example”,
“result”: {}
}

tasks

CreateTaskResultResponse

interface CreateTaskResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: CreateTaskResult;
}

A successful response for a task-augmented request.

CreateTaskResult

interface CreateTaskResult {
  _meta?: MetaObject;
  task: Task;
  [key: string]: unknown;
}

The result returned for a task-augmented request.

RelatedTaskMetadata

interface RelatedTaskMetadata {
  taskId: string;
}

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

interface 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

interface TaskMetadata {
  ttl?: number;
}

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

TaskStatus: “working” | “input_required” | “completed” | “failed” | “cancelled”

The status of a task.

tasks/get

GetTaskRequest

interface GetTaskRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  method: “tasks/get”;
  params: { taskId: string };
}

A request to retrieve the state of a task.

Type Declaration
  • taskId: string

    The task identifier to query.

GetTaskResultResponse

interface GetTaskResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: GetTaskResult;
}

A successful response for a tasks/get request.

GetTaskResult

GetTaskResult: Result & Task

The result returned for a tasks/get request.

tasks/result

GetTaskPayloadRequest

interface GetTaskPayloadRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  method: “tasks/result”;
  params: { taskId: string };
}

A request to retrieve the result of a completed task.

Type Declaration
  • taskId: string

    The task identifier to retrieve results for.

GetTaskPayloadResultResponse

interface GetTaskPayloadResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: GetTaskPayloadResult;
}

A successful response for a tasks/result request.

GetTaskPayloadResult

interface GetTaskPayloadResult {
  _meta?: MetaObject;
  [key: string]: unknown;
}

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

interface ListTasksRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  params?: PaginatedRequestParams;
  method: “tasks/list”;
}

A request to retrieve a list of tasks.

ListTasksResultResponse

interface ListTasksResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: ListTasksResult;
}

A successful response for a tasks/list request.

ListTasksResult

interface 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

interface CancelTaskRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  method: “tasks/cancel”;
  params: { taskId: string };
}

A request to cancel a task.

Type Declaration
  • taskId: string

    The task identifier to cancel.

CancelTaskResultResponse

interface CancelTaskResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: CancelTaskResult;
}

A successful response for a tasks/cancel request.

CancelTaskResult

CancelTaskResult: Result & Task

The result returned for a tasks/cancel request.

prompts/get

GetPromptRequest

interface GetPromptRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  method: “prompts/get”;
  params: GetPromptRequestParams;
}

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

Example: Get prompt request
{
“jsonrpc”: “2.0”,
“id”: “get-prompt-example”,
“method”: “prompts/get”,
“params”: {
“name”: “code_review”,
“arguments”: {
“code”: “def hello():\n print(‘world’)”
}
}
}

GetPromptRequestParams

interface GetPromptRequestParams {
  _meta?: RequestMetaObject;
  name: string;
  arguments?: { [key: string]: string };
}

Parameters for a prompts/get request.

Example: Get code review prompt
{
“name”: “code_review”,
“arguments”: {
“code”: “def hello():\n print(‘world’)”
}
}

The name of the prompt or prompt template.

Arguments to use for templating the prompt.

GetPromptResultResponse

interface GetPromptResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: GetPromptResult;
}

A successful response from the server for a prompts/get request.

Example: Get prompt result response
{
“jsonrpc”: “2.0”,
“id”: “get-prompt-example”,
“result”: {
“description”: “Code review prompt”,
“messages”: [
{
“role”: “user”,
“content”: {
“type”: “text”,
“text”: “Please review this Python code:\ndef hello():\n print(‘world’)”
}
}
]
}
}

GetPromptResult

interface GetPromptResult {
  _meta?: MetaObject;
  description?: string;
  messages: PromptMessage[];
  [key: string]: unknown;
}

The result returned by the server for a prompts/get request.

Example: Code review prompt
{
“description”: “Code review prompt”,
“messages”: [
{
“role”: “user”,
“content”: {
“type”: “text”,
“text”: “Please review this Python code:\ndef hello():\n print(‘world’)”
}
}
]
}

An optional description for the prompt.

PromptMessage

interface PromptMessage {
  role: Role;
  content: ContentBlock;
}

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

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

Example: List prompts request
{
“jsonrpc”: “2.0”,
“id”: “list-prompts-example”,
“method”: “prompts/list”
}

ListPromptsResultResponse

interface ListPromptsResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: ListPromptsResult;
}

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

interface 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

interface 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 (and image/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

interface PromptArgument {
  name: string;
  title?: string;
  description?: string;
  required?: boolean;
}

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

interface ListResourcesRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  params?: PaginatedRequestParams;
  method: “resources/list”;
}

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

Example: List resources request
{
“jsonrpc”: “2.0”,
“id”: “list-resources-example”,
“method”: “resources/list”
}

ListResourcesResultResponse

interface 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

interface 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

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

Example: File resource with annotations
{
“uri”: “file:///project/README.md”,
“name”: “README.md”,
“title”: “Project Documentation”,
“mimeType”: “text/markdown”,
“annotations”: {
“audience”: [“user”],
“priority”: 0.8,
“lastModified”: “2025-01-12T15:00:58Z”
}
}

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 (and image/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

interface ReadResourceRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  method: “resources/read”;
  params: ReadResourceRequestParams;
}

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

Example: Read resource request
{
“jsonrpc”: “2.0”,
“id”: “read-resource-example”,
“method”: “resources/read”,
“params”: {
“uri”: “file:///project/src/main.rs”
}
}

ReadResourceRequestParams

interface ReadResourceRequestParams {
  _meta?: RequestMetaObject;
  uri: string;
}

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.

ReadResourceResultResponse

interface ReadResourceResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: ReadResourceResult;
}

A successful response from the server for a resources/read request.

Example: Read resource result response
{
“jsonrpc”: “2.0”,
“id”: “read-resource-example”,
“result”: {
“contents”: [
{
“uri”: “file:///project/src/main.rs”,
“mimeType”: “text/x-rust”,
“text”: “fn main() {\n println!(\“Hello world!\”);\n}”
}
]
}
}

ReadResourceResult

interface ReadResourceResult {
  _meta?: MetaObject;
  contents: (TextResourceContents | BlobResourceContents)[];
  [key: string]: unknown;
}

The result returned by the server for a resources/read request.

Example: File resource contents
{
“contents”: [
{
“uri”: “file:///project/src/main.rs”,
“mimeType”: “text/x-rust”,
“text”: “fn main() {\n println!(\“Hello world!\”);\n}”
}
]
}

resources/subscribe

SubscribeRequest

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

Example: Subscribe request
{
“jsonrpc”: “2.0”,
“id”: “subscribe-example”,
“method”: “resources/subscribe”,
“params”: {
“uri”: “file:///project/src/main.rs”
}
}

SubscribeRequestParams

interface SubscribeRequestParams {
  _meta?: RequestMetaObject;
  uri: string;
}

Parameters for a resources/subscribe request.

Example: Subscribe to file resource
{
“uri”: “file:///project/src/main.rs”
}

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

SubscribeResultResponse

interface SubscribeResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: Result;
}

A successful response from the server for a resources/subscribe request.

Example: Subscribe result response
{
“jsonrpc”: “2.0”,
“id”: “subscribe-example”,
“result”: {}
}

resources/templates/list

ListResourceTemplatesRequest

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

Example: List resource templates request
{
“jsonrpc”: “2.0”,
“id”: “list-resource-templates-example”,
“method”: “resources/templates/list”
}

ListResourceTemplatesResultResponse

interface 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

interface 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

interface 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 (and image/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

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

Example: Unsubscribe request
{
“jsonrpc”: “2.0”,
“id”: “unsubscribe-example”,
“method”: “resources/unsubscribe”,
“params”: {
“uri”: “file:///project/src/main.rs”
}
}

UnsubscribeRequestParams

interface UnsubscribeRequestParams {
  _meta?: RequestMetaObject;
  uri: string;
}

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.

UnsubscribeResultResponse

interface UnsubscribeResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: Result;
}

A successful response from the server for a resources/unsubscribe request.

Example: Unsubscribe result response
{
“jsonrpc”: “2.0”,
“id”: “unsubscribe-example”,
“result”: {}
}

roots/list

ListRootsRequest

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

Example: List roots request
{
“jsonrpc”: “2.0”,
“id”: “list-roots-example”,
“method”: “roots/list”
}

ListRootsResultResponse

interface ListRootsResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: ListRootsResult;
}

A successful response from the client for a roots/list request.

Example: List roots result response
{
“jsonrpc”: “2.0”,
“id”: “list-roots-example”,
“result”: {
“roots”: [
{
“uri”: “file:///home/user/projects/myproject”,
“name”: “My Project”
}
]
}
}

ListRootsResult

interface ListRootsResult {
  _meta?: MetaObject;
  roots: Root[];
  [key: string]: unknown;
}

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.

Example: Single root directory
{
“roots”: [
{
“uri”: “file:///home/user/projects/myproject”,
“name”: “My Project”
}
]
}
Example: Multiple root directories
{
“roots”: [
{
“uri”: “file:///home/user/repos/frontend”,
“name”: “Frontend Repository”
},
{
“uri”: “file:///home/user/repos/backend”,
“name”: “Backend Repository”
}
]
}

Root

interface Root {
  uri: string;
  name?: string;
  _meta?: MetaObject;
}

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

Example: Project directory root
{
“uri”: “file:///home/user/projects/myproject”,
“name”: “My Project”
}

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

interface 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

interface 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

interface CreateMessageResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: CreateMessageResult;
}

A successful response from the client for a sampling/createMessage request.

Example: Sampling result response
{
“jsonrpc”: “2.0”,
“id”: “sampling-example”,
“result”: {
“role”: “assistant”,
“content”: {
“type”: “text”,
“text”: “The capital of France is Paris.”
},
“model”: “claude-3-sonnet-20240307”,
“stopReason”: “endTurn”
}
}

CreateMessageResult

interface 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

interface ModelHint {
  name?: string;
}

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-sonnet should match claude-3-5-sonnet-20241022
  • sonnet should match claude-3-5-sonnet-20241022, claude-3-sonnet-20240229, etc.
  • claude should 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-flash could match claude-3-haiku-20240307

ModelPreferences

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

Example: With hints and priorities
{
“hints”: [
{ “name”: “claude-3-sonnet” },
{ “name”: “claude” }
],
“costPriority”: 0.3,
“speedPriority”: 0.8,
“intelligencePriority”: 0.5
}

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

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

Example: Single content block
{
“role”: “user”,
“content”: {
“type”: “text”,
“text”: “What is the capital of France?”
}
}
Example: Multiple content blocks
{
“role”: “user”,
“content”: [
{
“type”: “tool_result”,
“toolUseId”: “call_123”,
“content”: [{ “type”: “text”, “text”: “Result 1” }]
},
{
“type”: “tool_result”,
“toolUseId”: “call_456”,
“content”: [{ “type”: “text”, “text”: “Result 2” }]
}
]
}

ToolChoice

interface ToolChoice {
  mode?: “none” | “required” | “auto”;
}

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

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

Example: `get_weather` tool result
{
“type”: “tool_result”,
“toolUseId”: “call_abc123”,
“content”: [
{
“type”: “text”,
“text”: “Weather in Paris: 18°C, partly cloudy”
}
]
}

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

interface ToolUseContent {
  type: “tool_use”;
  id: string;
  name: string;
  input: { [key: string]: unknown };
  _meta?: MetaObject;
}

A request from the assistant to call a tool.

Example: `get_weather` tool use
{
“type”: “tool_use”,
“id”: “call_abc123”,
“name”: “get_weather”,
“input”: {
“city”: “Paris”
}
}

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

interface CallToolRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  method: “tools/call”;
  params: CallToolRequestParams;
}

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

Example: Call tool request
{
“jsonrpc”: “2.0”,
“id”: “call-tool-example”,
“method”: “tools/call”,
“params”: {
“name”: “get_weather”,
“arguments”: {
“location”: “New York”
}
}
}

CallToolRequestParams

interface CallToolRequestParams {
  task?: TaskMetadata;
  _meta?: RequestMetaObject;
  name: string;
  arguments?: { [key: string]: unknown };
}

Parameters for a tools/call request.

Example: `get_weather` tool call params
{
“name”: “get_weather”,
“arguments”: {
“location”: “New York”
}
}
Example: Tool call params with progress token
{
“_meta”: {
“progressToken”: “oivaizmir”
},
“name”: “build_simulation”,
“arguments”: {
“city”: “Micropolis”
}
}

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.

CallToolResultResponse

interface CallToolResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: CallToolResult;
}

A successful response from the server for a tools/call request.

Example: Call tool result response
{
“jsonrpc”: “2.0”,
“id”: “call-tool-example”,
“result”: {
“content”: [
{
“type”: “text”,
“text”: “Current weather in New York:\nTemperature: 72°F\nConditions: Partly cloudy”
}
],
“isError”: false
}
}

CallToolResult

interface 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
}
Example: Result with structured content
{
“content”: [
{
“type”: “text”,
“text”: ”{\“temperature\”: 22.5, \“conditions\”: \“Partly cloudy\”, \“humidity\”: 65}”
}
],
“structuredContent”: {
“temperature”: 22.5,
“conditions”: “Partly cloudy”,
“humidity”: 65
}
}
Example: Invalid tool input error
{
“content”: [
{
“type”: “text”,
“text”: “Invalid departure date: must be in the future. Current date is 08/08/2025.”
}
],
“isError”: true
}

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

interface ListToolsRequest {
  jsonrpc: “2.0”;
  id: RequestId;
  params?: PaginatedRequestParams;
  method: “tools/list”;
}

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

Example: List tools request
{
“jsonrpc”: “2.0”,
“id”: “list-tools-example”,
“method”: “tools/list”
}

ListToolsResultResponse

interface ListToolsResultResponse {
  jsonrpc: “2.0”;
  id: RequestId;
  result: ListToolsResult;
}

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

interface 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

interface 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 (and image/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

interface 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

interface ToolExecution {
  taskSupport?: “forbidden” | “optional” | “required”;
}

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”