Skip to main content Link Search Menu Expand Document (external link)

McpSchema.ts overview

Since v1.0.0


Exports Grouped by Category


Autocomplete

Complete (class)

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

Signature

declare class Complete

Source

Since v1.0.0

CompleteResult (class)

The server’s response to a completion/complete request

Signature

declare class CompleteResult

Source

Since v1.0.0

PromptReference (class)

Identifies a prompt.

Signature

declare class PromptReference

Source

Since v1.0.0

ResourceReference (class)

A reference to a resource or resource template definition.

Signature

declare class ResourceReference

Source

Since v1.0.0

Cancellation

CancelledNotification (class)

Signature

declare class CancelledNotification

Source

Since v1.0.0

Common

Annotations (class)

Optional annotations for the client. The client can use annotations to inform how objects are used or displayed

Signature

declare class Annotations

Source

Since v1.0.0

ClientCapabilities (class)

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.

Signature

declare class ClientCapabilities

Source

Since v1.0.0

Cursor

An opaque token used to represent a cursor for pagination.

Signature

declare const Cursor: typeof Schema.String

Source

Since v1.0.0

Cursor (type alias)

Signature

type Cursor = typeof Cursor.Type

Source

Since v1.0.0

Implementation (class)

Describes the name and version of an MCP implementation.

Signature

declare class Implementation

Source

Since v1.0.0

NotificationMeta (class)

Signature

declare class NotificationMeta

Source

Since v1.0.0

PaginatedRequestMeta (class)

Signature

declare class PaginatedRequestMeta

Source

Since v1.0.0

PaginatedResultMeta (class)

Signature

declare class PaginatedResultMeta

Source

Since v1.0.0

ProgressToken

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

Signature

declare const ProgressToken: Schema.Union<[typeof Schema.String, typeof Schema.Number]>

Source

Since v1.0.0

ProgressToken (type alias)

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

Signature

type ProgressToken = typeof ProgressToken.Type

Source

Since v1.0.0

RequestId

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

Signature

declare const RequestId: Schema.Union<[typeof Schema.String, typeof Schema.Number]>

Source

Since v1.0.0

RequestId (type alias)

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

Signature

type RequestId = typeof RequestId.Type

Source

Since v1.0.0

RequestMeta (class)

Signature

declare class RequestMeta

Source

Since v1.0.0

ResultMeta (class)

Signature

declare class ResultMeta

Source

Since v1.0.0

Role

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

Signature

declare const Role: Schema.Literal<["user", "assistant"]>

Source

Since v1.0.0

Role (type alias)

Signature

type Role = typeof Role.Type

Source

Since v1.0.0

ServerCapabilities (class)

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.

Signature

declare class ServerCapabilities

Source

Since v1.0.0

Elicitation

Elicit (class)

Signature

declare class Elicit

Source

Since v1.0.0

ElicitAcceptResult (class)

The client’s response to an elicitation request

Signature

declare class ElicitAcceptResult

Source

Since v1.0.0

ElicitDeclineResult (class)

The client’s response to an elicitation request

Signature

declare class ElicitDeclineResult

Source

Since v1.0.0

ElicitResult

The client’s response to an elicitation request

Signature

declare const ElicitResult: Schema.Union<[typeof ElicitAcceptResult, typeof ElicitDeclineResult]>

Source

Since v1.0.0

ElicitationDeclined (class)

Signature

declare class ElicitationDeclined

Source

Since v1.0.0

Errors

INTERNAL_ERROR_CODE

Signature

declare const INTERNAL_ERROR_CODE: -32603

Source

Since v1.0.0

INVALID_PARAMS_ERROR_CODE

Signature

declare const INVALID_PARAMS_ERROR_CODE: -32602

Source

Since v1.0.0

INVALID_REQUEST_ERROR_CODE

Signature

declare const INVALID_REQUEST_ERROR_CODE: -32600

Source

Since v1.0.0

InternalError (class)

Signature

declare class InternalError

Source

Since v1.0.0

InvalidParams (class)

Signature

declare class InvalidParams

Source

Since v1.0.0

InvalidRequest (class)

Signature

declare class InvalidRequest

Source

Since v1.0.0

METHOD_NOT_FOUND_ERROR_CODE

Signature

declare const METHOD_NOT_FOUND_ERROR_CODE: -32601

Source

Since v1.0.0

McpError (class)

Signature

declare class McpError

Source

Since v1.0.0

MethodNotFound (class)

Signature

declare class MethodNotFound

Source

Since v1.0.0

PARSE_ERROR_CODE

Signature

declare const PARSE_ERROR_CODE: -32700

Source

Since v1.0.0

ParseError (class)

Signature

declare class ParseError

Source

Since v1.0.0

Initialization

Initialize (class)

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

Signature

declare class Initialize

Source

Since v1.0.0

InitializeResult (class)

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

Signature

declare class InitializeResult

Source

Since v1.0.0

InitializedNotification (class)

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

Signature

declare class InitializedNotification

Source

Since v1.0.0

Logging

LoggingLevel

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

Signature

declare const LoggingLevel: Schema.Literal<
  ["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]
>

Source

Since v1.0.0

LoggingLevel (type alias)

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

Signature

type LoggingLevel = typeof LoggingLevel.Type

Source

Since v1.0.0

LoggingMessageNotification (class)

Signature

declare class LoggingMessageNotification

Source

Since v1.0.0

SetLevel (class)

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

Signature

declare class SetLevel

Source

Since v1.0.0

McpServerClient

McpServerClient (class)

Signature

declare class McpServerClient

Source

Since v1.0.0

McpServerClientMiddleware (class)

Signature

declare class McpServerClientMiddleware

Source

Since v1.0.0

Parameters

Param (interface)

Signature

export interface Param<Id extends string, S extends Schema.Schema.Any>
  extends Schema.Schema<S["Type"], S["Encoded"], S["Context"]> {
  readonly [ParamAnnotation]: Id
}

Source

Since v1.0.0

ParamAnnotation

Signature

declare const ParamAnnotation: unique symbol

Source

Since v1.0.0

param

Helper to create a param for a resource URI template.

Signature

declare const param: <const Id extends string, S extends Schema.Schema.Any>(id: Id, schema: S) => Param<Id, S>

Source

Since v1.0.0

Ping

Ping (class)

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.

Signature

declare class Ping

Source

Since v1.0.0

Progress

ProgressNotification (class)

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

Signature

declare class ProgressNotification

Source

Since v1.0.0

Prompts

AudioContent (class)

Audio provided to or from an LLM.

Signature

declare class AudioContent

Source

Since v1.0.0

ContentBlock (class)

Signature

declare class ContentBlock

Source

Since v1.0.0

EmbeddedResource (class)

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.

Signature

declare class EmbeddedResource

Source

Since v1.0.0

GetPrompt (class)

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

Signature

declare class GetPrompt

Source

Since v1.0.0

GetPromptResult (class)

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

Signature

declare class GetPromptResult

Source

Since v1.0.0

ImageContent (class)

An image provided to or from an LLM.

Signature

declare class ImageContent

Source

Since v1.0.0

ListPrompts (class)

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

Signature

declare class ListPrompts

Source

Since v1.0.0

ListPromptsResult (class)

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

Signature

declare class ListPromptsResult

Source

Since v1.0.0

Prompt (class)

A prompt or prompt template that the server offers.

Signature

declare class Prompt

Source

Since v1.0.0

PromptArgument (class)

Describes an argument that a prompt can accept.

Signature

declare class PromptArgument

Source

Since v1.0.0

PromptListChangedNotification (class)

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.

Signature

declare class PromptListChangedNotification

Source

Since v1.0.0

PromptMessage (class)

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.

Signature

declare class PromptMessage

Source

Since v1.0.0

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.

Signature

declare class ResourceLink

Source

Since v1.0.0

TextContent (class)

Text provided to or from an LLM.

Signature

declare class TextContent

Source

Since v1.0.0

Protocol

ClientFailureEncoded (type alias)

Signature

type ClientFailureEncoded = FailureEncoded<typeof ServerRequestRpcs>

Source

Since v1.0.0

ClientNotificationEncoded (type alias)

Signature

type ClientNotificationEncoded = NotificationEncoded<typeof ClientNotificationRpcs>

Source

Since v1.0.0

ClientNotificationRpcs (class)

Signature

declare class ClientNotificationRpcs

Source

Since v1.0.0

ClientRequestEncoded (type alias)

Signature

type ClientRequestEncoded = RequestEncoded<typeof ClientRequestRpcs>

Source

Since v1.0.0

ClientRequestRpcs (class)

Signature

declare class ClientRequestRpcs

Source

Since v1.0.0

ClientRpcs (class)

Signature

declare class ClientRpcs

Source

Since v1.0.0

ClientSuccessEncoded (type alias)

Signature

type ClientSuccessEncoded = SuccessEncoded<typeof ServerRequestRpcs>

Source

Since v1.0.0

FailureEncoded (type alias)

Signature

type FailureEncoded<Group> =
  RpcGroup.Rpcs<Group> extends infer Rpc
    ? Rpc extends Rpc.Rpc<infer _Tag, infer _Payload, infer _Success, infer _Error, infer _Middleware>
      ? {
          readonly _tag: "Failure"
          readonly id: string | number
          readonly error: _Error["Encoded"]
        }
      : never
    : never

Source

Since v1.0.0

FromClientEncoded (type alias)

Signature

type FromClientEncoded = ClientRequestEncoded | ClientNotificationEncoded

Source

Since v1.0.0

FromServerEncoded (type alias)

Signature

type FromServerEncoded = ServerResultEncoded | ServerNotificationEncoded

Source

Since v1.0.0

NotificationEncoded (type alias)

Signature

type NotificationEncoded<Group> =
  RpcGroup.Rpcs<Group> extends infer Rpc
    ? Rpc extends Rpc.Rpc<infer _Tag, infer _Payload, infer _Success, infer _Error, infer _Middleware>
      ? {
          readonly _tag: "Notification"
          readonly method: _Tag
          readonly payload: _Payload["Encoded"]
        }
      : never
    : never

Source

Since v1.0.0

RequestEncoded (type alias)

Signature

type RequestEncoded<Group> =
  RpcGroup.Rpcs<Group> extends infer Rpc
    ? Rpc extends Rpc.Rpc<infer _Tag, infer _Payload, infer _Success, infer _Error, infer _Middleware>
      ? {
          readonly _tag: "Request"
          readonly id: string | number
          readonly method: _Tag
          readonly payload: _Payload["Encoded"]
        }
      : never
    : never

Source

Since v1.0.0

ServerFailureEncoded (type alias)

Signature

type ServerFailureEncoded = FailureEncoded<typeof ClientRequestRpcs>

Source

Since v1.0.0

ServerNotificationEncoded (type alias)

Signature

type ServerNotificationEncoded = NotificationEncoded<typeof ServerNotificationRpcs>

Source

Since v1.0.0

ServerNotificationRpcs (class)

Signature

declare class ServerNotificationRpcs

Source

Since v1.0.0

ServerRequestEncoded (type alias)

Signature

type ServerRequestEncoded = RequestEncoded<typeof ServerRequestRpcs>

Source

Since v1.0.0

ServerRequestRpcs (class)

Signature

declare class ServerRequestRpcs

Source

Since v1.0.0

ServerResultEncoded (type alias)

Signature

type ServerResultEncoded = ServerSuccessEncoded | ServerFailureEncoded

Source

Since v1.0.0

ServerSuccessEncoded (type alias)

Signature

type ServerSuccessEncoded = SuccessEncoded<typeof ClientRequestRpcs>

Source

Since v1.0.0

SuccessEncoded (type alias)

Signature

type SuccessEncoded<Group> =
  RpcGroup.Rpcs<Group> extends infer Rpc
    ? Rpc extends Rpc.Rpc<infer _Tag, infer _Payload, infer _Success, infer _Error, infer _Middleware>
      ? {
          readonly _tag: "Success"
          readonly id: string | number
          readonly result: _Success["Encoded"]
        }
      : never
    : never

Source

Since v1.0.0

Resources

BlobResourceContents (class)

The contents of a binary resource, which can be represented as an Uint8Array

Signature

declare class BlobResourceContents

Source

Since v1.0.0

ListResourceTemplates (class)

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

Signature

declare class ListResourceTemplates

Source

Since v1.0.0

ListResourceTemplatesResult (class)

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

Signature

declare class ListResourceTemplatesResult

Source

Since v1.0.0

ListResources (class)

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

Signature

declare class ListResources

Source

Since v1.0.0

ListResourcesResult (class)

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

Signature

declare class ListResourcesResult

Source

Since v1.0.0

ReadResource (class)

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

Signature

declare class ReadResource

Source

Since v1.0.0

ReadResourceResult (class)

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

Signature

declare class ReadResourceResult

Source

Since v1.0.0

Resource (class)

A known resource that the server is capable of reading.

Signature

declare class Resource

Source

Since v1.0.0

ResourceContents (class)

The contents of a specific resource or sub-resource.

Signature

declare class ResourceContents

Source

Since v1.0.0

ResourceListChangedNotification (class)

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.

Signature

declare class ResourceListChangedNotification

Source

Since v1.0.0

ResourceTemplate (class)

A template description for resources available on the server.

Signature

declare class ResourceTemplate

Source

Since v1.0.0

ResourceUpdatedNotification (class)

Signature

declare class ResourceUpdatedNotification

Source

Since v1.0.0

Subscribe (class)

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

Signature

declare class Subscribe

Source

Since v1.0.0

TextResourceContents (class)

The contents of a text resource, which can be represented as a string.

Signature

declare class TextResourceContents

Source

Since v1.0.0

Unsubscribe (class)

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

Signature

declare class Unsubscribe

Source

Since v1.0.0

Roots

ListRoots (class)

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.

Signature

declare class ListRoots

Source

Since v1.0.0

ListRootsResult (class)

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.

Signature

declare class ListRootsResult

Source

Since v1.0.0

Root (class)

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

Signature

declare class Root

Source

Since v1.0.0

RootsListChangedNotification (class)

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.

Signature

declare class RootsListChangedNotification

Source

Since v1.0.0

Sampling

CreateMessage (class)

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.

Signature

declare class CreateMessage

Source

Since v1.0.0

CreateMessageResult (class)

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.

Signature

declare class CreateMessageResult

Source

Since v1.0.0

ModelHint (class)

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.

Signature

declare class ModelHint

Source

Since v1.0.0

ModelPreferences (class)

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.

Signature

declare class ModelPreferences

Source

Since v1.0.0

SamplingMessage (class)

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

Signature

declare class SamplingMessage

Source

Since v1.0.0

Tools

CallTool (class)

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

Signature

declare class CallTool

Source

Since v1.0.0

CallToolResult (class)

The server’s response to a tool call.

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.

Signature

declare class CallToolResult

Source

Since v1.0.0

ListTools (class)

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

Signature

declare class ListTools

Source

Since v1.0.0

ListToolsResult (class)

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

Signature

declare class ListToolsResult

Source

Since v1.0.0

Tool (class)

Definition for a tool the client can call.

Signature

declare class Tool

Source

Since v1.0.0

ToolAnnotations (class)

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.

Signature

declare class ToolAnnotations

Source

Since v1.0.0

ToolListChangedNotification (class)

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.

Signature

declare class ToolListChangedNotification

Source

Since v1.0.0