Skip to main content

JSON-RPC

JSONRPCError

interface JSONRPCError {
  jsonrpc: “2.0”;
  id: RequestId;
  error: { code: number; message: string; data?: unknown };
}

A response to a request that indicates an error occurred.

Type Declaration
  • code: number

    The error type that occurred.

  • message: string

    A short description of the error. The message SHOULD be limited to a concise single sentence.

  • Optionaldata?: unknown

    Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.).

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?: { _meta?: { [key: string]: unknown }; [key: string]: unknown };
  jsonrpc: “2.0”;
}

A notification which does not expect a response.

Type Declaration
  • [key: string]: unknown
  • Optional_meta?: { [key: string]: unknown }

    See General fields: _meta for notes on _meta usage.

JSONRPCRequest

interface JSONRPCRequest {
  method: string;
  params?: {
    _meta?: { progressToken?: ProgressToken; [key: string]: unknown };
    [key: string]: unknown;
  };
  jsonrpc: “2.0”;
  id: RequestId;
}

A request that expects a response.

Type Declaration
  • [key: string]: unknown
  • Optional_meta?: { progressToken?: ProgressToken; [key: string]: unknown }

    See General fields: _meta for notes on _meta usage.

    • OptionalprogressToken?: ProgressToken

      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.

JSONRPCResponse

interface JSONRPCResponse {
  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 customer 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 response that indicates success but carries no data.

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

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.

Result

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

See General fields: _meta for notes on _meta usage.

Role

Role: “user” | “assistant”

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

Content

AudioContent

interface AudioContent {
  type: “audio”;
  data: string;
  mimeType: string;
  annotations?: Annotations;
  _meta?: { [key: string]: unknown };
}

Audio provided to or from an LLM.

The base64-encoded audio data.

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

Optional annotations for the client.

See General fields: _meta for notes on _meta usage.

BlobResourceContents

interface BlobResourceContents {
  uri: string;
  mimeType?: string;
  _meta?: { [key: string]: unknown };
  blob: string;
}

The URI of this resource.

The MIME type of this resource, if known.

See General fields: _meta for notes on _meta usage.

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?: { [key: string]: unknown };
}

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.

Optional annotations for the client.

See General fields: _meta for notes on _meta usage.

ImageContent

interface ImageContent {
  type: “image”;
  data: string;
  mimeType: string;
  annotations?: Annotations;
  _meta?: { [key: string]: unknown };
}

An image provided to or from an LLM.

The base64-encoded image data.

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

Optional annotations for the client.

See General fields: _meta for notes on _meta usage.

interface ResourceLink {
  name: string;
  title?: string;
  uri: string;
  description?: string;
  mimeType?: string;
  annotations?: Annotations;
  size?: number;
  _meta?: { [key: string]: unknown };
  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.

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.

See General fields: _meta for notes on _meta usage.

TextContent

interface TextContent {
  type: “text”;
  text: string;
  annotations?: Annotations;
  _meta?: { [key: string]: unknown };
}

Text provided to or from an LLM.

The text content of the message.

Optional annotations for the client.

See General fields: _meta for notes on _meta usage.

TextResourceContents

interface TextResourceContents {
  uri: string;
  mimeType?: string;
  _meta?: { [key: string]: unknown };
  text: string;
}

The URI of this resource.

The MIME type of this resource, if known.

See General fields: _meta for notes on _meta usage.

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 {
  method: “completion/complete”;
  params: {
    ref: PromptReference | ResourceTemplateReference;
    argument: { name: string; value: string };
    context?: { arguments?: { [key: string]: string } };
  };
}

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

Type Declaration
  • argument: { name: string; value: string }

    The argument’s information

    • name: string

      The name of the argument

    • value: string

      The value of the argument to use for completion matching.

  • Optionalcontext?: { arguments?: { [key: string]: string } }

    Additional, optional context for completions

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

      Previously-resolved variables in a URI template or prompt.

CompleteResult

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

The server’s response to a completion/complete request

See General fields: _meta for notes on _meta usage.

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 {
  method: “elicitation/create”;
  params: {
    message: string;
    requestedSchema: {
      type: “object”;
      properties: { [key: string]: PrimitiveSchemaDefinition };
      required?: string[];
    };
  };
}

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

Type Declaration
  • message: string

    The message to present to the user.

  • requestedSchema: {
      type: “object”;
      properties: { [key: string]: PrimitiveSchemaDefinition };
      required?: string[];
    }

    A restricted subset of JSON Schema. Only top-level properties are allowed, without nesting.

ElicitResult

interface ElicitResult {
  _meta?: { [key: string]: unknown };
  action: “accept” | “decline” | “cancel”;
  content?: { [key: string]: string | number | boolean };
  [key: string]: unknown;
}

The client’s response to an elicitation request.

See General fields: _meta for notes on _meta usage.

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”. Contains values matching the requested schema.

BooleanSchema

interface BooleanSchema {
  type: “boolean”;
  title?: string;
  description?: string;
  default?: boolean;
}

EnumSchema

interface EnumSchema {
  type: “string”;
  title?: string;
  description?: string;
  enum: string[];
  enumNames?: string[];
}

NumberSchema

interface NumberSchema {
  type: “number” | “integer”;
  title?: string;
  description?: string;
  minimum?: number;
  maximum?: number;
}

PrimitiveSchemaDefinition

PrimitiveSchemaDefinition:
  | StringSchema
  | NumberSchema
  | BooleanSchema
  | EnumSchema

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

StringSchema

interface StringSchema {
  type: “string”;
  title?: string;
  description?: string;
  minLength?: number;
  maxLength?: number;
  format?: “uri” | “email” | “date” | “date-time”;
}

initialize

InitializeRequest

interface InitializeRequest {
  method: “initialize”;
  params: {
    protocolVersion: string;
    capabilities: ClientCapabilities;
    clientInfo: Implementation;
  };
}

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

Type Declaration
  • protocolVersion: string

    The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.

  • capabilities: ClientCapabilities
  • clientInfo: Implementation

InitializeResult

interface InitializeResult {
  _meta?: { [key: string]: unknown };
  protocolVersion: string;
  capabilities: ServerCapabilities;
  serverInfo: Implementation;
  instructions?: string;
  [key: string]: unknown;
}

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

See General fields: _meta for notes on _meta usage.

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?: object;
  elicitation?: 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.

Present if the client supports sampling from an LLM.

Present if the client supports elicitation from the server.

Implementation

interface Implementation {
  name: string;
  title?: string;
  version: string;
}

Describes the name and version of an MCP implementation, with an optional title for UI representation.

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

ServerCapabilities

interface ServerCapabilities {
  experimental?: { [key: string]: object };
  logging?: object;
  completions?: object;
  prompts?: { listChanged?: boolean };
  resources?: { subscribe?: boolean; listChanged?: boolean };
  tools?: { listChanged?: boolean };
}

Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.

Experimental, non-standard capabilities that the server supports.

Present if the server supports sending log messages to the client.

Present if the server supports argument autocompletion suggestions.

Present if the server offers any prompt templates.

Type Declaration
  • OptionallistChanged?: boolean

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

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.

Present if the server offers any tools to call.

Type Declaration
  • OptionallistChanged?: boolean

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

logging/setLevel

SetLevelRequest

interface SetLevelRequest {
  method: “logging/setLevel”;
  params: { level: LoggingLevel };
}

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

Type Declaration
  • The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message.

notifications/cancelled

CancelledNotification

interface CancelledNotification {
  method: “notifications/cancelled”;
  params: { requestId: RequestId; reason?: string };
}

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.

Type Declaration
  • requestId: RequestId

    The ID of the request to cancel.

    This MUST correspond to the ID of a request previously issued in the same direction.

  • Optionalreason?: string

    An optional string describing the reason for the cancellation. This MAY be logged or presented to the user.

notifications/initialized

InitializedNotification

interface InitializedNotification {
  params?: { _meta?: { [key: string]: unknown }; [key: string]: unknown };
  method: “notifications/initialized”;
}

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

Type Declaration
  • [key: string]: unknown
  • Optional_meta?: { [key: string]: unknown }

    See General fields: _meta for notes on _meta usage.

notifications/message

LoggingMessageNotification

interface LoggingMessageNotification {
  method: “notifications/message”;
  params: { level: LoggingLevel; logger?: string; data: unknown };
}

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

Type Declaration
  • The severity of this log message.

  • Optionallogger?: string

    An optional name of the logger issuing this message.

  • data: unknown

    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 {
  method: “notifications/progress”;
  params: {
    progressToken: ProgressToken;
    progress: number;
    total?: number;
    message?: string;
  };
}

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

Type Declaration
  • progressToken: ProgressToken

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

  • progress: number

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

  • Optionaltotal?: number

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

  • Optionalmessage?: string

    An optional message describing the current progress.

notifications/prompts/list_changed

PromptListChangedNotification

interface PromptListChangedNotification {
  params?: { _meta?: { [key: string]: unknown }; [key: string]: unknown };
  method: “notifications/prompts/list_changed”;
}

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.

Type Declaration
  • [key: string]: unknown
  • Optional_meta?: { [key: string]: unknown }

    See General fields: _meta for notes on _meta usage.

notifications/resources/list_changed

ResourceListChangedNotification

interface ResourceListChangedNotification {
  params?: { _meta?: { [key: string]: unknown }; [key: string]: unknown };
  method: “notifications/resources/list_changed”;
}

An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client.

Type Declaration
  • [key: string]: unknown
  • Optional_meta?: { [key: string]: unknown }

    See General fields: _meta for notes on _meta usage.

notifications/resources/updated

ResourceUpdatedNotification

interface ResourceUpdatedNotification {
  method: “notifications/resources/updated”;
  params: { uri: string };
}

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.

Type Declaration
  • uri: string

    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 {
  params?: { _meta?: { [key: string]: unknown }; [key: string]: unknown };
  method: “notifications/roots/list_changed”;
}

A notification from the client to the server, informing it that the list of roots has changed. This notification should be sent whenever the client adds, removes, or modifies any root. The server should then request an updated list of roots using the ListRootsRequest.

Type Declaration
  • [key: string]: unknown
  • Optional_meta?: { [key: string]: unknown }

    See General fields: _meta for notes on _meta usage.

notifications/tools/list_changed

ToolListChangedNotification

interface ToolListChangedNotification {
  params?: { _meta?: { [key: string]: unknown }; [key: string]: unknown };
  method: “notifications/tools/list_changed”;
}

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.

Type Declaration
  • [key: string]: unknown
  • Optional_meta?: { [key: string]: unknown }

    See General fields: _meta for notes on _meta usage.

ping

PingRequest

interface PingRequest {
  params?: {
    _meta?: { progressToken?: ProgressToken; [key: string]: unknown };
    [key: string]: unknown;
  };
  method: “ping”;
}

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

Type Declaration
  • [key: string]: unknown
  • Optional_meta?: { progressToken?: ProgressToken; [key: string]: unknown }

    See General fields: _meta for notes on _meta usage.

    • OptionalprogressToken?: ProgressToken

      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.

prompts/get

GetPromptRequest

interface GetPromptRequest {
  method: “prompts/get”;
  params: { name: string; arguments?: { [key: string]: string } };
}

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

Type Declaration
  • name: string

    The name of the prompt or prompt template.

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

    Arguments to use for templating the prompt.

GetPromptResult

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

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

See General fields: _meta for notes on _meta usage.

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 {
  params?: { cursor?: string };
  method: “prompts/list”;
}

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

Type Declaration
  • Optionalcursor?: string

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

ListPromptsResult

interface ListPromptsResult {
  _meta?: { [key: string]: unknown };
  nextCursor?: string;
  prompts: Prompt[];
  [key: string]: unknown;
}

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

See General fields: _meta for notes on _meta usage.

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

Prompt

interface Prompt {
  name: string;
  title?: string;
  description?: string;
  arguments?: PromptArgument[];
  _meta?: { [key: string]: unknown };
}

A prompt or prompt template that the server offers.

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.

See General fields: _meta for notes on _meta usage.

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 {
  params?: { cursor?: string };
  method: “resources/list”;
}

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

Type Declaration
  • Optionalcursor?: string

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

ListResourcesResult

interface ListResourcesResult {
  _meta?: { [key: string]: unknown };
  nextCursor?: string;
  resources: Resource[];
  [key: string]: unknown;
}

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

See General fields: _meta for notes on _meta usage.

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

Resource

interface Resource {
  name: string;
  title?: string;
  uri: string;
  description?: string;
  mimeType?: string;
  annotations?: Annotations;
  size?: number;
  _meta?: { [key: string]: unknown };
}

A known resource that the server is capable of reading.

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.

See General fields: _meta for notes on _meta usage.

resources/read

ReadResourceRequest

interface ReadResourceRequest {
  method: “resources/read”;
  params: { uri: string };
}

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

Type Declaration
  • uri: string

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

ReadResourceResult

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

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

See General fields: _meta for notes on _meta usage.

resources/subscribe

SubscribeRequest

interface SubscribeRequest {
  method: “resources/subscribe”;
  params: { uri: string };
}

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

Type Declaration
  • uri: string

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

resources/templates/list

ListResourceTemplatesRequest

interface ListResourceTemplatesRequest {
  params?: { cursor?: string };
  method: “resources/templates/list”;
}

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

Type Declaration
  • Optionalcursor?: string

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

ListResourceTemplatesResult

interface ListResourceTemplatesResult {
  _meta?: { [key: string]: unknown };
  nextCursor?: string;
  resourceTemplates: ResourceTemplate[];
  [key: string]: unknown;
}

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

See General fields: _meta for notes on _meta usage.

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

ResourceTemplate

interface ResourceTemplate {
  name: string;
  title?: string;
  uriTemplate: string;
  description?: string;
  mimeType?: string;
  annotations?: Annotations;
  _meta?: { [key: string]: unknown };
}

A template description for resources available on the server.

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.

See General fields: _meta for notes on _meta usage.

resources/unsubscribe

UnsubscribeRequest

interface UnsubscribeRequest {
  method: “resources/unsubscribe”;
  params: { uri: string };
}

Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request.

Type Declaration
  • uri: string

    The URI of the resource to unsubscribe from.

roots/list

ListRootsRequest

interface ListRootsRequest {
  params?: {
    _meta?: { progressToken?: ProgressToken; [key: string]: unknown };
    [key: string]: unknown;
  };
  method: “roots/list”;
}

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

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

Type Declaration
  • [key: string]: unknown
  • Optional_meta?: { progressToken?: ProgressToken; [key: string]: unknown }

    See General fields: _meta for notes on _meta usage.

    • OptionalprogressToken?: ProgressToken

      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.

ListRootsResult

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

The client’s response to a roots/list request from the server. This result contains an array of Root objects, each representing a root directory or file that the server can operate on.

See General fields: _meta for notes on _meta usage.

Root

interface Root {
  uri: string;
  name?: string;
  _meta?: { [key: string]: unknown };
}

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

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

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

See General fields: _meta for notes on _meta usage.

sampling/createMessage

CreateMessageRequest

interface CreateMessageRequest {
  method: “sampling/createMessage”;
  params: {
    messages: SamplingMessage[];
    modelPreferences?: ModelPreferences;
    systemPrompt?: string;
    includeContext?: “none” | “thisServer” | “allServers”;
    temperature?: number;
    maxTokens: number;
    stopSequences?: string[];
    metadata?: object;
  };
}

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.

Type Declaration
  • messages: SamplingMessage[]
  • OptionalmodelPreferences?: ModelPreferences

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

  • OptionalsystemPrompt?: string

    An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.

  • OptionalincludeContext?: “none” | “thisServer” | “allServers”

    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.

  • Optionaltemperature?: number
  • maxTokens: number

    The requested maximum number of tokens to sample (to prevent runaway completions).

    The client MAY choose to sample fewer tokens than the requested maximum.

  • OptionalstopSequences?: string[]
  • Optionalmetadata?: object

    Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.

CreateMessageResult

interface CreateMessageResult {
  _meta?: { [key: string]: unknown };
  model: string;
  stopReason?: string;
  role: Role;
  content: TextContent | ImageContent | AudioContent;
  [key: string]: unknown;
}

The client’s response to a sampling/create_message request from the server. 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.

See General fields: _meta for notes on _meta usage.

The name of the model that generated the message.

The reason why sampling stopped, if known.

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.

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

interface SamplingMessage {
  role: Role;
  content: TextContent | ImageContent | AudioContent;
}

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

tools/call

CallToolRequest

interface CallToolRequest {
  method: “tools/call”;
  params: { name: string; arguments?: { [key: string]: unknown } };
}

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

CallToolResult

interface CallToolResult {
  _meta?: { [key: string]: unknown };
  content: ContentBlock[];
  structuredContent?: { [key: string]: unknown };
  isError?: boolean;
  [key: string]: unknown;
}

The server’s response to a tool call.

See General fields: _meta for notes on _meta usage.

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 {
  params?: { cursor?: string };
  method: “tools/list”;
}

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

Type Declaration
  • Optionalcursor?: string

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

ListToolsResult

interface ListToolsResult {
  _meta?: { [key: string]: unknown };
  nextCursor?: string;
  tools: Tool[];
  [key: string]: unknown;
}

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

See General fields: _meta for notes on _meta usage.

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

Tool

interface Tool {
  name: string;
  title?: string;
  description?: string;
  inputSchema: {
    type: “object”;
    properties?: { [key: string]: object };
    required?: string[];
  };
  outputSchema?: {
    type: “object”;
    properties?: { [key: string]: object };
    required?: string[];
  };
  annotations?: ToolAnnotations;
  _meta?: { [key: string]: unknown };
}

Definition for a tool the client can call.

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.

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

Optional additional tool information.

Display name precedence order is: title, annotations.title, then name.

See General fields: _meta for notes on _meta usage.

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