Skip to content

McpSchema

117 exports Added in v1.0.0 Source

Autocomplete

Complete

Added in v1.0.0 Source

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

Signature

declare class Complete extends any {
  constructor();
}

The server's response to a completion/complete request

Signature

declare class CompleteResult extends ReadonlySide<
  {
    readonly completion: Struct<{
      readonly hasMore: optional<Boolean>;
      readonly total: optional<Number>;
      readonly values: $Array<String>;
    }>;
  },
  "Type"
> {
  constructor(
    ...args: [
      props: ReadonlyMakeIn<{
        readonly completion: Struct<{
          readonly hasMore: optional<Boolean>;
          readonly total: optional<Number>;
          readonly values: $Array<String>;
        }>;
      }>,
      options?: MakeOptions,
    ]
  );
  static readonly empty: CompleteResult;
}

Identifies a prompt.

Signature

declare class PromptReference extends any {
  constructor();
}

A reference to a resource or resource template definition.

Signature

declare class ResourceReference extends any {
  constructor();
}

Cancellation

Signature

declare class CancelledNotification extends any {
  constructor();
}

Common

Annotations

Added in v1.0.0 Source

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

Signature

declare class Annotations extends any {
  constructor();
}

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 extends {
  readonly elicitation?: ReadonlySide<{}, "Type">;
  readonly experimental?: {
    [key: string]: unknown;
    [key: number]: unknown;
    [key: symbol]: unknown;
  };
  readonly roots?: {
    readonly listChanged?: boolean;
  };
  readonly sampling?: ReadonlySide<{}, "Type">;
} {
  constructor(...args: [props?: {
    readonly elicitation?: ReadonlyMakeIn<{}>;
    readonly experimental?: {
      [key: string]: unknown;
      [key: number]: unknown;
      [key: symbol]: unknown;
    };
    readonly roots?: {
      readonly listChanged?: boolean;
    };
    readonly sampling?: ReadonlyMakeIn<{}>;
  }, options?: MakeOptions]);
}

Cursor

Added in v1.0.0 Source

An opaque token used to represent a cursor for pagination.

Signature

declare const Cursor: typeof Schema.String;

Cursor type

Added in v1.0.0 Source

Signature

type Cursor = typeof Cursor.Type;

Describes the name and version of an MCP implementation.

Signature

declare class Implementation extends any {
  constructor();
}

Signature

declare class NotificationMeta extends any {
  constructor();
}

Signature

declare class PaginatedRequestMeta extends any {
  constructor();
}

Signature

declare class PaginatedResultMeta extends any {
  constructor();
}

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

Signature

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

ProgressToken type

Added in v1.0.0 Source

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

Signature

type ProgressToken = typeof ProgressToken.Type;

RequestId

Added in v1.0.0 Source

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

Signature

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

RequestId type

Added in v1.0.0 Source

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

Signature

type RequestId = typeof RequestId.Type;

RequestMeta

Added in v1.0.0 Source

Signature

declare class RequestMeta extends any {
  constructor();
}

ResultMeta

Added in v1.0.0 Source

Signature

declare class ResultMeta extends any {
  constructor();
}

Role

Added in v1.0.0 Source

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

Signature

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

Role type

Added in v1.0.0 Source

Signature

type Role = typeof Role.Type;

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 extends any {
  constructor();
}

Elicitation

Elicit

Added in v1.0.0 Source

Signature

declare class Elicit extends any {
  constructor();
}

The client's response to an elicitation request

Signature

declare class ElicitAcceptResult extends {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
} {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
  constructor(...args: [props?: {
    [key: number]: any;
    [key: symbol]: any;
    [key: string]: any;
  }, options?: MakeOptions]);
}

Signature

declare class ElicitationDeclined extends any {
  constructor();
}

The client's response to an elicitation request

Signature

declare class ElicitDeclineResult extends {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
} {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
  constructor(...args: [props?: {
    [key: number]: any;
    [key: symbol]: any;
    [key: string]: any;
  }, options?: MakeOptions]);
}

ElicitResult

Added in v1.0.0 Source

The client's response to an elicitation request

Signature

declare const ElicitResult: Union<readonly Array<Constraint>>

Errors

Signature

declare const INTERNAL_ERROR_CODE: -32603;

Signature

declare class InternalError extends any {
  constructor();
  static readonly notImplemented: InternalError;
}

Signature

declare const INVALID_PARAMS_ERROR_CODE: -32602;

Signature

declare const INVALID_REQUEST_ERROR_CODE: -32600;

Signature

declare class InvalidParams extends any {
  constructor();
}

Signature

declare class InvalidRequest extends any {
  constructor();
}

McpError

Added in v1.0.0 Source

Signature

declare class McpError extends {
  readonly code: number;
  readonly data?: unknown;
  readonly message: string;
} {
  constructor(...args: [props: {
    readonly code: number;
    readonly data?: unknown;
    readonly message: string;
  }, options?: MakeOptions]);
}

Signature

declare const METHOD_NOT_FOUND_ERROR_CODE: -32601;

Signature

declare class MethodNotFound extends any {
  constructor();
}

Signature

declare const PARSE_ERROR_CODE: -32700;

ParseError

Added in v1.0.0 Source

Signature

declare class ParseError extends any {
  constructor();
}

Initialization

Initialize

Added in v1.0.0 Source

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

Signature

declare class Initialize extends any {
  constructor();
}

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

Signature

declare class InitializedNotification extends any {
  constructor();
}

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

Signature

declare class InitializeResult extends {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
} {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
  constructor(...args: [props?: {
    [key: number]: any;
    [key: symbol]: any;
    [key: string]: any;
  }, options?: MakeOptions]);
}

Logging

LoggingLevel

Added in v1.0.0 Source

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"]
>;

LoggingLevel type

Added in v1.0.0 Source

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;

Signature

declare class LoggingMessageNotification extends any {
  constructor();
}

SetLevel

Added in v1.0.0 Source

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

Signature

declare class SetLevel extends any {
  constructor();
}

McpServerClient

Signature

declare class McpServerClient extends any {
  constructor();
}

Signature

declare class McpServerClientMiddleware extends any {
  constructor();
}

Parameters

param

Added in v1.0.0 Source

Helper to create a param for a resource URI template.

Signature

declare function param<Id extends string, S extends Any>(id: Id, schema: S): Param<Id, S>;

Param interface

Added in v1.0.0 Source

Signature

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

Signature

declare const ParamAnnotation: unique symbol;

Ping

Ping

Added in v1.0.0 Source

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 extends any {
  constructor();
}

Progress

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

Signature

declare class ProgressNotification extends any {
  constructor();
}

Prompts

AudioContent

Added in v1.0.0 Source

Audio provided to or from an LLM.

Signature

declare class AudioContent extends any {
  constructor();
}

ContentBlock

Added in v1.0.0 Source

Signature

declare class ContentBlock extends any {
  constructor();
}

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 extends any {
  constructor();
}

GetPrompt

Added in v1.0.0 Source

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

Signature

declare class GetPrompt extends any {
  constructor();
}

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

Signature

declare class GetPromptResult extends {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
} {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
  constructor(...args: [props?: {
    [key: number]: any;
    [key: symbol]: any;
    [key: string]: any;
  }, options?: MakeOptions]);
}

ImageContent

Added in v1.0.0 Source

An image provided to or from an LLM.

Signature

declare class ImageContent extends any {
  constructor();
}

ListPrompts

Added in v1.0.0 Source

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

Signature

declare class ListPrompts extends any {
  constructor();
}

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

Signature

declare class ListPromptsResult extends {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
} {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
  constructor(...args: [props?: {
    [key: number]: any;
    [key: symbol]: any;
    [key: string]: any;
  }, options?: MakeOptions]);
}

Prompt

Added in v1.0.0 Source

A prompt or prompt template that the server offers.

Signature

declare class Prompt extends {
  readonly arguments?: readonly Array<unknown>;
  readonly description?: string;
  readonly name: string;
  readonly title?: string;
} {
  constructor(...args: [props: {
    readonly arguments?: readonly Array<unknown>;
    readonly description?: string;
    readonly name: string;
    readonly title?: string;
  }, options?: MakeOptions]);
}

Describes an argument that a prompt can accept.

Signature

declare class PromptArgument extends any {
  constructor();
}

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 extends any {
  constructor();
}

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 extends any {
  constructor();
}

TextContent

Added in v1.0.0 Source

Text provided to or from an LLM.

Signature

declare class TextContent extends any {
  constructor();
}

Protocol

ClientFailureEncoded type

Added in v1.0.0 Source

Signature

type ClientFailureEncoded = FailureEncoded<typeof ServerRequestRpcs>;

Signature

type ClientNotificationEncoded = NotificationEncoded<typeof ClientNotificationRpcs>;

Signature

declare class ClientNotificationRpcs extends any {
  constructor();
}

ClientRequestEncoded type

Added in v1.0.0 Source

Signature

type ClientRequestEncoded = RequestEncoded<typeof ClientRequestRpcs>;

Signature

declare class ClientRequestRpcs extends any {
  constructor();
}

ClientRpcs

Added in v1.0.0 Source

Signature

declare class ClientRpcs extends any {
  constructor();
}

ClientSuccessEncoded type

Added in v1.0.0 Source

Signature

type ClientSuccessEncoded = SuccessEncoded<typeof ServerRequestRpcs>;

FailureEncoded type

Added in v1.0.0 Source

Signature

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

FromClientEncoded type

Added in v1.0.0 Source

Signature

type FromClientEncoded = ClientRequestEncoded | ClientNotificationEncoded;

FromServerEncoded type

Added in v1.0.0 Source

Signature

type FromServerEncoded = ServerResultEncoded | ServerNotificationEncoded;

NotificationEncoded type

Added in v1.0.0 Source

Signature

type NotificationEncoded<Group extends RpcGroup.Any> =
  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;

RequestEncoded type

Added in v1.0.0 Source

Signature

type RequestEncoded<Group extends RpcGroup.Any> =
  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;

ServerFailureEncoded type

Added in v1.0.0 Source

Signature

type ServerFailureEncoded = FailureEncoded<typeof ClientRequestRpcs>;

Signature

type ServerNotificationEncoded = NotificationEncoded<typeof ServerNotificationRpcs>;

Signature

declare class ServerNotificationRpcs extends any {
  constructor();
}

ServerRequestEncoded type

Added in v1.0.0 Source

Signature

type ServerRequestEncoded = RequestEncoded<typeof ServerRequestRpcs>;

Signature

declare class ServerRequestRpcs extends any {
  constructor();
}

ServerResultEncoded type

Added in v1.0.0 Source

Signature

type ServerResultEncoded = ServerSuccessEncoded | ServerFailureEncoded;

ServerSuccessEncoded type

Added in v1.0.0 Source

Signature

type ServerSuccessEncoded = SuccessEncoded<typeof ClientRequestRpcs>;

SuccessEncoded type

Added in v1.0.0 Source

Signature

type SuccessEncoded<Group extends RpcGroup.Any> =
  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;

Resources

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

Signature

declare class BlobResourceContents extends any {
  constructor();
}

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

Signature

declare class ListResources extends any {
  constructor();
}

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

Signature

declare class ListResourcesResult extends {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
} {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
  constructor(...args: [props?: {
    [key: number]: any;
    [key: symbol]: any;
    [key: string]: any;
  }, options?: MakeOptions]);
}

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

Signature

declare class ListResourceTemplates extends any {
  constructor();
}

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

Signature

declare class ListResourceTemplatesResult extends {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
} {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
  constructor(...args: [props?: {
    [key: number]: any;
    [key: symbol]: any;
    [key: string]: any;
  }, options?: MakeOptions]);
}

ReadResource

Added in v1.0.0 Source

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

Signature

declare class ReadResource extends any {
  constructor();
}

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

Signature

declare class ReadResourceResult extends any {
  constructor();
}

Resource

Added in v1.0.0 Source

A known resource that the server is capable of reading.

Signature

declare class Resource extends {
  readonly annotations?: unknown;
  readonly description?: string;
  readonly mimeType?: string;
  readonly name: string;
  readonly size?: number;
  readonly title?: string;
  readonly uri: string;
} {
  constructor(...args: [props: {
    readonly annotations?: unknown;
    readonly description?: string;
    readonly mimeType?: string;
    readonly name: string;
    readonly size?: number;
    readonly title?: string;
    readonly uri: string;
  }, options?: MakeOptions]);
}

The contents of a specific resource or sub-resource.

Signature

declare class ResourceContents extends any {
  constructor();
}

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 extends any {
  constructor();
}

A template description for resources available on the server.

Signature

declare class ResourceTemplate extends {
  readonly annotations?: unknown;
  readonly description?: string;
  readonly mimeType?: string;
  readonly name: string;
  readonly title?: string;
  readonly uriTemplate: string;
} {
  constructor(...args: [props: {
    readonly annotations?: unknown;
    readonly description?: string;
    readonly mimeType?: string;
    readonly name: string;
    readonly title?: string;
    readonly uriTemplate: string;
  }, options?: MakeOptions]);
}

Signature

declare class ResourceUpdatedNotification extends any {
  constructor();
}

Subscribe

Added in v1.0.0 Source

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

Signature

declare class Subscribe extends any {
  constructor();
}

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

Signature

declare class TextResourceContents extends any {
  constructor();
}

Unsubscribe

Added in v1.0.0 Source

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 extends any {
  constructor();
}

Roots

ListRoots

Added in v1.0.0 Source

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 extends any {
  constructor();
}

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 extends ReadonlySide<
  {
    readonly roots: $Array<typeof Root>;
  },
  "Type"
> {
  constructor(
    ...args: [
      props: ReadonlyMakeIn<{
        readonly roots: $Array<typeof Root>;
      }>,
      options?: MakeOptions,
    ]
  );
}

Root

Added in v1.0.0 Source

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

Signature

declare class Root extends {
  readonly name?: string;
  readonly uri: string;
} {
  constructor(...args: [props: {
    readonly name?: string;
    readonly uri: string;
  }, options?: MakeOptions]);
}

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 extends any {
  constructor();
}

Sampling

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 extends any {
  constructor();
}

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 extends {
  readonly model: string;
  readonly stopReason?: string;
} {
  constructor(...args: [props: {
    readonly model: string;
    readonly stopReason?: string;
  }, options?: MakeOptions]);
}

ModelHint

Added in v1.0.0 Source

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 extends any {
  constructor();
}

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 extends {
  readonly costPriority?: undefined;
  readonly hints?: readonly Array<unknown>;
  readonly intelligencePriority?: undefined;
  readonly speedPriority?: undefined;
} {
  constructor(...args: [props?: {
    readonly costPriority?: undefined;
    readonly hints?: readonly Array<unknown>;
    readonly intelligencePriority?: undefined;
    readonly speedPriority?: undefined;
  }, options?: MakeOptions]);
}

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

Signature

declare class SamplingMessage extends any {
  constructor();
}

Tools

CallTool

Added in v1.0.0 Source

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

Signature

declare class CallTool extends any {
  constructor();
}

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 extends {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
} {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
  constructor(...args: [props?: {
    [key: number]: any;
    [key: symbol]: any;
    [key: string]: any;
  }, options?: MakeOptions]);
}

ListTools

Added in v1.0.0 Source

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

Signature

declare class ListTools extends any {
  constructor();
}

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

Signature

declare class ListToolsResult extends {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
} {
  [key: number]: any;
  [key: symbol]: any;
  [key: string]: any;
  constructor(...args: [props?: {
    [key: number]: any;
    [key: symbol]: any;
    [key: string]: any;
  }, options?: MakeOptions]);
}

Tool

Added in v1.0.0 Source

Definition for a tool the client can call.

Signature

declare class Tool extends {
  readonly annotations?: ToolAnnotations;
  readonly description?: string;
  readonly inputSchema: unknown;
  readonly name: string;
  readonly title?: string;
} {
  constructor(...args: [props: {
    readonly annotations?: ToolAnnotations;
    readonly description?: string;
    readonly inputSchema: unknown;
    readonly name: string;
    readonly title?: string;
  }, options?: MakeOptions]);
}

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 extends {
  [key: string]: any;
} {
  [key: string]: any;
  constructor(...args: [props?: {
    [key: string]: any;
  }, options?: MakeOptions]);
}

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 extends any {
  constructor();
}