McpSchema.ts overview
Since v1.0.0
Exports Grouped by Category
- Autocomplete
- Cancellation
- Common
- Annotations (class)
- ClientCapabilities (class)
- Cursor
- Cursor (type alias)
- Implementation (class)
- NotificationMeta (class)
- PaginatedRequestMeta (class)
- PaginatedResultMeta (class)
- ProgressToken
- ProgressToken (type alias)
- RequestId
- RequestId (type alias)
- RequestMeta (class)
- ResultMeta (class)
- Role
- Role (type alias)
- ServerCapabilities (class)
- Elicitation
- Errors
- Initialization
- Logging
- McpServerClient
- Parameters
- Ping
- Progress
- Prompts
- AudioContent (class)
- ContentBlock (class)
- EmbeddedResource (class)
- GetPrompt (class)
- GetPromptResult (class)
- ImageContent (class)
- ListPrompts (class)
- ListPromptsResult (class)
- Prompt (class)
- PromptArgument (class)
- PromptListChangedNotification (class)
- PromptMessage (class)
- ResourceLink (class)
- TextContent (class)
- Protocol
- ClientFailureEncoded (type alias)
- ClientNotificationEncoded (type alias)
- ClientNotificationRpcs (class)
- ClientRequestEncoded (type alias)
- ClientRequestRpcs (class)
- ClientRpcs (class)
- ClientSuccessEncoded (type alias)
- FailureEncoded (type alias)
- FromClientEncoded (type alias)
- FromServerEncoded (type alias)
- NotificationEncoded (type alias)
- RequestEncoded (type alias)
- ServerFailureEncoded (type alias)
- ServerNotificationEncoded (type alias)
- ServerNotificationRpcs (class)
- ServerRequestEncoded (type alias)
- ServerRequestRpcs (class)
- ServerResultEncoded (type alias)
- ServerSuccessEncoded (type alias)
- SuccessEncoded (type alias)
- Resources
- BlobResourceContents (class)
- ListResourceTemplates (class)
- ListResourceTemplatesResult (class)
- ListResources (class)
- ListResourcesResult (class)
- ReadResource (class)
- ReadResourceResult (class)
- Resource (class)
- ResourceContents (class)
- ResourceListChangedNotification (class)
- ResourceTemplate (class)
- ResourceUpdatedNotification (class)
- Subscribe (class)
- TextResourceContents (class)
- Unsubscribe (class)
- Roots
- Sampling
- Tools
Autocomplete
Complete (class)
A request from the client to the server, to ask for completion options.
Signature
declare class Complete
Since v1.0.0
CompleteResult (class)
The server’s response to a completion/complete request
Signature
declare class CompleteResult
Since v1.0.0
PromptReference (class)
Identifies a prompt.
Signature
declare class PromptReference
Since v1.0.0
ResourceReference (class)
A reference to a resource or resource template definition.
Signature
declare class ResourceReference
Since v1.0.0
Cancellation
CancelledNotification (class)
Signature
declare class CancelledNotification
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
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
Since v1.0.0
Cursor
An opaque token used to represent a cursor for pagination.
Signature
declare const Cursor: typeof Schema.String
Since v1.0.0
Cursor (type alias)
Signature
type Cursor = typeof Cursor.Type
Since v1.0.0
Implementation (class)
Describes the name and version of an MCP implementation.
Signature
declare class Implementation
Since v1.0.0
NotificationMeta (class)
Signature
declare class NotificationMeta
Since v1.0.0
PaginatedRequestMeta (class)
Signature
declare class PaginatedRequestMeta
Since v1.0.0
PaginatedResultMeta (class)
Signature
declare class PaginatedResultMeta
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]>
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
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]>
Since v1.0.0
RequestId (type alias)
A uniquely identifying ID for a request in JSON-RPC.
Signature
type RequestId = typeof RequestId.Type
Since v1.0.0
RequestMeta (class)
Signature
declare class RequestMeta
Since v1.0.0
ResultMeta (class)
Signature
declare class ResultMeta
Since v1.0.0
Role
The sender or recipient of messages and data in a conversation.
Signature
declare const Role: Schema.Literal<["user", "assistant"]>
Since v1.0.0
Role (type alias)
Signature
type Role = typeof Role.Type
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
Since v1.0.0
Elicitation
Elicit (class)
Signature
declare class Elicit
Since v1.0.0
ElicitAcceptResult (class)
The client’s response to an elicitation request
Signature
declare class ElicitAcceptResult
Since v1.0.0
ElicitDeclineResult (class)
The client’s response to an elicitation request
Signature
declare class ElicitDeclineResult
Since v1.0.0
ElicitResult
The client’s response to an elicitation request
Signature
declare const ElicitResult: Schema.Union<[typeof ElicitAcceptResult, typeof ElicitDeclineResult]>
Since v1.0.0
ElicitationDeclined (class)
Signature
declare class ElicitationDeclined
Since v1.0.0
Errors
INTERNAL_ERROR_CODE
Signature
declare const INTERNAL_ERROR_CODE: -32603
Since v1.0.0
INVALID_PARAMS_ERROR_CODE
Signature
declare const INVALID_PARAMS_ERROR_CODE: -32602
Since v1.0.0
INVALID_REQUEST_ERROR_CODE
Signature
declare const INVALID_REQUEST_ERROR_CODE: -32600
Since v1.0.0
InternalError (class)
Signature
declare class InternalError
Since v1.0.0
InvalidParams (class)
Signature
declare class InvalidParams
Since v1.0.0
InvalidRequest (class)
Signature
declare class InvalidRequest
Since v1.0.0
METHOD_NOT_FOUND_ERROR_CODE
Signature
declare const METHOD_NOT_FOUND_ERROR_CODE: -32601
Since v1.0.0
McpError (class)
Signature
declare class McpError
Since v1.0.0
MethodNotFound (class)
Signature
declare class MethodNotFound
Since v1.0.0
PARSE_ERROR_CODE
Signature
declare const PARSE_ERROR_CODE: -32700
Since v1.0.0
ParseError (class)
Signature
declare class ParseError
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
Since v1.0.0
InitializeResult (class)
After receiving an initialize request from the client, the server sends this response.
Signature
declare class InitializeResult
Since v1.0.0
InitializedNotification (class)
This notification is sent from the client to the server after initialization has finished.
Signature
declare class InitializedNotification
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"]
>
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
Since v1.0.0
LoggingMessageNotification (class)
Signature
declare class LoggingMessageNotification
Since v1.0.0
SetLevel (class)
A request from the client to the server, to enable or adjust logging.
Signature
declare class SetLevel
Since v1.0.0
McpServerClient
McpServerClient (class)
Signature
declare class McpServerClient
Since v1.0.0
McpServerClientMiddleware (class)
Signature
declare class McpServerClientMiddleware
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
}
Since v1.0.0
ParamAnnotation
Signature
declare const ParamAnnotation: unique symbol
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>
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
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
Since v1.0.0
Prompts
AudioContent (class)
Audio provided to or from an LLM.
Signature
declare class AudioContent
Since v1.0.0
ContentBlock (class)
Signature
declare class ContentBlock
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
Since v1.0.0
GetPrompt (class)
Used by the client to get a prompt provided by the server.
Signature
declare class GetPrompt
Since v1.0.0
GetPromptResult (class)
The server’s response to a prompts/get request from the client.
Signature
declare class GetPromptResult
Since v1.0.0
ImageContent (class)
An image provided to or from an LLM.
Signature
declare class ImageContent
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
Since v1.0.0
ListPromptsResult (class)
The server’s response to a prompts/list request from the client.
Signature
declare class ListPromptsResult
Since v1.0.0
Prompt (class)
A prompt or prompt template that the server offers.
Signature
declare class Prompt
Since v1.0.0
PromptArgument (class)
Describes an argument that a prompt can accept.
Signature
declare class PromptArgument
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
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
Since v1.0.0
ResourceLink (class)
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
Since v1.0.0
TextContent (class)
Text provided to or from an LLM.
Signature
declare class TextContent
Since v1.0.0
Protocol
ClientFailureEncoded (type alias)
Signature
type ClientFailureEncoded = FailureEncoded<typeof ServerRequestRpcs>
Since v1.0.0
ClientNotificationEncoded (type alias)
Signature
type ClientNotificationEncoded = NotificationEncoded<typeof ClientNotificationRpcs>
Since v1.0.0
ClientNotificationRpcs (class)
Signature
declare class ClientNotificationRpcs
Since v1.0.0
ClientRequestEncoded (type alias)
Signature
type ClientRequestEncoded = RequestEncoded<typeof ClientRequestRpcs>
Since v1.0.0
ClientRequestRpcs (class)
Signature
declare class ClientRequestRpcs
Since v1.0.0
ClientRpcs (class)
Signature
declare class ClientRpcs
Since v1.0.0
ClientSuccessEncoded (type alias)
Signature
type ClientSuccessEncoded = SuccessEncoded<typeof ServerRequestRpcs>
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
Since v1.0.0
FromClientEncoded (type alias)
Signature
type FromClientEncoded = ClientRequestEncoded | ClientNotificationEncoded
Since v1.0.0
FromServerEncoded (type alias)
Signature
type FromServerEncoded = ServerResultEncoded | ServerNotificationEncoded
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
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
Since v1.0.0
ServerFailureEncoded (type alias)
Signature
type ServerFailureEncoded = FailureEncoded<typeof ClientRequestRpcs>
Since v1.0.0
ServerNotificationEncoded (type alias)
Signature
type ServerNotificationEncoded = NotificationEncoded<typeof ServerNotificationRpcs>
Since v1.0.0
ServerNotificationRpcs (class)
Signature
declare class ServerNotificationRpcs
Since v1.0.0
ServerRequestEncoded (type alias)
Signature
type ServerRequestEncoded = RequestEncoded<typeof ServerRequestRpcs>
Since v1.0.0
ServerRequestRpcs (class)
Signature
declare class ServerRequestRpcs
Since v1.0.0
ServerResultEncoded (type alias)
Signature
type ServerResultEncoded = ServerSuccessEncoded | ServerFailureEncoded
Since v1.0.0
ServerSuccessEncoded (type alias)
Signature
type ServerSuccessEncoded = SuccessEncoded<typeof ClientRequestRpcs>
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
Since v1.0.0
Resources
BlobResourceContents (class)
The contents of a binary resource, which can be represented as an Uint8Array
Signature
declare class BlobResourceContents
Since v1.0.0
ListResourceTemplates (class)
Sent from the client to request a list of resource templates the server has.
Signature
declare class ListResourceTemplates
Since v1.0.0
ListResourceTemplatesResult (class)
The server’s response to a resources/templates/list request from the client.
Signature
declare class ListResourceTemplatesResult
Since v1.0.0
ListResources (class)
Sent from the client to request a list of resources the server has.
Signature
declare class ListResources
Since v1.0.0
ListResourcesResult (class)
The server’s response to a resources/list request from the client.
Signature
declare class ListResourcesResult
Since v1.0.0
ReadResource (class)
Sent from the client to the server, to read a specific resource URI.
Signature
declare class ReadResource
Since v1.0.0
ReadResourceResult (class)
The server’s response to a resources/read request from the client.
Signature
declare class ReadResourceResult
Since v1.0.0
Resource (class)
A known resource that the server is capable of reading.
Signature
declare class Resource
Since v1.0.0
ResourceContents (class)
The contents of a specific resource or sub-resource.
Signature
declare class ResourceContents
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
Since v1.0.0
ResourceTemplate (class)
A template description for resources available on the server.
Signature
declare class ResourceTemplate
Since v1.0.0
ResourceUpdatedNotification (class)
Signature
declare class ResourceUpdatedNotification
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
Since v1.0.0
TextResourceContents (class)
The contents of a text resource, which can be represented as a string.
Signature
declare class TextResourceContents
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
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
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
Since v1.0.0
Root (class)
Represents a root directory or file that the server can operate on.
Signature
declare class Root
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
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
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
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
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
Since v1.0.0
SamplingMessage (class)
Describes a message issued to or received from an LLM API.
Signature
declare class SamplingMessage
Since v1.0.0
Tools
CallTool (class)
Used by the client to invoke a tool provided by the server.
Signature
declare class CallTool
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
Since v1.0.0
ListTools (class)
Sent from the client to request a list of tools the server has.
Signature
declare class ListTools
Since v1.0.0
ListToolsResult (class)
The server’s response to a tools/list request from the client.
Signature
declare class ListToolsResult
Since v1.0.0
Tool (class)
Definition for a tool the client can call.
Signature
declare class Tool
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
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
Since v1.0.0