This is the documentation for the v2 beta — looking for the v1 documentation?
Skip to content

MCP TypeScript SDK (V2) / @modelcontextprotocol/server / index

index

Namespaces

Enumerations

OAuthErrorCode

Defined in: packages/core-internal/src/auth/errors.ts:7

OAuth error codes as defined by RFC 6749 and extensions.

Enumeration Members

AccessDenied

AccessDenied: "access_denied"

Defined in: packages/core-internal/src/auth/errors.ts:44

The resource owner or authorization server denied the request.

InsufficientScope

InsufficientScope: "insufficient_scope"

Defined in: packages/core-internal/src/auth/errors.ts:94

The request requires higher privileges than provided by the access token.

InvalidClient

InvalidClient: "invalid_client"

Defined in: packages/core-internal/src/auth/errors.ts:18

Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method).

InvalidClientMetadata

InvalidClientMetadata: "invalid_client_metadata"

Defined in: packages/core-internal/src/auth/errors.ts:84

The client metadata is invalid. (Custom error for dynamic client registration - RFC 7591)

InvalidGrant

InvalidGrant: "invalid_grant"

Defined in: packages/core-internal/src/auth/errors.ts:24

The provided authorization grant or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.

InvalidRedirectUri

InvalidRedirectUri: "invalid_redirect_uri"

Defined in: packages/core-internal/src/auth/errors.ts:89

The value of one or more redirection URIs is invalid. (Dynamic client registration - RFC 7591 §3.2.2)

InvalidRequest

InvalidRequest: "invalid_request"

Defined in: packages/core-internal/src/auth/errors.ts:12

The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.

InvalidScope

InvalidScope: "invalid_scope"

Defined in: packages/core-internal/src/auth/errors.ts:39

The requested scope is invalid, unknown, malformed, or exceeds the scope granted by the resource owner.

InvalidTarget

InvalidTarget: "invalid_target"

Defined in: packages/core-internal/src/auth/errors.ts:99

The requested resource is invalid, missing, unknown, or malformed. (Custom error for resource indicators - RFC 8707)

InvalidToken

InvalidToken: "invalid_token"

Defined in: packages/core-internal/src/auth/errors.ts:69

The access token provided is expired, revoked, malformed, or invalid for other reasons.

MethodNotAllowed

MethodNotAllowed: "method_not_allowed"

Defined in: packages/core-internal/src/auth/errors.ts:74

The HTTP method used is not allowed for this endpoint. (Custom, non-standard error)

ServerError

ServerError: "server_error"

Defined in: packages/core-internal/src/auth/errors.ts:49

The authorization server encountered an unexpected condition that prevented it from fulfilling the request.

TemporarilyUnavailable

TemporarilyUnavailable: "temporarily_unavailable"

Defined in: packages/core-internal/src/auth/errors.ts:54

The authorization server is currently unable to handle the request due to temporary overloading or maintenance.

TooManyRequests

TooManyRequests: "too_many_requests"

Defined in: packages/core-internal/src/auth/errors.ts:79

Rate limit exceeded. (Custom, non-standard error based on RFC 6585)

UnauthorizedClient

UnauthorizedClient: "unauthorized_client"

Defined in: packages/core-internal/src/auth/errors.ts:29

The authenticated client is not authorized to use this authorization grant type.

UnsupportedGrantType

UnsupportedGrantType: "unsupported_grant_type"

Defined in: packages/core-internal/src/auth/errors.ts:34

The authorization grant type is not supported by the authorization server.

UnsupportedResponseType

UnsupportedResponseType: "unsupported_response_type"

Defined in: packages/core-internal/src/auth/errors.ts:59

The authorization server does not support obtaining an authorization code using this method.

UnsupportedTokenType

UnsupportedTokenType: "unsupported_token_type"

Defined in: packages/core-internal/src/auth/errors.ts:64

The authorization server does not support the requested token type.


ProtocolErrorCode

Defined in: packages/core-internal/src/types/enums.ts:5

Error codes for protocol errors that cross the wire as JSON-RPC error responses. These follow the JSON-RPC specification and MCP-specific extensions.

Enumeration Members

InternalError

InternalError: -32603

Defined in: packages/core-internal/src/types/enums.ts:11

InvalidParams

InvalidParams: -32602

Defined in: packages/core-internal/src/types/enums.ts:10

InvalidRequest

InvalidRequest: -32600

Defined in: packages/core-internal/src/types/enums.ts:8

MethodNotFound

MethodNotFound: -32601

Defined in: packages/core-internal/src/types/enums.ts:9

MissingRequiredClientCapability

MissingRequiredClientCapability: -32021

Defined in: packages/core-internal/src/types/enums.ts:30

Processing the request requires a capability the client did not declare in the request's clientCapabilities (protocol revision 2026-07-28).

ParseError

ParseError: -32700

Defined in: packages/core-internal/src/types/enums.ts:7

ResourceNotFound

ResourceNotFound: -32002

Defined in: packages/core-internal/src/types/enums.ts:25

Resource not found.

Receive-tolerated only: the SDK never EMITS -32002resources/read misses answer -32602 (Invalid Params) on every protocol revision per the 2026-07-28 spec MUST, and a handler-thrown -32002 is mapped to -32602 at the era encode seam. The member stays importable so clients can recognise -32002 from peers built on earlier SDK releases (the spec's "clients SHOULD also accept -32002" backwards-compatibility clause). Throw ResourceNotFoundError instead.

UnsupportedProtocolVersion

UnsupportedProtocolVersion: -32022

Defined in: packages/core-internal/src/types/enums.ts:35

The request's protocol version is unknown to the server or unsupported by it (protocol revision 2026-07-28).

UrlElicitationRequired

UrlElicitationRequired: -32042

Defined in: packages/core-internal/src/types/enums.ts:36


SdkErrorCode

Defined in: packages/core-internal/src/errors/sdkErrors.ts:9

Error codes for SDK errors (local errors that never cross the wire). Unlike ProtocolErrorCode which uses numeric JSON-RPC codes, SdkErrorCode uses descriptive string values for better developer experience.

These errors are thrown locally by the SDK and are never serialized as JSON-RPC error responses.

Enumeration Members

AlreadyConnected

AlreadyConnected: "ALREADY_CONNECTED"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:14

Transport is already connected

CapabilityNotSupported

CapabilityNotSupported: "CAPABILITY_NOT_SUPPORTED"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:20

Required capability is not supported by the remote side

ClientHttpAuthentication

ClientHttpAuthentication: "CLIENT_HTTP_AUTHENTICATION"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:75

ClientHttpFailedToOpenStream

ClientHttpFailedToOpenStream: "CLIENT_HTTP_FAILED_TO_OPEN_STREAM"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:78

ClientHttpFailedToTerminateSession

ClientHttpFailedToTerminateSession: "CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:79

ClientHttpForbidden

ClientHttpForbidden: "CLIENT_HTTP_FORBIDDEN"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:76

ClientHttpNotImplemented

ClientHttpNotImplemented: "CLIENT_HTTP_NOT_IMPLEMENTED"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:74

ClientHttpUnexpectedContent

ClientHttpUnexpectedContent: "CLIENT_HTTP_UNEXPECTED_CONTENT"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:77

ConnectionClosed

ConnectionClosed: "CONNECTION_CLOSED"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:26

Connection was closed

EraNegotiationFailed

EraNegotiationFailed: "ERA_NEGOTIATION_FAILED"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:71

Protocol-era negotiation at connect time failed without producing either a usable modern (2026-07-28+) era or a definitive legacy fallback signal — e.g. the negotiation mode forbids falling back (pin), or the probe hit a network failure (a typed connect error, never an era verdict).

Negotiation-phase only: this code is never used once an era is established.

InputRequiredRoundsExceeded

InputRequiredRoundsExceeded: "INPUT_REQUIRED_ROUNDS_EXCEEDED"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:45

The multi-round-trip auto-fulfilment driver exhausted its round cap (inputRequired.maxRounds) without the server returning a complete result. data.rounds carries the cap that was hit and data.lastResult carries the last input_required payload received ({ inputRequests, requestState? }), so callers can inspect or resume the flow manually.

InvalidResult

InvalidResult: "INVALID_RESULT"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:30

Response result failed local schema validation

ListPaginationExceeded

ListPaginationExceeded: "LIST_PAGINATION_EXCEEDED"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:54

The auto-aggregating no-cursor listTools() / listPrompts() / listResources() / listResourceTemplates() walk hit the ClientOptions.listMaxPages cap without the server's pagination converging. data.method carries the list verb and data.listMaxPages the cap that was hit; raise the cap or fall back to explicit per-page { cursor } calls.

MethodNotSupportedByProtocolVersion

MethodNotSupportedByProtocolVersion: "METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:62

The spec method being sent does not exist on the negotiated protocol version's wire era (e.g. tasks/get toward a 2026-07-28 peer, or server/discover toward a 2025-era peer). Raised locally, before anything reaches the transport. The method and era are carried in data.method / data.era.

NotConnected

NotConnected: "NOT_CONNECTED"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:12

Transport is not connected

NotInitialized

NotInitialized: "NOT_INITIALIZED"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:16

Protocol is not initialized

RequestTimeout

RequestTimeout: "REQUEST_TIMEOUT"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:24

Request timed out waiting for response

SendFailed

SendFailed: "SEND_FAILED"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:28

Failed to send message

UnsupportedResultType

UnsupportedResultType: "UNSUPPORTED_RESULT_TYPE"

Defined in: packages/core-internal/src/errors/sdkErrors.ts:36

The response carried a resultType discriminator (protocol revision 2026-07-28) naming a result kind this client cannot consume yet, e.g. input_required. The kind is carried in data.resultType.

Classes

InMemoryTransport

Defined in: packages/core-internal/src/util/inMemory.ts:16

In-memory transport for creating clients and servers that talk to each other within the same process.

Intended for testing and development. For production in-process connections, use StreamableHTTPClientTransport against a local server URL.

Implements

Constructors

Constructor

new InMemoryTransport(): InMemoryTransport

Returns

InMemoryTransport

Properties

onclose?

optional onclose?: () => void

Defined in: packages/core-internal/src/util/inMemory.ts:21

Callback for when the connection is closed for any reason.

This should be invoked when close() is called as well.

Returns

void

Implementation of

Transport.onclose

onerror?

optional onerror?: (error) => void

Defined in: packages/core-internal/src/util/inMemory.ts:22

Callback for when an error occurs.

Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.

Parameters
error

Error

Returns

void

Implementation of

Transport.onerror

onmessage?

optional onmessage?: (message, extra?) => void

Defined in: packages/core-internal/src/util/inMemory.ts:23

Callback for when a message (request or response) is received over the connection.

Includes the request and authInfo if the transport is authenticated.

The request can be used to get the original request information (headers, etc.)

Parameters
message

JSONRPCMessage

extra?
authInfo?

AuthInfo

Returns

void

Implementation of

Transport.onmessage

sessionId?

optional sessionId?: string

Defined in: packages/core-internal/src/util/inMemory.ts:24

The session ID generated for this connection.

Implementation of

Transport.sessionId

Methods

close()

close(): Promise<void>

Defined in: packages/core-internal/src/util/inMemory.ts:45

Closes the connection.

Returns

Promise<void>

Implementation of

Transport.close

send()

send(message, options?): Promise<void>

Defined in: packages/core-internal/src/util/inMemory.ts:62

Sends a message with optional auth info. This is useful for testing authentication scenarios.

Parameters
message

JSONRPCMessage

options?
authInfo?

AuthInfo

relatedRequestId?

RequestId

Returns

Promise<void>

Implementation of

Transport.send

start()

start(): Promise<void>

Defined in: packages/core-internal/src/util/inMemory.ts:37

Starts processing messages on the transport, including any connection steps that might need to be taken.

This method should only be called after callbacks are installed, or else messages may be lost.

NOTE: This method should not be called explicitly when using Client or Server classes, as they will implicitly call start().

Returns

Promise<void>

Implementation of

Transport.start

createLinkedPair()

static createLinkedPair(): [InMemoryTransport, InMemoryTransport]

Defined in: packages/core-internal/src/util/inMemory.ts:29

Creates a pair of linked in-memory transports that can communicate with each other. One should be passed to a Client and one to a Server.

Returns

[InMemoryTransport, InMemoryTransport]


MissingRequiredClientCapabilityError

Defined in: packages/core-internal/src/types/errors.ts:163

Error type for the -32021 MissingRequiredClientCapability protocol error (protocol revision 2026-07-28): processing the request requires a capability the client did not declare in the request's clientCapabilities.

The error data lists the missing capabilities (requiredCapabilities) in the ClientCapabilities shape, so the client can see exactly what it would have to declare for the request to be served. On HTTP, the response status is 400 Bad Request.

Recognize this error by its code and data.requiredCapabilities rather than by class identity (instanceof does not work across separately bundled copies of the SDK).

Extends

Constructors

Constructor

new MissingRequiredClientCapabilityError(data, message?): MissingRequiredClientCapabilityError

Defined in: packages/core-internal/src/types/errors.ts:164

Parameters
data

MissingRequiredClientCapabilityErrorData

message?

string = ...

Returns

MissingRequiredClientCapabilityError

Overrides

ProtocolError.constructor

Properties

cause?

optional cause?: unknown

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

ProtocolError.cause

code

readonly code: number

Defined in: packages/core-internal/src/types/errors.ts:15

Inherited from

ProtocolError.code

data?

readonly optional data?: unknown

Defined in: packages/core-internal/src/types/errors.ts:17

Inherited from

ProtocolError.data

message

message: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

ProtocolError.message

name

name: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

ProtocolError.name

stack?

optional stack?: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

ProtocolError.stack

stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:68

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from

ProtocolError.stackTraceLimit

Accessors

requiredCapabilities
Get Signature

get requiredCapabilities(): object

Defined in: packages/core-internal/src/types/errors.ts:175

The capabilities the server requires from the client to process the request (only the missing capabilities are listed).

Returns
elicitation?

optional elicitation?: object

Present if the client supports eliciting user input.

Index Signature

[key: string]: string | number | boolean | {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

elicitation.form?

optional form?: object

Index Signature

[key: string]: string | number | boolean | {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

elicitation.form.applyDefaults?

optional applyDefaults?: boolean

elicitation.url?

optional url?: object

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

experimental?

optional experimental?: object

Experimental, non-standard capabilities that the client supports.

Index Signature

[key: string]: object

extensions?

optional extensions?: object

Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).

Index Signature

[key: string]: object

roots?

optional roots?: object

Present if the client supports listing roots.

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to passing paths via tool parameters, resource URIs, or configuration.

roots.listChanged?

optional listChanged?: boolean

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

sampling?

optional sampling?: object

Present if the client supports sampling from an LLM.

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.

sampling.context?

optional context?: object

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

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

sampling.tools?

optional tools?: object

Present if the client supports tool use via tools and toolChoice parameters.

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

tasks?

optional tasks?: object

Present if the client supports task creation.

Index Signature

[key: string]: unknown

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; parsed for interoperability only — servers built on this SDK never advertise it.

tasks.cancel?

optional cancel?: object

Present if the client supports cancelling tasks.

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

tasks.list?

optional list?: object

Present if the client supports listing tasks.

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

tasks.requests?

optional requests?: object

Capabilities for task creation on specific request types.

Index Signature

[key: string]: unknown

tasks.requests.elicitation?

optional elicitation?: object

Task support for elicitation requests.

Index Signature

[key: string]: unknown

tasks.requests.elicitation.create?

optional create?: object

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null

tasks.requests.sampling?

optional sampling?: object

Task support for sampling requests.

Index Signature

[key: string]: unknown

tasks.requests.sampling.createMessage?

optional createMessage?: object

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

ProtocolError.captureStackTrace

fromError()

static fromError(code, message, data?): ProtocolError

Defined in: packages/core-internal/src/types/errors.ts:26

Factory method to create the appropriate error type based on the error code and data

Parameters
code

number

message

string

data?

unknown

Returns

ProtocolError

Inherited from

ProtocolError.fromError

isError()

static isError(error): error is Error

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts:23

Indicates whether the argument provided is a built-in Error instance or not.

Parameters
error

unknown

Returns

error is Error

Inherited from

ProtocolError.isError

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:56

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

ProtocolError.prepareStackTrace


OAuthError

Defined in: packages/core-internal/src/auth/errors.ts:105

OAuth error class for all OAuth-related errors.

Extends

  • Error

Constructors

Constructor

new OAuthError(code, message, errorUri?): OAuthError

Defined in: packages/core-internal/src/auth/errors.ts:106

Parameters
code

string

message

string

errorUri?

string

Returns

OAuthError

Overrides

Error.constructor

Properties

cause?

optional cause?: unknown

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

Error.cause

code

readonly code: string

Defined in: packages/core-internal/src/auth/errors.ts:107

errorUri?

readonly optional errorUri?: string

Defined in: packages/core-internal/src/auth/errors.ts:109

message

message: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

Error.message

name

name: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

Error.name

stack?

optional stack?: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

Error.stack

stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:68

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from

Error.stackTraceLimit

Methods

toResponseObject()

toResponseObject(): object

Defined in: packages/core-internal/src/auth/errors.ts:118

Converts the error to a standard OAuth error response object.

Returns

object

error

error: string

error_description?

optional error_description?: string

error_uri?

optional error_uri?: string

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

Error.captureStackTrace

fromResponse()

static fromResponse(response): OAuthError

Defined in: packages/core-internal/src/auth/errors.ts:134

Creates an OAuthError from an OAuth error response.

Parameters
response
error

string = ...

error_description?

string = ...

error_uri?

string = ...

Returns

OAuthError

isError()

static isError(error): error is Error

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts:23

Indicates whether the argument provided is a built-in Error instance or not.

Parameters
error

unknown

Returns

error is Error

Inherited from

Error.isError

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:56

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace


ProtocolError

Defined in: packages/core-internal/src/types/errors.ts:13

Protocol errors are JSON-RPC errors that cross the wire as error responses. They use numeric error codes from the ProtocolErrorCode enum.

Extends

  • Error

Extended by

Constructors

Constructor

new ProtocolError(code, message, data?): ProtocolError

Defined in: packages/core-internal/src/types/errors.ts:14

Parameters
code

number

message

string

data?

unknown

Returns

ProtocolError

Overrides

Error.constructor

Properties

cause?

optional cause?: unknown

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

Error.cause

code

readonly code: number

Defined in: packages/core-internal/src/types/errors.ts:15

data?

readonly optional data?: unknown

Defined in: packages/core-internal/src/types/errors.ts:17

message

message: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

Error.message

name

name: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

Error.name

stack?

optional stack?: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

Error.stack

stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:68

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from

Error.stackTraceLimit

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

Error.captureStackTrace

fromError()

static fromError(code, message, data?): ProtocolError

Defined in: packages/core-internal/src/types/errors.ts:26

Factory method to create the appropriate error type based on the error code and data

Parameters
code

number

message

string

data?

unknown

Returns

ProtocolError

isError()

static isError(error): error is Error

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts:23

Indicates whether the argument provided is a built-in Error instance or not.

Parameters
error

unknown

Returns

error is Error

Inherited from

Error.isError

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:56

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace


ReadBuffer

Defined in: packages/core-internal/src/shared/stdio.ts:9

Buffers a continuous stdio stream into discrete JSON-RPC messages.

Constructors

Constructor

new ReadBuffer(options?): ReadBuffer

Defined in: packages/core-internal/src/shared/stdio.ts:13

Parameters
options?
maxBufferSize?

number

Returns

ReadBuffer

Methods

append()

append(chunk): void

Defined in: packages/core-internal/src/shared/stdio.ts:17

Parameters
chunk

Buffer

Returns

void

clear()

clear(): void

Defined in: packages/core-internal/src/shared/stdio.ts:51

Returns

void

readMessage()

readMessage(): JSONRPCMessage | null

Defined in: packages/core-internal/src/shared/stdio.ts:26

Returns

JSONRPCMessage | null


ResourceNotFoundError

Defined in: packages/core-internal/src/types/errors.ts:93

Error type for a resources/read miss: the requested resource does not exist. The wire code is -32602 (Invalid Params) on every protocol revision — the spec MUST for revision 2026-07-28, and the value the v1.x SDK has always emitted on earlier revisions. The error data echoes the requested URI.

Recognise this error by checking error.data is exactly { uri: string } (a -32602 whose data carries uri and nothing else is resource-not-found; any other -32602 is an ordinary Invalid Params). For backwards compatibility, clients should also accept -32002 as resource not found — earlier SDK builds emitted that code, and ProtocolError.fromError reconstructs this class for either code when error.data carries uri (a bare -32002 without data.uri stays a generic ProtocolError). Do not rely on instanceof — it does not work across separately bundled copies of the SDK.

Extends

Constructors

Constructor

new ResourceNotFoundError(uri, message?): ResourceNotFoundError

Defined in: packages/core-internal/src/types/errors.ts:94

Parameters
uri

string

message?

string = ...

Returns

ResourceNotFoundError

Overrides

ProtocolError.constructor

Properties

cause?

optional cause?: unknown

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

ProtocolError.cause

code

readonly code: number

Defined in: packages/core-internal/src/types/errors.ts:15

Inherited from

ProtocolError.code

data?

readonly optional data?: unknown

Defined in: packages/core-internal/src/types/errors.ts:17

Inherited from

ProtocolError.data

message

message: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

ProtocolError.message

name

name: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

ProtocolError.name

stack?

optional stack?: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

ProtocolError.stack

stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:68

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from

ProtocolError.stackTraceLimit

Accessors

uri
Get Signature

get uri(): string

Defined in: packages/core-internal/src/types/errors.ts:99

The URI that was requested and not found.

Returns

string

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

ProtocolError.captureStackTrace

fromError()

static fromError(code, message, data?): ProtocolError

Defined in: packages/core-internal/src/types/errors.ts:26

Factory method to create the appropriate error type based on the error code and data

Parameters
code

number

message

string

data?

unknown

Returns

ProtocolError

Inherited from

ProtocolError.fromError

isError()

static isError(error): error is Error

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts:23

Indicates whether the argument provided is a built-in Error instance or not.

Parameters
error

unknown

Returns

error is Error

Inherited from

ProtocolError.isError

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:56

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

ProtocolError.prepareStackTrace


SdkError

Defined in: packages/core-internal/src/errors/sdkErrors.ts:100

SDK errors are local errors that never cross the wire. They are distinct from ProtocolError which represents JSON-RPC protocol errors that are serialized and sent as error responses.

Example

ts
try {
    // Throwing an SDK error
    throw new SdkError(SdkErrorCode.NotConnected, 'Transport is not connected');
} catch (error) {
    // Checking error type by code
    if (error instanceof SdkError && error.code === SdkErrorCode.RequestTimeout) {
        // Handle timeout
    }
}

Extends

  • Error

Extended by

Constructors

Constructor

new SdkError(code, message, data?): SdkError

Defined in: packages/core-internal/src/errors/sdkErrors.ts:101

Parameters
code

SdkErrorCode

message

string

data?

unknown

Returns

SdkError

Overrides

Error.constructor

Properties

cause?

optional cause?: unknown

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

Error.cause

code

readonly code: SdkErrorCode

Defined in: packages/core-internal/src/errors/sdkErrors.ts:102

data?

readonly optional data?: unknown

Defined in: packages/core-internal/src/errors/sdkErrors.ts:104

message

message: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

Error.message

name

name: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

Error.name

stack?

optional stack?: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

Error.stack

stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:68

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from

Error.stackTraceLimit

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

Error.captureStackTrace

isError()

static isError(error): error is Error

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts:23

Indicates whether the argument provided is a built-in Error instance or not.

Parameters
error

unknown

Returns

error is Error

Inherited from

Error.isError

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:56

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace


SdkHttpError

Defined in: packages/core-internal/src/errors/sdkErrors.ts:136

An SdkError subclass for HTTP transport failures.

Thrown by the streamable HTTP transport when the server responds with a non-OK status code. Narrows data to SdkHttpErrorData so consumers can inspect the HTTP status without unsafe casting.

Example

ts
if (error instanceof SdkHttpError) {
    console.log(error.status); // number
    console.log(error.statusText); // string | undefined
}

Extends

Constructors

Constructor

new SdkHttpError(code, message, data): SdkHttpError

Defined in: packages/core-internal/src/errors/sdkErrors.ts:139

Parameters
code

SdkErrorCode

message

string

data

SdkHttpErrorData

Returns

SdkHttpError

Overrides

SdkError.constructor

Properties

cause?

optional cause?: unknown

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

SdkError.cause

code

readonly code: SdkErrorCode

Defined in: packages/core-internal/src/errors/sdkErrors.ts:102

Inherited from

SdkError.code

data

readonly data: SdkHttpErrorData

Defined in: packages/core-internal/src/errors/sdkErrors.ts:137

Overrides

SdkError.data

message

message: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

SdkError.message

name

name: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

SdkError.name

stack?

optional stack?: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

SdkError.stack

stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:68

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from

SdkError.stackTraceLimit

Accessors

status
Get Signature

get status(): number

Defined in: packages/core-internal/src/errors/sdkErrors.ts:144

Returns

number

statusText
Get Signature

get statusText(): string | undefined

Defined in: packages/core-internal/src/errors/sdkErrors.ts:148

Returns

string | undefined

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

SdkError.captureStackTrace

isError()

static isError(error): error is Error

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts:23

Indicates whether the argument provided is a built-in Error instance or not.

Parameters
error

unknown

Returns

error is Error

Inherited from

SdkError.isError

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:56

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

SdkError.prepareStackTrace


UnsupportedProtocolVersionError

Defined in: packages/core-internal/src/types/errors.ts:129

Error type for the -32022 UnsupportedProtocolVersion protocol error (protocol revision 2026-07-28): the request's protocol version is unknown to the server or unsupported by it.

The error data lists the protocol versions the receiver supports (supported), so the sender can choose a mutually supported version and retry, and echoes the version that was requested (requested).

Extends

Constructors

Constructor

new UnsupportedProtocolVersionError(data, message?): UnsupportedProtocolVersionError

Defined in: packages/core-internal/src/types/errors.ts:130

Parameters
data

UnsupportedProtocolVersionErrorData

message?

string = ...

Returns

UnsupportedProtocolVersionError

Overrides

ProtocolError.constructor

Properties

cause?

optional cause?: unknown

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

ProtocolError.cause

code

readonly code: number

Defined in: packages/core-internal/src/types/errors.ts:15

Inherited from

ProtocolError.code

data?

readonly optional data?: unknown

Defined in: packages/core-internal/src/types/errors.ts:17

Inherited from

ProtocolError.data

message

message: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

ProtocolError.message

name

name: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

ProtocolError.name

stack?

optional stack?: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

ProtocolError.stack

stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:68

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from

ProtocolError.stackTraceLimit

Accessors

requested
Get Signature

get requested(): string

Defined in: packages/core-internal/src/types/errors.ts:144

The protocol version that was requested.

Returns

string

supported
Get Signature

get supported(): string[]

Defined in: packages/core-internal/src/types/errors.ts:137

Protocol versions the receiver supports.

Returns

string[]

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

ProtocolError.captureStackTrace

fromError()

static fromError(code, message, data?): ProtocolError

Defined in: packages/core-internal/src/types/errors.ts:26

Factory method to create the appropriate error type based on the error code and data

Parameters
code

number

message

string

data?

unknown

Returns

ProtocolError

Inherited from

ProtocolError.fromError

isError()

static isError(error): error is Error

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts:23

Indicates whether the argument provided is a built-in Error instance or not.

Parameters
error

unknown

Returns

error is Error

Inherited from

ProtocolError.isError

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:56

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

ProtocolError.prepareStackTrace


UriTemplate

Defined in: packages/core-internal/src/shared/uriTemplate.ts:10

Constructors

Constructor

new UriTemplate(template): UriTemplate

Defined in: packages/core-internal/src/shared/uriTemplate.ts:34

Parameters
template

string

Returns

UriTemplate

Accessors

variableNames
Get Signature

get variableNames(): string[]

Defined in: packages/core-internal/src/shared/uriTemplate.ts:30

Returns

string[]

Methods

expand()

expand(variables): string

Defined in: packages/core-internal/src/shared/uriTemplate.ts:172

Parameters
variables

Variables

Returns

string

match()

match(uri): Variables | null

Defined in: packages/core-internal/src/shared/uriTemplate.ts:255

Parameters
uri

string

Returns

Variables | null

toString()

toString(): string

Defined in: packages/core-internal/src/shared/uriTemplate.ts:40

Returns

string

isTemplate()

static isTemplate(str): boolean

Defined in: packages/core-internal/src/shared/uriTemplate.ts:16

Returns true if the given string contains any URI template expressions. A template expression is a sequence of characters enclosed in curly braces, like {foo} or {?bar}.

Parameters
str

string

Returns

boolean


UrlElicitationRequiredError

Defined in: packages/core-internal/src/types/errors.ts:108

Specialized error type when a tool requires a URL mode elicitation. This makes it nicer for the client to handle since there is specific data to work with instead of just a code to check against.

Extends

Constructors

Constructor

new UrlElicitationRequiredError(elicitations, message?): UrlElicitationRequiredError

Defined in: packages/core-internal/src/types/errors.ts:109

Parameters
elicitations

object[]

message?

string = ...

Returns

UrlElicitationRequiredError

Overrides

ProtocolError.constructor

Properties

cause?

optional cause?: unknown

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

ProtocolError.cause

code

readonly code: number

Defined in: packages/core-internal/src/types/errors.ts:15

Inherited from

ProtocolError.code

data?

readonly optional data?: unknown

Defined in: packages/core-internal/src/types/errors.ts:17

Inherited from

ProtocolError.data

message

message: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

ProtocolError.message

name

name: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

ProtocolError.name

stack?

optional stack?: string

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

ProtocolError.stack

stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:68

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Inherited from

ProtocolError.stackTraceLimit

Accessors

elicitations
Get Signature

get elicitations(): object[]

Defined in: packages/core-internal/src/types/errors.ts:115

Returns

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
targetObject

object

constructorOpt?

Function

Returns

void

Inherited from

ProtocolError.captureStackTrace

fromError()

static fromError(code, message, data?): ProtocolError

Defined in: packages/core-internal/src/types/errors.ts:26

Factory method to create the appropriate error type based on the error code and data

Parameters
code

number

message

string

data?

unknown

Returns

ProtocolError

Inherited from

ProtocolError.fromError

isError()

static isError(error): error is Error

Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.esnext.error.d.ts:23

Indicates whether the argument provided is a built-in Error instance or not.

Parameters
error

unknown

Returns

error is Error

Inherited from

ProtocolError.isError

prepareStackTrace()

static prepareStackTrace(err, stackTraces): any

Defined in: node_modules/.pnpm/@types+node@24.12.0/node_modules/@types/node/globals.d.ts:56

Parameters
err

Error

stackTraces

CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

ProtocolError.prepareStackTrace

Interfaces

AjvJsonSchemaValidator

Defined in: packages/core-internal/src/validators/ajvProvider.ts:79

AJV-backed JSON Schema validator. See @modelcontextprotocol/{client,server}/validators/ajv for the customisation entry point (re-exports Ajv and addFormats from the bundled copy).

Default validates as JSON Schema 2020-12 (SEP-1613). Schemas declaring a different $schema are rejected with a plain Error; pass a pre-configured Ajv instance to validate other dialects. The SDK bundles ajv internally but does not re-export Ajv2020 (its type graph tips downstream declaration bundling — see #2339). To construct a custom 2020-12 instance, add ajv to your own dependencies (matching the SDK's pinned version) and import { Ajv2020 } from 'ajv/dist/2020.js'new Ajv(...) is the draft-07 class and would silently downgrade dialect.

Examples

Use with default configuration

ts
const validator = new AjvJsonSchemaValidator();

Use with a custom AJV instance

ts
// import { Ajv2020 } from 'ajv/dist/2020.js';
const ajv = new Ajv2020({ strict: false, validateSchema: false, allErrors: true });
const validator = new AjvJsonSchemaValidator(ajv);

Register ajv-formats

ts
// import { Ajv2020 } from 'ajv/dist/2020.js';
const ajv = new Ajv2020({ strict: false, validateSchema: false, allErrors: true });
addFormats(ajv);
const validator = new AjvJsonSchemaValidator(ajv);

Implements

Methods

getValidator()

getValidator<T>(schema): JsonSchemaValidator<T>

Defined in: packages/core-internal/src/validators/ajvProvider.ts:97

Create a validator for the given JSON Schema

Type Parameters
T

T

Parameters
schema

JsonSchemaType

Standard JSON Schema object

Returns

JsonSchemaValidator<T>

A validator function that can be called multiple times

Implementation of

jsonSchemaValidator.getValidator


AuthInfo

Defined in: packages/core-internal/src/types/types.ts:724

Information about a validated access token, provided to request handlers.

Properties

clientId

clientId: string

Defined in: packages/core-internal/src/types/types.ts:733

The client ID associated with this token.

expiresAt?

optional expiresAt?: number

Defined in: packages/core-internal/src/types/types.ts:743

When the token expires (in seconds since epoch).

extra?

optional extra?: Record<string, unknown>

Defined in: packages/core-internal/src/types/types.ts:755

Additional data associated with the token. This field should be used for any additional data that needs to be attached to the auth info.

resource?

optional resource?: URL

Defined in: packages/core-internal/src/types/types.ts:749

The RFC 8707 resource server identifier for which this token is valid. If set, this MUST match the MCP server's resource identifier (minus hash fragment).

scopes

scopes: string[]

Defined in: packages/core-internal/src/types/types.ts:738

Scopes associated with this token.

token

token: string

Defined in: packages/core-internal/src/types/types.ts:728

The access token.


CacheHint

Defined in: packages/core-internal/src/shared/resultCacheHints.ts:33

A cache hint for a cacheable result (protocol revision 2026-07-28): the values to emit for ttlMs / cacheScope when the handler does not provide them itself. Absent fields fall back to the conservative defaults (ttlMs: 0, cacheScope: 'private').

Properties

cacheScope?

optional cacheScope?: CacheScope

Defined in: packages/core-internal/src/shared/resultCacheHints.ts:37

Whether the result may be cached by shared caches (public) or only by the requesting client (private).

ttlMs?

optional ttlMs?: number

Defined in: packages/core-internal/src/shared/resultCacheHints.ts:35

Cache lifetime in milliseconds. Must be a non-negative safe integer.


CfWorkerJsonSchemaValidator

Defined in: packages/core-internal/src/validators/cfWorkerProvider.ts:50

@cfworker/json-schema-backed JSON Schema validator. See @modelcontextprotocol/{client,server}/validators/cf-worker for the customisation entry point.

Default validates as JSON Schema 2020-12 (SEP-1613). Schemas declaring a different $schema are rejected with a plain Error. Passing an explicit draft to the constructor overrides this — that draft is used for every schema regardless of $schema.

Examples

Use with default configuration (2020-12, shortcircuit on)

ts
const validator = new CfWorkerJsonSchemaValidator();

Use with custom configuration

ts
const validator = new CfWorkerJsonSchemaValidator({
    draft: '2020-12',
    shortcircuit: false // Report all errors
});

Implements

Methods

getValidator()

getValidator<T>(schema): JsonSchemaValidator<T>

Defined in: packages/core-internal/src/validators/cfWorkerProvider.ts:77

Create a validator for the given JSON Schema

Unlike AJV, this validator is not cached internally

Type Parameters
T

T

Parameters
schema

JsonSchemaType

Standard JSON Schema object

Returns

JsonSchemaValidator<T>

A validator function that validates input data

Implementation of

jsonSchemaValidator.getValidator


CreateMessageRequestParamsWithTools

Defined in: packages/core-internal/src/types/types.ts:939

CreateMessageRequestParams with required tools - for tool-enabled overload.

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.

Extends

Properties

_meta?

optional _meta?: object

Defined in: packages/core-internal/src/types/schemas.ts:54

See General fields: _meta for notes on _meta usage.

Index Signature

[key: string]: unknown

optional io.modelcontextprotocol/related-task?: object

If specified, this request is related to the provided task.

taskId: string

progressToken?

optional progressToken?: string | number

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.

Inherited from

CreateMessageRequestParams._meta

includeContext?

optional includeContext?: "none" | "thisServer" | "allServers"

Defined in: packages/core-internal/src/types/schemas.ts:1703

A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.

Default is "none". The values "thisServer" and "allServers" are deprecated (SEP-2596): servers SHOULD omit this field or use "none", and SHOULD only use the deprecated values if the client declares ClientCapabilities.sampling.context.

Deprecated

The "thisServer" and "allServers" values are deprecated as of protocol version 2025-11-25 (SEP-2596) and will be removed no later than the Sampling feature itself (SEP-2577). Omit this field or use "none".

Inherited from

CreateMessageRequestParams.includeContext

maxTokens

maxTokens: number

Defined in: packages/core-internal/src/types/schemas.ts:1710

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

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

Inherited from

CreateMessageRequestParams.maxTokens

messages

messages: object[]

Defined in: packages/core-internal/src/types/schemas.ts:1683

_meta?

optional _meta?: object

See MCP specification for notes on _meta usage.

Index Signature

[key: string]: unknown

content

content: { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number; }; text: string; type: "text"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "image"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "audio"; } | { _meta?: {[key: string]: unknown; }; id: string; input: {[key: string]: unknown; }; name: string; type: "tool_use"; } | { _meta?: {[key: string]: unknown; }; content: ({ _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; text: string; type: "text"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "image"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "audio"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; resource: { _meta?: {[key: ...]: ...; }; mimeType?: string; text: string; uri: string; } | { _meta?: {[key: ...]: ...; }; blob: string; mimeType?: string; uri: string; }; type: "resource"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; description?: string; icons?: object[]; mimeType?: string; name: string; size?: number; title?: string; type: "resource_link"; uri: string; })[]; isError?: boolean; structuredContent?: unknown; toolUseId: string; type: "tool_result"; } | ({ _meta?: {[key: string]: unknown; }; annotations?: { audience?: (... | ...)[]; lastModified?: string; priority?: number; }; text: string; type: "text"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: (... | ...)[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "image"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: (... | ...)[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "audio"; } | { _meta?: {[key: string]: unknown; }; id: string; input: {[key: string]: unknown; }; name: string; type: "tool_use"; } | { _meta?: {[key: string]: unknown; }; content: ({ _meta?: {[key: ...]: ...; }; annotations?: { audience?: ...; lastModified?: ...; priority?: ...; }; text: string; type: "text"; } | { _meta?: {[key: ...]: ...; }; annotations?: { audience?: ...; lastModified?: ...; priority?: ...; }; data: string; mimeType: string; type: "image"; } | { _meta?: {[key: ...]: ...; }; annotations?: { audience?: ...; lastModified?: ...; priority?: ...; }; data: string; mimeType: string; type: "audio"; } | { _meta?: {[key: ...]: ...; }; annotations?: { audience?: ...; lastModified?: ...; priority?: ...; }; resource: { _meta?: ...; mimeType?: ...; text: ...; uri: ...; } | { _meta?: ...; blob: ...; mimeType?: ...; uri: ...; }; type: "resource"; } | { _meta?: {[key: ...]: ...; }; annotations?: { audience?: ...; lastModified?: ...; priority?: ...; }; description?: string; icons?: ...[]; mimeType?: string; name: string; size?: number; title?: string; type: "resource_link"; uri: string; })[]; isError?: boolean; structuredContent?: unknown; toolUseId: string; type: "tool_result"; })[]

Union Members
Type Literal

{ _meta?: {[key: string]: unknown; }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number; }; text: string; type: "text"; }

_meta?

optional _meta?: object

See MCP specification for notes on _meta usage.

Index Signature

[key: string]: unknown

annotations?

optional annotations?: object

Optional annotations for the client.

annotations.audience?

optional audience?: ("user" | "assistant")[]

Intended audience(s) for the resource.

annotations.lastModified?

optional lastModified?: string

ISO 8601 timestamp for the most recent modification.

annotations.priority?

optional priority?: number

Importance hint for the resource, from 0 (least) to 1 (most).

text

text: string

The text content of the message.

type

type: "text"


Type Literal

{ _meta?: {[key: string]: unknown; }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "image"; }

_meta?

optional _meta?: object

See MCP specification for notes on _meta usage.

Index Signature

[key: string]: unknown

annotations?

optional annotations?: object

Optional annotations for the client.

annotations.audience?

optional audience?: ("user" | "assistant")[]

Intended audience(s) for the resource.

annotations.lastModified?

optional lastModified?: string

ISO 8601 timestamp for the most recent modification.

annotations.priority?

optional priority?: number

Importance hint for the resource, from 0 (least) to 1 (most).

data

data: string = Base64Schema

The base64-encoded image data.

mimeType

mimeType: string

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

type

type: "image"


Type Literal

{ _meta?: {[key: string]: unknown; }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "audio"; }

_meta?

optional _meta?: object

See MCP specification for notes on _meta usage.

Index Signature

[key: string]: unknown

annotations?

optional annotations?: object

Optional annotations for the client.

annotations.audience?

optional audience?: ("user" | "assistant")[]

Intended audience(s) for the resource.

annotations.lastModified?

optional lastModified?: string

ISO 8601 timestamp for the most recent modification.

annotations.priority?

optional priority?: number

Importance hint for the resource, from 0 (least) to 1 (most).

data

data: string = Base64Schema

The base64-encoded audio data.

mimeType

mimeType: string

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

type

type: "audio"


Type Literal

{ _meta?: {[key: string]: unknown; }; id: string; input: {[key: string]: unknown; }; name: string; type: "tool_use"; }

_meta?

optional _meta?: object

See MCP specification for notes on _meta usage.

Index Signature

[key: string]: unknown

id

id: string

Unique identifier for this tool call. Used to correlate with ToolResultContent in subsequent messages.

input

input: object

Arguments to pass to the tool. Must conform to the tool's inputSchema.

Index Signature

[key: string]: unknown

name

name: string

The name of the tool to invoke. Must match a tool name from the request's tools array.

type

type: "tool_use"


Type Literal

{ _meta?: {[key: string]: unknown; }; content: ({ _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; text: string; type: "text"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "image"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "audio"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; resource: { _meta?: {[key: ...]: ...; }; mimeType?: string; text: string; uri: string; } | { _meta?: {[key: ...]: ...; }; blob: string; mimeType?: string; uri: string; }; type: "resource"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; description?: string; icons?: object[]; mimeType?: string; name: string; size?: number; title?: string; type: "resource_link"; uri: string; })[]; isError?: boolean; structuredContent?: unknown; toolUseId: string; type: "tool_result"; }

_meta?

optional _meta?: object

See MCP specification for notes on _meta usage.

Index Signature

[key: string]: unknown

content

content: ({ _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; text: string; type: "text"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "image"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "audio"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; resource: { _meta?: {[key: ...]: ...; }; mimeType?: string; text: string; uri: string; } | { _meta?: {[key: ...]: ...; }; blob: string; mimeType?: string; uri: string; }; type: "resource"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: ...[]; lastModified?: string; priority?: number; }; description?: string; icons?: object[]; mimeType?: string; name: string; size?: number; title?: string; type: "resource_link"; uri: string; })[]

isError?

optional isError?: boolean

structuredContent?

optional structuredContent?: unknown

SEP-2106: any JSON value is permitted. The 2025-11-25 wire parse retains the object-only constraint via the frozen schema in wire/rev2025-11-25/schemas.ts.

toolUseId

toolUseId: string

type

type: "tool_result"


({ _meta?: {[key: string]: unknown; }; annotations?: { audience?: (... | ...)[]; lastModified?: string; priority?: number; }; text: string; type: "text"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: (... | ...)[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "image"; } | { _meta?: {[key: string]: unknown; }; annotations?: { audience?: (... | ...)[]; lastModified?: string; priority?: number; }; data: string; mimeType: string; type: "audio"; } | { _meta?: {[key: string]: unknown; }; id: string; input: {[key: string]: unknown; }; name: string; type: "tool_use"; } | { _meta?: {[key: string]: unknown; }; content: ({ _meta?: {[key: ...]: ...; }; annotations?: { audience?: ...; lastModified?: ...; priority?: ...; }; text: string; type: "text"; } | { _meta?: {[key: ...]: ...; }; annotations?: { audience?: ...; lastModified?: ...; priority?: ...; }; data: string; mimeType: string; type: "image"; } | { _meta?: {[key: ...]: ...; }; annotations?: { audience?: ...; lastModified?: ...; priority?: ...; }; data: string; mimeType: string; type: "audio"; } | { _meta?: {[key: ...]: ...; }; annotations?: { audience?: ...; lastModified?: ...; priority?: ...; }; resource: { _meta?: ...; mimeType?: ...; text: ...; uri: ...; } | { _meta?: ...; blob: ...; mimeType?: ...; uri: ...; }; type: "resource"; } | { _meta?: {[key: ...]: ...; }; annotations?: { audience?: ...; lastModified?: ...; priority?: ...; }; description?: string; icons?: ...[]; mimeType?: string; name: string; size?: number; title?: string; type: "resource_link"; uri: string; })[]; isError?: boolean; structuredContent?: unknown; toolUseId: string; type: "tool_result"; })[]

role

role: "user" | "assistant" = RoleSchema

Inherited from

CreateMessageRequestParams.messages

metadata?

optional metadata?: object

Defined in: packages/core-internal/src/types/schemas.ts:1715

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

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

Inherited from

CreateMessageRequestParams.metadata

modelPreferences?

optional modelPreferences?: object

Defined in: packages/core-internal/src/types/schemas.ts:1687

The server's preferences for which model to select. The client MAY modify or omit this request.

costPriority?

optional costPriority?: number

How much to prioritize cost when selecting a model.

hints?

optional hints?: object[]

Optional hints to use for model selection.

intelligencePriority?

optional intelligencePriority?: number

How much to prioritize intelligence and capabilities when selecting a model.

speedPriority?

optional speedPriority?: number

How much to prioritize sampling speed (latency) when selecting a model.

Inherited from

CreateMessageRequestParams.modelPreferences

stopSequences?

optional stopSequences?: string[]

Defined in: packages/core-internal/src/types/schemas.ts:1711

Inherited from

CreateMessageRequestParams.stopSequences

systemPrompt?

optional systemPrompt?: string

Defined in: packages/core-internal/src/types/schemas.ts:1691

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

Inherited from

CreateMessageRequestParams.systemPrompt

task?

optional task?: object

Defined in: packages/core-internal/src/types/schemas.ts:71

If specified, the caller is requesting task-augmented execution for this request. The request will return a CreateTaskResult immediately, and the actual result can be retrieved later via tasks/result.

Task augmentation is subject to capability negotiation - receivers MUST declare support for task augmentation of specific request types in their capabilities.

ttl?

optional ttl?: number

Inherited from

CreateMessageRequestParams.task

temperature?

optional temperature?: number

Defined in: packages/core-internal/src/types/schemas.ts:1704

Inherited from

CreateMessageRequestParams.temperature

toolChoice?

optional toolChoice?: object

Defined in: packages/core-internal/src/types/schemas.ts:1726

Controls how the model uses tools. The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. Default is { mode: "auto" }.

mode?

optional mode?: "required" | "auto" | "none"

Controls when tools are used:

  • "auto": Model decides whether to use tools (default)
  • "required": Model MUST use at least one tool before completing
  • "none": Model MUST NOT use any tools
Inherited from

CreateMessageRequestParams.toolChoice

tools

tools: object[]

Defined in: packages/core-internal/src/types/types.ts:940

Tools that the model may use during generation. The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared.

_meta?

optional _meta?: object

See MCP specification for notes on _meta usage.

Index Signature

[key: string]: unknown

annotations?

optional annotations?: object

Optional additional tool information.

annotations.destructiveHint?

optional destructiveHint?: boolean

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

annotations.idempotentHint?

optional idempotentHint?: boolean

If true, calling the tool repeatedly with the same arguments will have no additional effect on its environment.

(This property is meaningful only when readOnlyHint == false)

Default: false

annotations.openWorldHint?

optional openWorldHint?: boolean

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

annotations.readOnlyHint?

optional readOnlyHint?: boolean

If true, the tool does not modify its environment.

Default: false

annotations.title?

optional title?: string

A human-readable title for the tool.

description?

optional description?: string

A human-readable description of the tool.

execution?

optional execution?: object

Execution-related properties for this tool.

execution.taskSupport?

optional taskSupport?: "optional" | "required" | "forbidden"

Indicates the tool's preference for task-augmented execution.

  • "required": Clients MUST invoke the tool as a task
  • "optional": Clients MAY invoke the tool as a task or normal request
  • "forbidden": Clients MUST NOT attempt to invoke the tool as a task

If not present, defaults to "forbidden".

icons?

optional icons?: object[]

Optional set of sized icons that the client can display in a user interface.

Clients that support rendering icons MUST support at least the following MIME types:

  • image/png - PNG images (safe, universal compatibility)
  • image/jpeg (and image/jpg) - JPEG images (safe, universal compatibility)

Clients that support rendering icons SHOULD also support:

  • image/svg+xml - SVG images (scalable but requires security precautions)
  • image/webp - WebP images (modern, efficient format)
inputSchema

inputSchema: object

A JSON Schema 2020-12 object defining the expected parameters for the tool. Must have type: 'object' at the root level per MCP spec.

Index Signature

[key: string]: unknown

inputSchema.properties?

optional properties?: object

Index Signature

[key: string]: string | number | boolean | {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

inputSchema.required?

optional required?: string[]

inputSchema.type

type: "object"

name

name: string

Intended for programmatic or logical use, but used as a display name in past specs or fallback

outputSchema?

optional outputSchema?: object

An optional JSON Schema 2020-12 document describing the structure of the tool's output returned in the structuredContent field of a CallToolResult.

SEP-2106: any JSON Schema root is permitted (e.g. type:'array', oneOf, $ref). The 2025-11-25 wire parse retains the type:'object' constraint via the frozen schema in wire/rev2025-11-25/schemas.ts; this neutral/public schema widens.

Index Signature

[key: string]: unknown

outputSchema.$schema?

optional $schema?: string

title?

optional title?: string

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

Overrides

CreateMessageRequestParams.tools


InboundHttpRequest

Defined in: packages/core-internal/src/shared/inboundClassification.ts:90

The transport-neutral description of an inbound HTTP request the classifier evaluates. The caller (the HTTP entry) reads the body exactly once and extracts the two protocol headers; the classifier never touches a request object itself.

Properties

body?

optional body?: unknown

Defined in: packages/core-internal/src/shared/inboundClassification.ts:100

The parsed JSON request body (undefined for body-less methods).

httpMethod

httpMethod: string

Defined in: packages/core-internal/src/shared/inboundClassification.ts:92

The HTTP request method, e.g. POST, GET, DELETE.

mcpMethodHeader?

optional mcpMethodHeader?: string

Defined in: packages/core-internal/src/shared/inboundClassification.ts:96

The value of the Mcp-Method header, when present.

mcpNameHeader?

optional mcpNameHeader?: string

Defined in: packages/core-internal/src/shared/inboundClassification.ts:98

The value of the Mcp-Name header, when present.

protocolVersionHeader?

optional protocolVersionHeader?: string

Defined in: packages/core-internal/src/shared/inboundClassification.ts:94

The value of the MCP-Protocol-Version header, when present.


InboundLadderRejection

Defined in: packages/core-internal/src/shared/inboundClassification.ts:177

A ladder rejection: the JSON-RPC error to emit and the HTTP status to emit it with.

Properties

cell

cell: string

Defined in: packages/core-internal/src/shared/inboundClassification.ts:182

The cell this rejection corresponds to on the ladder cell sheet (stable identifier for tests).

code

code: number

Defined in: packages/core-internal/src/shared/inboundClassification.ts:186

The JSON-RPC error code.

data?

optional data?: unknown

Defined in: packages/core-internal/src/shared/inboundClassification.ts:190

Structured error data (recognizers parse this; they never rely on class identity).

httpStatus

httpStatus: number

Defined in: packages/core-internal/src/shared/inboundClassification.ts:184

The HTTP status the rejection is emitted with.

kind

kind: "reject"

Defined in: packages/core-internal/src/shared/inboundClassification.ts:178

message

message: string

Defined in: packages/core-internal/src/shared/inboundClassification.ts:188

The JSON-RPC error message.

rung

rung: InboundValidationRung

Defined in: packages/core-internal/src/shared/inboundClassification.ts:180

The ladder rung that produced the rejection.

settled

settled: boolean

Defined in: packages/core-internal/src/shared/inboundClassification.ts:195

false when the exact error code for this cell is not settled upstream yet and the emitted code is provisional.


InboundLegacyRoute

Defined in: packages/core-internal/src/shared/inboundClassification.ts:126

The request is legacy-era traffic. It carries no classification on purpose: legacy serving receives it exactly as a hand-wired 2025 transport would.

Properties

kind

kind: "legacy"

Defined in: packages/core-internal/src/shared/inboundClassification.ts:127

reason

reason: InboundLegacyRouteReason

Defined in: packages/core-internal/src/shared/inboundClassification.ts:128

requestedVersion?

optional requestedVersion?: string

Defined in: packages/core-internal/src/shared/inboundClassification.ts:134

The protocol version the request named, when it named one (an initialize body's protocolVersion, or the MCP-Protocol-Version header). Used to echo requested when legacy serving is not configured.


InputRequests

Defined in: packages/core-internal/src/types/types.ts:605

A map of embedded input requests, keyed by server-assigned identifiers that are unique within the scope of the request.

Indexable

[key: string]: InputRequest


InputRequiredResult

Defined in: packages/core-internal/src/types/types.ts:644

The input-required result a handler for a multi-round-trip method (tools/call, prompts/get, resources/read) returns to request more input from the client (protocol revision 2026-07-28). Build it with the inputRequired() builder; hand-built literals are equally legal — resultType: 'input_required' is the discriminator, and the SDK re-checks the at-least-one rule at the seam.

This is the one place the wire discriminator resultType appears on the neutral surface: the handler authors it, the 2026-07-28 codec passes it through to the wire, and consumers receiving results never see it (complete results are lifted).

At least one of inputRequests or requestState must be present.

requestState is an opaque, server-minted string echoed back verbatim by the client on retry. It travels through the client and MUST be treated by the server as attacker-controlled input on re-entry: if it influences authorization, resource access, or business logic, the server MUST protect its integrity (e.g. HMAC or AEAD) and MUST reject state that fails verification (spec: basic/patterns/mrtr §Server Requirements). The SDK applies no integrity protection by default — without a configured ServerOptions.requestState.verify hook, ctx.mcpReq.requestState() returns the raw, unverified string; with one, the seam rejects state the hook refuses and the accessor returns the hook's decoded payload.

Extends

Indexable

[key: string]: unknown

Properties

_meta?

optional _meta?: object

Defined in: packages/core-internal/src/types/schemas.ts:97

See MCP specification for notes on _meta usage.

Index Signature

[key: string]: unknown

optional io.modelcontextprotocol/related-task?: object

If specified, this request is related to the provided task.

taskId: string

progressToken?

optional progressToken?: string | number

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.

Inherited from

Result._meta

inputRequests?

optional inputRequests?: InputRequests

Defined in: packages/core-internal/src/types/types.ts:647

Embedded requests the client must fulfil before retrying.

requestState?

optional requestState?: string

Defined in: packages/core-internal/src/types/types.ts:649

Opaque server state the client echoes back verbatim on retry.

resultType

resultType: "input_required"

Defined in: packages/core-internal/src/types/types.ts:645


InputRequiredSpec

Defined in: packages/core-internal/src/shared/inputRequired.ts:36

The shape accepted by inputRequired.

Properties

inputRequests?

optional inputRequests?: InputRequests

Defined in: packages/core-internal/src/shared/inputRequired.ts:38

Embedded requests the client must fulfil before retrying.

requestState?

optional requestState?: string

Defined in: packages/core-internal/src/shared/inputRequired.ts:40

Opaque server state echoed back verbatim by the client on retry.


InputResponses

Defined in: packages/core-internal/src/types/types.ts:614

A map of embedded input responses. Keys correspond to the keys of the InputRequests map the server sent; values are the client's bare result for each request.

Indexable

[key: string]: InputResponse


InternalError

Defined in: packages/core-internal/src/types/types.ts:772

Extends

  • JSONRPCErrorObject

Properties

code

code: -32603

Defined in: packages/core-internal/src/types/types.ts:773

Overrides

JSONRPCErrorObject.code

data?

optional data?: unknown

Defined in: packages/core-internal/src/types/types.ts:758

Inherited from

JSONRPCErrorObject.data

message

message: string

Defined in: packages/core-internal/src/types/types.ts:758

Inherited from

JSONRPCErrorObject.message


InvalidParamsError

Defined in: packages/core-internal/src/types/types.ts:769

Extends

  • JSONRPCErrorObject

Properties

code

code: -32602

Defined in: packages/core-internal/src/types/types.ts:770

Overrides

JSONRPCErrorObject.code

data?

optional data?: unknown

Defined in: packages/core-internal/src/types/types.ts:758

Inherited from

JSONRPCErrorObject.data

message

message: string

Defined in: packages/core-internal/src/types/types.ts:758

Inherited from

JSONRPCErrorObject.message


InvalidRequestError

Defined in: packages/core-internal/src/types/types.ts:763

Extends

  • JSONRPCErrorObject

Properties

code

code: -32600

Defined in: packages/core-internal/src/types/types.ts:764

Overrides

JSONRPCErrorObject.code

data?

optional data?: unknown

Defined in: packages/core-internal/src/types/types.ts:758

Inherited from

JSONRPCErrorObject.data

message

message: string

Defined in: packages/core-internal/src/types/types.ts:758

Inherited from

JSONRPCErrorObject.message


jsonSchemaValidator

Defined in: packages/core-internal/src/validators/types.ts:51

Provider interface for creating validators from JSON Schemas

This is the main extension point for custom validator implementations. Implementations should:

  • Support JSON Schema Draft 2020-12 (or be compatible with it)
  • Return validator functions that can be called multiple times
  • Handle schema compilation/caching internally
  • Provide clear error messages on validation failure

Example

ts
class MyValidatorProvider implements jsonSchemaValidator {
    getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T> {
        // Compile/cache validator from schema
        return (input: unknown) =>
            isValid(schema, input)
                ? { valid: true, data: input as T, errorMessage: undefined }
                : { valid: false, data: undefined, errorMessage: 'Error details' };
    }
}

Methods

getValidator()

getValidator<T>(schema): JsonSchemaValidator<T>

Defined in: packages/core-internal/src/validators/types.ts:58

Create a validator for the given JSON Schema

Type Parameters
T

T

Parameters
schema

JsonSchemaType

Standard JSON Schema object

Returns

JsonSchemaValidator<T>

A validator function that can be called multiple times


MessageClassification

Defined in: packages/core-internal/src/types/types.ts:871

Protocol-era classification of an inbound message.

Populated by transports that classify messages at the edge (e.g. an HTTP entry distinguishing 2025-era from 2026-era traffic). The wire era itself is connection state (the negotiated protocol version held by the Client/Server instance); the protocol layer validates a classified message against that instance era at dispatch — a mismatch is treated as an entry/routing error, never a per-message era switch. Unclassified traffic is dispatched on the instance era unchanged.

Properties

era

era: "legacy" | "modern"

Defined in: packages/core-internal/src/types/types.ts:876

The wire era the message was classified into: legacy for the 2025-11-25 family of revisions, modern for 2026-07-28 and later.

revision?

optional revision?: string

Defined in: packages/core-internal/src/types/types.ts:881

The exact protocol revision, when the classifier derived one.


MessageExtraInfo

Defined in: packages/core-internal/src/types/types.ts:887

Extra information about a message.

Properties

authInfo?

optional authInfo?: AuthInfo

Defined in: packages/core-internal/src/types/types.ts:904

The authentication information.

classification?

optional classification?: MessageClassification

Defined in: packages/core-internal/src/types/types.ts:899

Protocol-era classification of the message, when the transport classified it at the edge. Validated by the protocol layer against the instance's negotiated era at dispatch (the edge→instance handoff check); it does not select the era itself.

closeSSEStream?

optional closeSSEStream?: () => void

Defined in: packages/core-internal/src/types/types.ts:910

Callback to close the SSE stream for this request, triggering client reconnection. Only available when using NodeStreamableHTTPServerTransport with eventStore configured.

Returns

void

closeStandaloneSSEStream?

optional closeStandaloneSSEStream?: () => void

Defined in: packages/core-internal/src/types/types.ts:916

Callback to close the standalone GET SSE stream, triggering client reconnection. Only available when using NodeStreamableHTTPServerTransport with eventStore configured.

Returns

void

request?

optional request?: Request

Defined in: packages/core-internal/src/types/types.ts:891

The original HTTP request.


MethodNotFoundError

Defined in: packages/core-internal/src/types/types.ts:766

Extends

  • JSONRPCErrorObject

Properties

code

code: -32601

Defined in: packages/core-internal/src/types/types.ts:767

Overrides

JSONRPCErrorObject.code

data?

optional data?: unknown

Defined in: packages/core-internal/src/types/types.ts:758

Inherited from

JSONRPCErrorObject.data

message

message: string

Defined in: packages/core-internal/src/types/types.ts:758

Inherited from

JSONRPCErrorObject.message


MissingRequiredClientCapabilityErrorData

Defined in: packages/core-internal/src/types/types.ts:780

Data carried by a -32021 MissingRequiredClientCapability protocol error (protocol revision 2026-07-28).

Properties

requiredCapabilities

requiredCapabilities: object

Defined in: packages/core-internal/src/types/types.ts:786

The capabilities the server requires from the client to process the request, in the ClientCapabilities shape (only the missing capabilities are listed).

elicitation?

optional elicitation?: object

Present if the client supports eliciting user input.

Index Signature

[key: string]: string | number | boolean | {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

elicitation.form?

optional form?: object

Index Signature

[key: string]: string | number | boolean | {[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

elicitation.form.applyDefaults?

optional applyDefaults?: boolean

elicitation.url?

optional url?: object

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

experimental?

optional experimental?: object

Experimental, non-standard capabilities that the client supports.

Index Signature

[key: string]: object

extensions?

optional extensions?: object

Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).

Index Signature

[key: string]: object

roots?

optional roots?: object

Present if the client supports listing roots.

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to passing paths via tool parameters, resource URIs, or configuration.

roots.listChanged?

optional listChanged?: boolean

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

sampling?

optional sampling?: object

Present if the client supports sampling from an LLM.

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.

sampling.context?

optional context?: object

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

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

sampling.tools?

optional tools?: object

Present if the client supports tool use via tools and toolChoice parameters.

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

tasks?

optional tasks?: object

Present if the client supports task creation.

Index Signature

[key: string]: unknown

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; parsed for interoperability only — servers built on this SDK never advertise it.

tasks.cancel?

optional cancel?: object

Present if the client supports cancelling tasks.

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

tasks.list?

optional list?: object

Present if the client supports listing tasks.

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null[] | null

tasks.requests?

optional requests?: object

Capabilities for task creation on specific request types.

Index Signature

[key: string]: unknown

tasks.requests.elicitation?

optional elicitation?: object

Task support for elicitation requests.

Index Signature

[key: string]: unknown

tasks.requests.elicitation.create?

optional create?: object

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null

tasks.requests.sampling?

optional sampling?: object

Task support for sampling requests.

Index Signature

[key: string]: unknown

tasks.requests.sampling.createMessage?

optional createMessage?: object

Index Signature

[key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; } | ...[] | null


ParseError

Defined in: packages/core-internal/src/types/types.ts:760

Extends

  • JSONRPCErrorObject

Properties

code

code: -32700

Defined in: packages/core-internal/src/types/types.ts:761

Overrides

JSONRPCErrorObject.code

data?

optional data?: unknown

Defined in: packages/core-internal/src/types/types.ts:758

Inherited from

JSONRPCErrorObject.data

message

message: string

Defined in: packages/core-internal/src/types/types.ts:758

Inherited from

JSONRPCErrorObject.message


RequestHandlerSchemas

Defined in: packages/core-internal/src/shared/protocol.ts:1853

Schema bundle accepted by setRequestHandler's 3-arg form.

params is required and validates the inbound request.params. result is optional; when supplied it types the handler's return value (no runtime validation is performed on the result).

Type Parameters

P

P extends StandardSchemaV1 = StandardSchemaV1

R

R extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined

Properties

params

params: P

Defined in: packages/core-internal/src/shared/protocol.ts:1857

result?

optional result?: R

Defined in: packages/core-internal/src/shared/protocol.ts:1858


SdkHttpErrorData

Defined in: packages/core-internal/src/errors/sdkErrors.ts:114

Typed shape for HTTP error data carried by SdkHttpError.

Indexable

[key: string]: unknown

Properties

status

status: number

Defined in: packages/core-internal/src/errors/sdkErrors.ts:115

statusText?

optional statusText?: string

Defined in: packages/core-internal/src/errors/sdkErrors.ts:116


StandardSchemaV1

Defined in: packages/core-internal/src/util/standardSchema.ts:33

Extended by

Type Parameters

Input

Input = unknown

Output

Output = Input

Properties

~standard

readonly ~standard: Props<Input, Output>

Defined in: packages/core-internal/src/util/standardSchema.ts:34


StandardSchemaV1Sync

Defined in: packages/core-internal/src/util/standardSchema.ts:126

Narrowing of StandardSchemaV1 whose validate is guaranteed synchronous.

The Zod schemas backing specTypeSchemas contain no async refinements or transforms, so every entry satisfies this interface. Consumers can call validate() and access .issues / .value on the result without await.

StandardSchemaV1Sync is assignable to StandardSchemaV1 — it is a strict subtype.

Extends

Type Parameters

Input

Input = unknown

Output

Output = Input

Properties

~standard

readonly ~standard: Props<Input, Output>

Defined in: packages/core-internal/src/util/standardSchema.ts:127

Overrides

StandardSchemaV1.~standard


StandardSchemaWithJSON

Defined in: packages/core-internal/src/util/standardSchema.ts:108

Combined interface for schemas with both validation and JSON Schema conversion — the intersection of StandardSchemaV1 and StandardJSONSchemaV1.

This is the type accepted by registerTool / registerPrompt. The SDK needs ~standard.jsonSchema to advertise the tool's argument shape in tools/list, and ~standard.validate to check incoming arguments when a tools/call arrives.

Zod v4, ArkType, and Valibot (via @valibot/to-json-schema's toStandardJsonSchema) all implement both interfaces.

See

https://standardschema.dev/ for the Standard Schema specification

Type Parameters

Input

Input = unknown

Output

Output = Input

Properties

~standard

readonly ~standard: Props<Input, Output> & Props<Input, Output>

Defined in: packages/core-internal/src/util/standardSchema.ts:109


Transport

Defined in: packages/core-internal/src/shared/transport.ts:107

Describes the minimal contract for an MCP transport that a client or server can communicate over.

Properties

hasPerRequestStream?

readonly optional hasPerRequestStream?: boolean

Defined in: packages/core-internal/src/shared/transport.ts:139

true when this transport opens one underlying request per outbound JSON-RPC request (the Streamable HTTP POST-per-request model) and therefore honors TransportSendOptions.requestSignal. The 2026-07-28 spec makes closing that per-request stream the cancellation signal — the protocol layer aborts requestSignal instead of POSTing notifications/cancelled when this flag is set on a 2026-era connection. Transports that share a single channel (stdio, in-memory) leave it undefined.

onclose?

optional onclose?: () => void

Defined in: packages/core-internal/src/shared/transport.ts:146

Callback for when the connection is closed for any reason.

This should be invoked when close() is called as well.

Returns

void

onerror?

optional onerror?: (error) => void

Defined in: packages/core-internal/src/shared/transport.ts:153

Callback for when an error occurs.

Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.

Parameters
error

Error

Returns

void

onmessage?

optional onmessage?: <T>(message, extra?) => void

Defined in: packages/core-internal/src/shared/transport.ts:162

Callback for when a message (request or response) is received over the connection.

Includes the request and authInfo if the transport is authenticated.

The request can be used to get the original request information (headers, etc.)

Type Parameters
T

T extends JSONRPCMessage

Parameters
message

T

extra?

MessageExtraInfo

Returns

void

sessionId?

optional sessionId?: string

Defined in: packages/core-internal/src/shared/transport.ts:167

The session ID generated for this connection.

setProtocolVersion?

optional setProtocolVersion?: (version) => void

Defined in: packages/core-internal/src/shared/transport.ts:172

Sets the protocol version used for the connection (called when the initialize response is received).

Parameters
version

string

Returns

void

setSupportedProtocolVersions?

optional setSupportedProtocolVersions?: (versions) => void

Defined in: packages/core-internal/src/shared/transport.ts:178

Sets the supported protocol versions for header validation (called during connect). This allows the server to pass its supported versions to the transport.

Parameters
versions

string[]

Returns

void

Methods

close()

close(): Promise<void>

Defined in: packages/core-internal/src/shared/transport.ts:127

Closes the connection.

Returns

Promise<void>

send()

send(message, options?): Promise<void>

Defined in: packages/core-internal/src/shared/transport.ts:122

Sends a JSON-RPC message (request or response).

If present, relatedRequestId is used to indicate to the transport which incoming request to associate this outgoing message with.

Parameters
message

JSONRPCMessage

options?

TransportSendOptions

Returns

Promise<void>

start()

start(): Promise<void>

Defined in: packages/core-internal/src/shared/transport.ts:115

Starts processing messages on the transport, including any connection steps that might need to be taken.

This method should only be called after callbacks are installed, or else messages may be lost.

NOTE: This method should not be called explicitly when using Client or Server classes, as they will implicitly call start().

Returns

Promise<void>


UnsupportedProtocolVersionErrorData

Defined in: packages/core-internal/src/types/types.ts:793

Data carried by a -32022 UnsupportedProtocolVersion protocol error (protocol revision 2026-07-28).

Properties

requested

requested: string

Defined in: packages/core-internal/src/types/types.ts:802

The protocol version that was requested.

supported

supported: string[]

Defined in: packages/core-internal/src/types/types.ts:798

Protocol versions the receiver supports. The sender should choose a mutually supported version from this list and retry.

Type Aliases

Annotations

Annotations = Infer<typeof AnnotationsSchema>

Defined in: packages/core-internal/src/types/types.ts:267


AudioContent

AudioContent = Infer<typeof AudioContentSchema>

Defined in: packages/core-internal/src/types/types.ts:393


AuthorizationServerMetadata

AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata

Defined in: packages/core-internal/src/shared/auth.ts:285


BaseContext

BaseContext = object

Defined in: packages/core-internal/src/shared/protocol.ts:326

Base context provided to all request handlers.

Properties

http?

optional http?: object

Defined in: packages/core-internal/src/shared/protocol.ts:439

HTTP transport information, only available when using an HTTP-based transport.

authInfo?

optional authInfo?: AuthInfo

Information about a validated access token, provided to request handlers.

mcpReq

mcpReq: object

Defined in: packages/core-internal/src/shared/protocol.ts:335

Information about the MCP request being handled.

_meta?

optional _meta?: RequestMeta

Metadata from the original request, with the reserved io.modelcontextprotocol/* envelope keys already lifted out (readable via ctx.mcpReq.envelope).

droppedInputResponseKeys?

optional droppedInputResponseKeys?: string[]

Keys of inputResponses entries the SDK dropped because they were not bare response objects (for example the wrapped {method, result} shape some peers emit). Surfaced so a handler can re-issue the corresponding input request rather than hard-fail.

envelope?

optional envelope?: Partial<RequestMetaEnvelope>

The per-request _meta envelope (protocol revision 2026-07-28): the reserved io.modelcontextprotocol/* keys carried by the request, lifted out of the _meta the handler sees. Surfaced as received — Partial because only the keys the request actually carried are present (envelope requiredness is enforced per request at dispatch time, not by the lift); only present at all when the request carried envelope keys.

id

id: RequestId

The JSON-RPC ID of the request being handled.

inputResponses?

optional inputResponses?: Record<string, unknown>

Multi-round-trip input responses carried by a retried request (protocol revision 2026-07-28), lifted out of the params the handler sees. Entries are the BARE response objects keyed by the identifiers the server assigned in inputRequests; entries that do not look like bare responses (e.g. a {method, result} wrapper) are dropped and their keys recorded in droppedInputResponseKeys.

The values arrive from the client and are NOT validated by the SDK — treat them as untrusted input.

method

method: string

The method name of the request (e.g., 'tools/call', 'ping').

notify

notify: (notification) => Promise<void>

Sends a notification that relates to the current request being handled.

This is used by certain transports to correctly associate related messages.

Parameters
notification

Notification

Returns

Promise<void>

requestState

requestState: RequestStateAccessor

Reads the multi-round-trip request state for the current round: the value the configured ServerOptions.requestState.verify hook resolved with (e.g. createRequestStateCodec.verify's decoded payload — mint<T>/requestState<T>() are the typed pair), the raw wire string when no hook is configured, or undefined when the round carried no state. The type parameter is a compile-time cast only.

SECURITY: requestState round-trips through the client and MUST be treated as attacker-controlled input. The SDK applies no integrity protection by default — servers whose state influences authorization or business logic MUST integrity-protect it and verify via the requestState.verify hook (spec: basic/patterns/mrtr, server requirements 4–5).

send

send: {<M>(request, options?): Promise<ResultTypeMap[M]>; <T>(request, resultSchema, options?): Promise<InferOutput<T>>; }

Sends a request that relates to the current request being handled.

This is used by certain transports to correctly associate related messages.

For spec methods the result type is inferred from the method name. For custom (non-spec) methods, pass a result schema as the second argument.

Call Signature

<M>(request, options?): Promise<ResultTypeMap[M]>

Type Parameters
M

M extends RequestMethod

Parameters
request
method

M

params?

Record<string, unknown>

options?

RequestOptions

Returns

Promise<ResultTypeMap[M]>

Call Signature

<T>(request, resultSchema, options?): Promise<InferOutput<T>>

Type Parameters
T

T extends StandardSchemaV1<unknown, unknown>

Parameters
request
method

string = ...

params?

{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; } = ...

params._meta?

{[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; } = ...

See General fields: _meta for notes on _meta usage.

{ taskId: string; } = ...

If specified, this request is related to the provided task.

string = ...

params._meta.progressToken?

string | number = ...

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.

resultSchema

T

options?

RequestOptions

Returns

Promise<InferOutput<T>>

signal

signal: AbortSignal

An abort signal used to communicate if the request was cancelled from the sender's side.

sessionId?

optional sessionId?: string

Defined in: packages/core-internal/src/shared/protocol.ts:330

The session ID from the transport, if available.


BaseMetadata

BaseMetadata = Infer<typeof BaseMetadataSchema>

Defined in: packages/core-internal/src/types/types.ts:266


BlobResourceContents

BlobResourceContents = Infer<typeof BlobResourceContentsSchema>

Defined in: packages/core-internal/src/types/types.ts:355


BooleanSchema

BooleanSchema = Infer<typeof BooleanSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:520


CacheScope

CacheScope = "public" | "private"

Defined in: packages/core-internal/src/shared/resultCacheHints.ts:25

The cache scopes defined for cacheable results (SEP-2549).


CallToolRequest

CallToolRequest = Infer<typeof CallToolRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:422


CallToolRequestParams

CallToolRequestParams = Infer<typeof CallToolRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:419


CallToolResult

CallToolResult = StripWireOnly<Infer<typeof CallToolResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:420


CancelledNotification

CancelledNotification = Infer<typeof CancelledNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:261


CancelledNotificationParams

CancelledNotificationParams = Infer<typeof CancelledNotificationParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:260


CancelTaskRequest

CancelTaskRequest = Infer<typeof CancelTaskRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:341

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


CancelTaskResult

CancelTaskResult = StripWireOnly<Infer<typeof CancelTaskResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:343

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


CfWorkerSchemaDraft

CfWorkerSchemaDraft = "4" | "7" | "2019-09" | "2020-12"

Defined in: packages/core-internal/src/validators/cfWorkerProvider.ts:18

JSON Schema draft version supported by @cfworker/json-schema.


ClientCapabilities

ClientCapabilities = Infer<typeof ClientCapabilitiesSchema>

Defined in: packages/core-internal/src/types/types.ts:279

Capabilities a client may support.

Note: the roots and sampling capabilities are deprecated as of protocol version 2026-07-28 (SEP-2577); they remain in the specification for at least twelve months. See ClientCapabilitiesSchema.


ClientContext

ClientContext = BaseContext

Defined in: packages/core-internal/src/shared/protocol.ts:510

Context provided to client-side request handlers.


ClientNotification

ClientNotification = Infer<typeof ClientNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:654


ClientRequest

ClientRequest = Infer<typeof ClientRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:653


ClientResult

ClientResult = StripWireOnly<Infer<typeof ClientResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:655


CompatibilityCallToolResult

CompatibilityCallToolResult = StripWireOnly<Infer<typeof CompatibilityCallToolResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:421


CompleteRequest

CompleteRequest = Infer<typeof CompleteRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:546


CompleteRequestParams

CompleteRequestParams = Infer<typeof CompleteRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:545


CompleteRequestPrompt

CompleteRequestPrompt = ExpandRecursively<CompleteRequest & object>

Defined in: packages/core-internal/src/types/types.ts:946


CompleteRequestResourceTemplate

CompleteRequestResourceTemplate = ExpandRecursively<CompleteRequest & object>

Defined in: packages/core-internal/src/types/types.ts:943


CompleteResult

CompleteResult = StripWireOnly<Infer<typeof CompleteResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:547


ContentBlock

ContentBlock = Infer<typeof ContentBlockSchema>

Defined in: packages/core-internal/src/types/types.ts:408


CreateMessageRequest

CreateMessageRequest = Infer<typeof CreateMessageRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:505

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


CreateMessageRequestParams

CreateMessageRequestParams = Infer<typeof CreateMessageRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:499

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


CreateMessageRequestParamsBase

CreateMessageRequestParamsBase = Omit<CreateMessageRequestParams, "tools" | "toolChoice">

Defined in: packages/core-internal/src/types/types.ts:930

CreateMessageRequestParams without tools - for backwards-compatible overload. Excludes tools/toolChoice to indicate they should not be provided.

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


CreateMessageResult

CreateMessageResult = StripWireOnly<Infer<typeof CreateMessageResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:511

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


CreateMessageResultWithTools

CreateMessageResultWithTools = StripWireOnly<Infer<typeof CreateMessageResultWithToolsSchema>>

Defined in: packages/core-internal/src/types/types.ts:517

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


CreateTaskResult

CreateTaskResult = StripWireOnly<Infer<typeof CreateTaskResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:325

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


Cursor

Cursor = Infer<typeof CursorSchema>

Defined in: packages/core-internal/src/types/types.ts:222


DiscoverRequest

DiscoverRequest = Infer<typeof DiscoverRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:294


DiscoverResult

DiscoverResult = StripWireOnly<Infer<typeof DiscoverResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:295


ElicitationCompleteNotification

ElicitationCompleteNotification = Infer<typeof ElicitationCompleteNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:539

Deprecated

Removed from the spec by #2891 (2026-07-28). 2025-era only; the 2026-07-28 wire codec excludes this notification.


ElicitationCompleteNotificationParams

ElicitationCompleteNotificationParams = Infer<typeof ElicitationCompleteNotificationParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:537

Deprecated

Removed from the spec by #2891 (2026-07-28). 2025-era only; the 2026-07-28 wire codec excludes this notification.


ElicitRequest

ElicitRequest = Infer<typeof ElicitRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:535


ElicitRequestFormParams

ElicitRequestFormParams = Infer<typeof ElicitRequestFormParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:533


ElicitRequestParams

ElicitRequestParams = Infer<typeof ElicitRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:532


ElicitRequestURLParams

ElicitRequestURLParams = Infer<typeof ElicitRequestURLParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:534


ElicitResult

ElicitResult = StripWireOnly<Infer<typeof ElicitResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:540


EmbeddedResource

EmbeddedResource = Infer<typeof EmbeddedResourceSchema>

Defined in: packages/core-internal/src/types/types.ts:406


EmptyResult

EmptyResult = StripWireOnly<Infer<typeof EmptyResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:257


EnumSchema

EnumSchema = Infer<typeof EnumSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:523


FetchLike

FetchLike = (url, init?) => Promise<Response>

Defined in: packages/core-internal/src/shared/transport.ts:3

Parameters

url

string | URL

init?

RequestInit

Returns

Promise<Response>


GetPromptRequest

GetPromptRequest = Infer<typeof GetPromptRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:390


GetPromptRequestParams

GetPromptRequestParams = Infer<typeof GetPromptRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:389


GetPromptResult

GetPromptResult = StripWireOnly<Infer<typeof GetPromptResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:410


GetTaskPayloadRequest

GetTaskPayloadRequest = Infer<typeof GetTaskPayloadRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:335

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


GetTaskPayloadResult

GetTaskPayloadResult = StripWireOnly<Infer<typeof GetTaskPayloadResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:345

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


GetTaskRequest

GetTaskRequest = Infer<typeof GetTaskRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:331

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


GetTaskResult

GetTaskResult = StripWireOnly<Infer<typeof GetTaskResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:333

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


HandlerResultTypeMap

HandlerResultTypeMap = { [M in keyof ResultTypeMap]: M extends "tools/call" | "prompts/get" | "resources/read" ? ResultTypeMap[M] | InputRequiredResult : ResultTypeMap[M] }

Defined in: packages/core-internal/src/types/types.ts:715

The handler-return counterpart of ResultTypeMap: what a registered request handler may RETURN for each method. Identical to ResultTypeMap except that the multi-round-trip methods (tools/call, prompts/get, resources/read) additionally accept an InputRequiredResult (protocol revision 2026-07-28).

ResultTypeMap itself — what a requester receives — is deliberately NOT widened: client.callTool() returns a plain CallToolResult on both protocol eras.


Icon

Icon = Infer<typeof IconSchema>

Defined in: packages/core-internal/src/types/types.ts:264


Icons

Icons = Infer<typeof IconsSchema>

Defined in: packages/core-internal/src/types/types.ts:265


IdJagTokenExchangeResponse

IdJagTokenExchangeResponse = z.infer<typeof IdJagTokenExchangeResponseSchema>

Defined in: packages/core-internal/src/shared/auth.ts:163


ImageContent

ImageContent = Infer<typeof ImageContentSchema>

Defined in: packages/core-internal/src/types/types.ts:392


Implementation

Implementation = Infer<typeof ImplementationSchema>

Defined in: packages/core-internal/src/types/types.ts:271


InboundClassificationOutcome

InboundClassificationOutcome = InboundLegacyRoute | InboundModernRoute | InboundLadderRejection

Defined in: packages/core-internal/src/shared/inboundClassification.ts:199

The outcome of classifying one inbound HTTP request.


InboundLegacyRouteReason

InboundLegacyRouteReason = "http-method" | "initialize" | "no-claim" | "notification" | "batch" | "response"

Defined in: packages/core-internal/src/shared/inboundClassification.ts:108

Why an inbound request was routed to legacy-era serving.


InboundModernRoute

InboundModernRoute = { classification: MessageClassification; kind: "modern"; message: JSONRPCRequest; messageKind: "request"; } | { classification: MessageClassification; kind: "modern"; message: JSONRPCNotification; messageKind: "notification"; }

Defined in: packages/core-internal/src/shared/inboundClassification.ts:144

The request claims the per-request envelope mechanism and is served on the modern path. Discriminated by messageKind so the typed message narrows with it — the classifier has already proved the JSON-RPC shape via the isJSONRPCRequest / isJSONRPCNotification guards, so consumers never cast the body again.

Union Members

Type Literal

{ classification: MessageClassification; kind: "modern"; message: JSONRPCRequest; messageKind: "request"; }

classification

classification: MessageClassification

The classification handed to the per-request transport and validated by the protocol layer against the serving instance's negotiated era.

kind

kind: "modern"

message

message: JSONRPCRequest

The classified body — guard-proved JSONRPCRequest shape.

messageKind

messageKind: "request"


Type Literal

{ classification: MessageClassification; kind: "modern"; message: JSONRPCNotification; messageKind: "notification"; }

classification

classification: MessageClassification

kind

kind: "modern"

message

message: JSONRPCNotification

The classified body — guard-proved JSONRPCNotification shape.

messageKind

messageKind: "notification"


InboundValidationRung

InboundValidationRung = "http-method" | "jsonrpc-shape" | "era-classification" | "envelope" | "method-registry" | "request-params" | "standard-header-validation" | "client-capabilities" | "param-header-validation"

Defined in: packages/core-internal/src/shared/inboundClassification.ts:165

The named steps of the inbound validation ladder, in evaluation order.


InitializedNotification

InitializedNotification = Infer<typeof InitializedNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:291


InitializeRequest

InitializeRequest = Infer<typeof InitializeRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:281


InitializeRequestParams

InitializeRequestParams = Infer<typeof InitializeRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:280


InitializeResult

InitializeResult = StripWireOnly<Infer<typeof InitializeResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:290


InputRequest

InputRequest = CreateMessageRequest | ListRootsRequest | ElicitRequest

Defined in: packages/core-internal/src/types/types.ts:592

A single embedded (de-JSON-RPC'd) input request inside an InputRequiredResult: an elicitation, sampling, or roots request object carried in-band rather than sent as a server→client JSON-RPC request.


InputResponse

InputResponse = CreateMessageResult | ListRootsResult | ElicitResult

Defined in: packages/core-internal/src/types/types.ts:599

A single embedded (de-JSON-RPC'd) input response inside a retried request's inputResponses: the bare result object for the corresponding InputRequest (never wrapped in a {method, result} envelope).


InputResponseView

InputResponseView = { kind: "missing"; } | { action: "accept" | "decline" | "cancel"; content?: Record<string, unknown>; kind: "elicit"; } | { kind: "sampling"; result: CreateMessageResult | CreateMessageResultWithTools; } | { kind: "roots"; roots: Root[]; }

Defined in: packages/core-internal/src/shared/inputRequired.ts:193

The discriminated view inputResponse returns: which kind of embedded response (if any) a retried request carried for a key. Bare response objects are discriminated structurally — an action member means an elicitation result, a roots array a roots listing, a role + content pair a sampling result. A missing key or an entry that matches none of the three shapes reads as { kind: 'missing' }.


JSONArray

JSONArray = JSONValue[]

Defined in: packages/core-internal/src/types/types.ts:181


JSONObject

JSONObject = object

Defined in: packages/core-internal/src/types/types.ts:180

Index Signature

[key: string]: JSONValue


JSONRPCErrorResponse

JSONRPCErrorResponse = Infer<typeof JSONRPCErrorResponseSchema>

Defined in: packages/core-internal/src/types/types.ts:232


JSONRPCMessage

JSONRPCMessage = JSONRPCRequest | JSONRPCNotification | JSONRPCResultResponse | JSONRPCErrorResponse

Defined in: packages/core-internal/src/types/types.ts:237


JSONRPCNotification

JSONRPCNotification = Infer<typeof JSONRPCNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:231


JSONRPCRequest

JSONRPCRequest = Infer<typeof JSONRPCRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:230


JSONRPCResponse

JSONRPCResponse = JSONRPCResultResponse | JSONRPCErrorResponse

Defined in: packages/core-internal/src/types/types.ts:236


JSONRPCResultResponse

JSONRPCResultResponse = Omit<Infer<typeof JSONRPCResultResponseSchema>, "result"> & object

Defined in: packages/core-internal/src/types/types.ts:235

Type Declaration

result

result: Result


JsonSchemaType

JsonSchemaType = JSONSchema.Interface

Defined in: packages/core-internal/src/validators/types.ts:14

JSON Schema type definition (JSON Schema Draft 2020-12)

This uses the object form of JSON Schema (excluding boolean schemas). While true and false are valid JSON Schemas, this SDK uses the object form for practical type safety.

Re-exported from json-schema-typed for convenience.

See

https://json-schema.org/draft/2020-12/json-schema-core.html


JsonSchemaValidator

JsonSchemaValidator<T> = (input) => JsonSchemaValidatorResult<T>

Defined in: packages/core-internal/src/validators/types.ts:26

A validator function that validates data against a JSON Schema

Type Parameters

T

T

Parameters

input

unknown

Returns

JsonSchemaValidatorResult<T>


JsonSchemaValidatorResult

JsonSchemaValidatorResult<T> = { data: T; errorMessage: undefined; valid: true; } | { data: undefined; errorMessage: string; valid: false; }

Defined in: packages/core-internal/src/validators/types.ts:19

Result of a JSON Schema validation operation

Type Parameters

T

T


JSONValue

JSONValue = string | number | boolean | null | JSONObject | JSONArray

Defined in: packages/core-internal/src/types/types.ts:179


LegacyTitledEnumSchema

LegacyTitledEnumSchema = Infer<typeof LegacyTitledEnumSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:526


ListChangedCallback

ListChangedCallback<T> = (error, items) => void

Defined in: packages/core-internal/src/types/types.ts:808

Callback type for list changed notifications.

Type Parameters

T

T

Parameters

error

Error | null

items

T[] | null

Returns

void


ListChangedHandlers

ListChangedHandlers = object

Defined in: packages/core-internal/src/types/types.ts:845

Configuration for list changed notification handlers.

Use this to configure handlers for tools, prompts, and resources list changes when creating a client.

Note: Handlers are only activated if the server advertises the corresponding listChanged capability (e.g., tools.listChanged: true). If the server doesn't advertise this capability, the handler will not be set up.

Properties

prompts?

optional prompts?: ListChangedOptions<Prompt>

Defined in: packages/core-internal/src/types/types.ts:853

Handler for prompt list changes.

resources?

optional resources?: ListChangedOptions<Resource>

Defined in: packages/core-internal/src/types/types.ts:857

Handler for resource list changes.

tools?

optional tools?: ListChangedOptions<Tool>

Defined in: packages/core-internal/src/types/types.ts:849

Handler for tool list changes.


ListChangedOptions

ListChangedOptions<T> = object

Defined in: packages/core-internal/src/types/types.ts:815

Options for subscribing to list changed notifications.

Type Parameters

T

T

The type of items in the list (Tool, Prompt, or Resource)

Properties

autoRefresh?

optional autoRefresh?: boolean

Defined in: packages/core-internal/src/types/types.ts:820

If true, the list will be refreshed automatically when a list changed notification is received.

Default
ts
true
debounceMs?

optional debounceMs?: number

Defined in: packages/core-internal/src/types/types.ts:825

Debounce time in milliseconds. Set to 0 to disable.

Default
ts
300
onChanged

onChanged: ListChangedCallback<T>

Defined in: packages/core-internal/src/types/types.ts:832

Callback invoked when the list changes.

If autoRefresh is true, items contains the updated list. If autoRefresh is false, items is null (caller should refresh manually).


ListPromptsRequest

ListPromptsRequest = Infer<typeof ListPromptsRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:387


ListPromptsResult

ListPromptsResult = StripWireOnly<Infer<typeof ListPromptsResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:388


ListResourcesRequest

ListResourcesRequest = Infer<typeof ListResourcesRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:359


ListResourcesResult

ListResourcesResult = StripWireOnly<Infer<typeof ListResourcesResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:360


ListResourceTemplatesRequest

ListResourceTemplatesRequest = Infer<typeof ListResourceTemplatesRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:361


ListResourceTemplatesResult

ListResourceTemplatesResult = StripWireOnly<Infer<typeof ListResourceTemplatesResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:362


ListRootsRequest

ListRootsRequest = Infer<typeof ListRootsRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:561

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to passing paths via tool parameters, resource URIs, or configuration.


ListRootsResult

ListRootsResult = StripWireOnly<Infer<typeof ListRootsResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:567

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to passing paths via tool parameters, resource URIs, or configuration.


ListTasksRequest

ListTasksRequest = Infer<typeof ListTasksRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:337

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


ListTasksResult

ListTasksResult = StripWireOnly<Infer<typeof ListTasksResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:339

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


ListToolsRequest

ListToolsRequest = Infer<typeof ListToolsRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:417


ListToolsResult

ListToolsResult = StripWireOnly<Infer<typeof ListToolsResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:418


LoggingLevel

LoggingLevel = Infer<typeof LoggingLevelSchema>

Defined in: packages/core-internal/src/types/types.ts:431

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to stderr logging (STDIO servers) or OpenTelemetry.


LoggingMessageNotification

LoggingMessageNotification = Infer<typeof LoggingMessageNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:455

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to stderr logging (STDIO servers) or OpenTelemetry.


LoggingMessageNotificationParams

LoggingMessageNotificationParams = Infer<typeof LoggingMessageNotificationParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:449

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to stderr logging (STDIO servers) or OpenTelemetry.


MetaObject

MetaObject = Record<string, unknown>

Defined in: packages/core-internal/src/types/types.ts:919


ModelHint

ModelHint = Infer<typeof ModelHintSchema>

Defined in: packages/core-internal/src/types/types.ts:469

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


ModelPreferences

ModelPreferences = Infer<typeof ModelPreferencesSchema>

Defined in: packages/core-internal/src/types/types.ts:475

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


MultiSelectEnumSchema

MultiSelectEnumSchema = Infer<typeof MultiSelectEnumSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:530


Notification

Notification = Infer<typeof NotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:227


NotificationMethod

NotificationMethod = Exclude<ClientNotification["method"] | ServerNotification["method"], TaskNotificationMethod>

Defined in: packages/core-internal/src/types/types.ts:676


NotificationOptions

NotificationOptions = object

Defined in: packages/core-internal/src/shared/protocol.ts:172

Options that can be given per notification.

Properties

relatedRequestId?

optional relatedRequestId?: RequestId

Defined in: packages/core-internal/src/shared/protocol.ts:176

May be used to indicate to the transport which incoming request to associate this outgoing notification with.


NotificationParams

NotificationParams = Infer<typeof NotificationsParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:239


NotificationTypeMap

NotificationTypeMap = MethodToTypeMap<Exclude<ClientNotification | ServerNotification, { method: TaskNotificationMethod; }>>

Defined in: packages/core-internal/src/types/types.ts:678


NumberSchema

NumberSchema = Infer<typeof NumberSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:522


OAuthClientInformation

OAuthClientInformation = z.infer<typeof OAuthClientInformationSchema>

Defined in: packages/core-internal/src/shared/auth.ts:257


OAuthClientInformationFull

OAuthClientInformationFull = z.infer<typeof OAuthClientInformationFullSchema>

Defined in: packages/core-internal/src/shared/auth.ts:258


OAuthClientInformationMixed

OAuthClientInformationMixed = OAuthClientInformation | OAuthClientInformationFull

Defined in: packages/core-internal/src/shared/auth.ts:259


OAuthClientMetadata

OAuthClientMetadata = z.infer<typeof OAuthClientMetadataSchema>

Defined in: packages/core-internal/src/shared/auth.ts:256


OAuthClientRegistrationError

OAuthClientRegistrationError = z.infer<typeof OAuthClientRegistrationErrorSchema>

Defined in: packages/core-internal/src/shared/auth.ts:280


OAuthErrorResponse

OAuthErrorResponse = z.infer<typeof OAuthErrorResponseSchema>

Defined in: packages/core-internal/src/shared/auth.ts:255


OAuthMetadata

OAuthMetadata = z.infer<typeof OAuthMetadataSchema>

Defined in: packages/core-internal/src/shared/auth.ts:250


OAuthProtectedResourceMetadata

OAuthProtectedResourceMetadata = z.infer<typeof OAuthProtectedResourceMetadataSchema>

Defined in: packages/core-internal/src/shared/auth.ts:282


OAuthTokenRevocationRequest

OAuthTokenRevocationRequest = z.infer<typeof OAuthTokenRevocationRequestSchema>

Defined in: packages/core-internal/src/shared/auth.ts:281


OAuthTokens

OAuthTokens = z.infer<typeof OAuthTokensSchema>

Defined in: packages/core-internal/src/shared/auth.ts:254


OpenIdProviderDiscoveryMetadata

OpenIdProviderDiscoveryMetadata = z.infer<typeof OpenIdProviderDiscoveryMetadataSchema>

Defined in: packages/core-internal/src/shared/auth.ts:252


OpenIdProviderMetadata

OpenIdProviderMetadata = z.infer<typeof OpenIdProviderMetadataSchema>

Defined in: packages/core-internal/src/shared/auth.ts:251


PaginatedRequest

PaginatedRequest = Infer<typeof PaginatedRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:349


PaginatedRequestParams

PaginatedRequestParams = Infer<typeof PaginatedRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:348


PaginatedResult

PaginatedResult = StripWireOnly<Infer<typeof PaginatedResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:350


PingRequest

PingRequest = Infer<typeof PingRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:298


PrimitiveSchemaDefinition

PrimitiveSchemaDefinition = Infer<typeof PrimitiveSchemaDefinitionSchema>

Defined in: packages/core-internal/src/types/types.ts:531


Progress

Progress = Infer<typeof ProgressSchema>

Defined in: packages/core-internal/src/types/types.ts:301


ProgressCallback

ProgressCallback = (progress) => void

Defined in: packages/core-internal/src/shared/protocol.ts:59

Callback for progress notifications.

Parameters

progress

Progress

Returns

void


ProgressNotification

ProgressNotification = Infer<typeof ProgressNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:303


ProgressNotificationParams

ProgressNotificationParams = Infer<typeof ProgressNotificationParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:302


ProgressToken

ProgressToken = Infer<typeof ProgressTokenSchema>

Defined in: packages/core-internal/src/types/types.ts:221


Prompt

Prompt = Infer<typeof PromptSchema>

Defined in: packages/core-internal/src/types/types.ts:386


PromptArgument

PromptArgument = Infer<typeof PromptArgumentSchema>

Defined in: packages/core-internal/src/types/types.ts:385


PromptListChangedNotification

PromptListChangedNotification = Infer<typeof PromptListChangedNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:411


PromptMessage

PromptMessage = Infer<typeof PromptMessageSchema>

Defined in: packages/core-internal/src/types/types.ts:409


PromptReference

PromptReference = Infer<typeof PromptReferenceSchema>

Defined in: packages/core-internal/src/types/types.ts:544


ProtocolEra

ProtocolEra = "legacy" | "modern"

Defined in: packages/core-internal/src/shared/protocolEras.ts:19

The protocol era of a connection: 'legacy' for the 2025-11-25 family and earlier (negotiated via initialize), 'modern' for 2026-07-28 and later (negotiated via server/discover; every request carries a _meta envelope).


ProtocolOptions

ProtocolOptions = object

Defined in: packages/core-internal/src/shared/protocol.ts:64

Additional initialization options.

Properties

debouncedNotificationMethods?

optional debouncedNotificationMethods?: string[]

Defined in: packages/core-internal/src/shared/protocol.ts:89

An array of notification method names that should be automatically debounced. Any notifications with a method in this list will be coalesced if they occur in the same tick of the event loop. e.g., ['notifications/tools/list_changed']

enforceStrictCapabilities?

optional enforceStrictCapabilities?: boolean

Defined in: packages/core-internal/src/shared/protocol.ts:82

Whether to restrict emitted requests to only those that the remote side has indicated that they can handle, through their advertised capabilities.

Note that this DOES NOT affect checking of local side capabilities, as it is considered a logic error to mis-specify those.

Currently this defaults to false, for backwards compatibility with SDK versions that did not advertise capabilities correctly. In future, this will default to true.

supportedProtocolVersions?

optional supportedProtocolVersions?: string[]

Defined in: packages/core-internal/src/shared/protocol.ts:73

Protocol versions supported. The legacy initialize handshake offers and falls back to the first 2025-era entry in the list (the client sends it, the server counter-offers it); 2026-era entries are only ever selected via server/discover. Passed to transport during connect().

Default

SUPPORTED_PROTOCOL_VERSIONS


ReadResourceRequest

ReadResourceRequest = Infer<typeof ReadResourceRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:365


ReadResourceRequestParams

ReadResourceRequestParams = Infer<typeof ReadResourceRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:364


ReadResourceResult

ReadResourceResult = StripWireOnly<Infer<typeof ReadResourceResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:366


RelatedTaskMetadata

RelatedTaskMetadata = Infer<typeof RelatedTaskMetadataSchema>

Defined in: packages/core-internal/src/types/types.ts:323

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


Request

Request = Infer<typeof RequestSchema>

Defined in: packages/core-internal/src/types/types.ts:223


RequestId

RequestId = Infer<typeof RequestIdSchema>

Defined in: packages/core-internal/src/types/types.ts:229


RequestMeta

RequestMeta = Infer<typeof RequestMetaSchema>

Defined in: packages/core-internal/src/types/types.ts:226


RequestMetaEnvelope

RequestMetaEnvelope = object

Defined in: packages/core-internal/src/types/types.ts:249

The per-request _meta envelope carried by every request under protocol revision 2026-07-28 (protocol version, client info, client capabilities, optional log level).

Neutral hand-written shape keyed by the public meta-key constants — never inferred from a wire-module schema (this neutral layer does not import from wire/rev*). A type alias rather than an interface so it stays assignable to _meta's string-indexed object slot.

Properties

io.modelcontextprotocol/clientCapabilities

io.modelcontextprotocol/clientCapabilities: ClientCapabilities

Defined in: packages/core-internal/src/types/types.ts:252

io.modelcontextprotocol/clientInfo

io.modelcontextprotocol/clientInfo: Implementation

Defined in: packages/core-internal/src/types/types.ts:251

io.modelcontextprotocol/logLevel?

optional io.modelcontextprotocol/logLevel?: LoggingLevel

Defined in: packages/core-internal/src/types/types.ts:253

io.modelcontextprotocol/protocolVersion

io.modelcontextprotocol/protocolVersion: string

Defined in: packages/core-internal/src/types/types.ts:250


RequestMetaObject

RequestMetaObject = RequestMeta

Defined in: packages/core-internal/src/types/types.ts:920


RequestMethod

RequestMethod = Exclude<ClientRequest["method"] | ServerRequest["method"], TaskRequestMethod>

Defined in: packages/core-internal/src/types/types.ts:675


RequestOptions

RequestOptions = object & TransportSendOptions

Defined in: packages/core-internal/src/shared/protocol.ts:100

Options that can be given per request.

Type Declaration

allowInputRequired?

optional allowInputRequired?: boolean

Manual multi-round-trip mode for this call (protocol revision 2026-07-28): when the response is an input_required result, hand it back to the caller instead of auto-fulfilling it (or raising a typed error). The resolved value is the neutral input-required shape (resultType: 'input_required', inputRequests?, requestState?); wrap the result schema with withInputRequired() on the explicit schema path to type both outcomes. The caller is then responsible for gathering the requested input and retrying the original request with inputResponses / requestState params and a fresh request.

Default: false.

maxTotalTimeout?

optional maxTotalTimeout?: number

Maximum total time (in milliseconds) to wait for a response. If exceeded, an SdkError with code SdkErrorCode.RequestTimeout will be raised, regardless of progress notifications. If not specified, there is no maximum total timeout.

For multi-round-trip requests fulfilled by the auto-fulfilment driver (protocol revision 2026-07-28), the budget bounds the WHOLE flow: every retry leg is given only the time remaining.

onprogress?

optional onprogress?: ProgressCallback

If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked.

resetTimeoutOnProgress?

optional resetTimeoutOnProgress?: boolean

If true, receiving a progress notification will reset the request timeout. This is useful for long-running operations that send periodic progress updates. Default: false

signal?

optional signal?: AbortSignal

Can be used to cancel an in-flight request. This will cause an AbortError to be raised from request().

timeout?

optional timeout?: number

A timeout (in milliseconds) for this request. If exceeded, an SdkError with code SdkErrorCode.RequestTimeout will be raised from request().

If not specified, DEFAULT_REQUEST_TIMEOUT_MSEC will be used as the timeout.


RequestParams

RequestParams = Infer<typeof BaseRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:238


RequestStateAccessor

RequestStateAccessor = <T>() => T | undefined

Defined in: packages/core-internal/src/shared/protocol.ts:292

The type of ctx.mcpReq.requestState. The type parameter is caller-asserted (no validation, like the two-argument acceptedContent<T>) — pair with createRequestStateCodec<T> so the claim is backed by the codec's verification.

Type Parameters

T

T = unknown

Returns

T | undefined


RequestTypeMap

RequestTypeMap = MethodToTypeMap<Exclude<ClientRequest | ServerRequest, { method: TaskRequestMethod; }>>

Defined in: packages/core-internal/src/types/types.ts:677


Resource

Resource = Infer<typeof ResourceSchema>

Defined in: packages/core-internal/src/types/types.ts:356


ResourceContents

ResourceContents = Infer<typeof ResourceContentsSchema>

Defined in: packages/core-internal/src/types/types.ts:353


ResourceLink = Infer<typeof ResourceLinkSchema>

Defined in: packages/core-internal/src/types/types.ts:407


ResourceListChangedNotification

ResourceListChangedNotification = Infer<typeof ResourceListChangedNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:367


ResourceRequestParams

ResourceRequestParams = Infer<typeof ResourceRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:363


ResourceTemplateReference

ResourceTemplateReference = Infer<typeof ResourceTemplateReferenceSchema>

Defined in: packages/core-internal/src/types/types.ts:543


ResourceTemplateType

ResourceTemplateType = Infer<typeof ResourceTemplateSchema>

Defined in: packages/core-internal/src/types/types.ts:358


ResourceUpdatedNotification

ResourceUpdatedNotification = Infer<typeof ResourceUpdatedNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:373


ResourceUpdatedNotificationParams

ResourceUpdatedNotificationParams = Infer<typeof ResourceUpdatedNotificationParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:372


Result

Result = StripWireOnly<Infer<typeof ResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:228


ResultTypeMap

ResultTypeMap = object

Defined in: packages/core-internal/src/types/types.ts:679

Properties

completion/complete

completion/complete: CompleteResult

Defined in: packages/core-internal/src/types/types.ts:683

elicitation/create

elicitation/create: ElicitResult

Defined in: packages/core-internal/src/types/types.ts:700

initialize

initialize: InitializeResult

Defined in: packages/core-internal/src/types/types.ts:681

logging/setLevel

logging/setLevel: EmptyResult

Defined in: packages/core-internal/src/types/types.ts:684

ping

ping: EmptyResult

Defined in: packages/core-internal/src/types/types.ts:680

prompts/get

prompts/get: GetPromptResult

Defined in: packages/core-internal/src/types/types.ts:685

prompts/list

prompts/list: ListPromptsResult

Defined in: packages/core-internal/src/types/types.ts:686

resources/list

resources/list: ListResourcesResult

Defined in: packages/core-internal/src/types/types.ts:687

resources/read

resources/read: ReadResourceResult

Defined in: packages/core-internal/src/types/types.ts:689

resources/subscribe

resources/subscribe: EmptyResult

Defined in: packages/core-internal/src/types/types.ts:690

resources/templates/list

resources/templates/list: ListResourceTemplatesResult

Defined in: packages/core-internal/src/types/types.ts:688

resources/unsubscribe

resources/unsubscribe: EmptyResult

Defined in: packages/core-internal/src/types/types.ts:691

roots/list

roots/list: ListRootsResult

Defined in: packages/core-internal/src/types/types.ts:701

sampling/createMessage

sampling/createMessage: CreateMessageResult | CreateMessageResultWithTools

Defined in: packages/core-internal/src/types/types.ts:699

server/discover

server/discover: DiscoverResult

Defined in: packages/core-internal/src/types/types.ts:682

subscriptions/listen

subscriptions/listen: SubscriptionsListenResult

Defined in: packages/core-internal/src/types/types.ts:696

tools/call

tools/call: CallToolResult

Defined in: packages/core-internal/src/types/types.ts:697

tools/list

tools/list: ListToolsResult

Defined in: packages/core-internal/src/types/types.ts:698


Role

Role = Infer<typeof RoleSchema>

Defined in: packages/core-internal/src/types/types.ts:268


Root

Root = Infer<typeof RootSchema>

Defined in: packages/core-internal/src/types/types.ts:555

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to passing paths via tool parameters, resource URIs, or configuration.


RootsListChangedNotification

RootsListChangedNotification = Infer<typeof RootsListChangedNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:573

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to passing paths via tool parameters, resource URIs, or configuration.


SamplingContent

SamplingContent = Infer<typeof SamplingContentSchema>

Defined in: packages/core-internal/src/types/types.ts:481

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


SamplingMessage

SamplingMessage = Infer<typeof SamplingMessageSchema>

Defined in: packages/core-internal/src/types/types.ts:493

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


SamplingMessageContentBlock

SamplingMessageContentBlock = Infer<typeof SamplingMessageContentBlockSchema>

Defined in: packages/core-internal/src/types/types.ts:487

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


ServerCapabilities

ServerCapabilities = Infer<typeof ServerCapabilitiesSchema>

Defined in: packages/core-internal/src/types/types.ts:289

Capabilities a server may support.

Note: the logging capability is deprecated as of protocol version 2026-07-28 (SEP-2577); it remains in the specification for at least twelve months. See ServerCapabilitiesSchema.


ServerContext

ServerContext = BaseContext & object

Defined in: packages/core-internal/src/shared/protocol.ts:450

Context provided to server-side request handlers, extending BaseContext with server-specific fields.

Type Declaration

http?

optional http?: object

http.closeSSE?

optional closeSSE?: () => void

Closes the SSE stream for this request, triggering client reconnection. Only available when using a StreamableHTTPServerTransport with eventStore configured.

Returns

void

http.closeStandaloneSSE?

optional closeStandaloneSSE?: () => void

Closes the standalone GET SSE stream, triggering client reconnection. Only available when using a StreamableHTTPServerTransport with eventStore configured.

Returns

void

http.req?

optional req?: globalThis.Request

The original HTTP request.

mcpReq

mcpReq: object

mcpReq.elicitInput

elicitInput: (params, options?) => Promise<ElicitResult>

Send an elicitation request to the client, requesting user input.

Parameters
params

ElicitRequestFormParams | ElicitRequestURLParams

options?

RequestOptions

Returns

Promise<ElicitResult>

Deprecated

Throws on a 2026-07-28-era request — return inputRequired(...) (multi-round-trip) from the handler instead. The 2025 push-style server-to-client request model is replaced by input_required results in the 2026-07-28 protocol. If your factory serves both eras, this only works on the legacy path.

mcpReq.log

log: (level, data, logger?) => Promise<void>

Send a log message notification to the client. Respects the client's log level filter set via logging/setLevel.

Parameters
level

LoggingLevel

data

unknown

logger?

string

Returns

Promise<void>

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577). Remains functional during the deprecation window (at least twelve months). Migrate to stderr logging (STDIO servers) or OpenTelemetry.

mcpReq.requestSampling

requestSampling: (params, options?) => Promise<CreateMessageResult | CreateMessageResultWithTools>

Request LLM sampling from the client.

Parameters
params

CreateMessageRequest["params"]

options?

RequestOptions

Returns

Promise<CreateMessageResult | CreateMessageResultWithTools>

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577). Throws on a 2026-07-28-era request — return inputRequired(...) (multi-round-trip) from the handler instead, or migrate to calling LLM provider APIs directly. The 2025 push-style server-to-client request model is replaced by input_required results in the 2026-07-28 protocol. If your factory serves both eras, this only works on the legacy path.


ServerNotification

ServerNotification = Infer<typeof ServerNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:659


ServerRequest

ServerRequest = Infer<typeof ServerRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:658


ServerResult

ServerResult = StripWireOnly<Infer<typeof ServerResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:660


SetLevelRequest

SetLevelRequest = Infer<typeof SetLevelRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:443

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to stderr logging (STDIO servers) or OpenTelemetry.


SetLevelRequestParams

SetLevelRequestParams = Infer<typeof SetLevelRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:437

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to stderr logging (STDIO servers) or OpenTelemetry.


SingleSelectEnumSchema

SingleSelectEnumSchema = Infer<typeof SingleSelectEnumSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:529


SpecTypeName

SpecTypeName = StripSchemaSuffix<SchemaKey>

Defined in: packages/core-internal/src/types/specTypeSchema.ts:229

Union of every named type in the SDK's protocol and OAuth schemas (e.g. 'CallToolResult', 'ContentBlock', 'Tool', 'OAuthTokens'). Derived from the internal Zod schemas, so it stays in sync with the spec.


SpecTypes

SpecTypes = { [K in SchemaKey as StripSchemaSuffix<K>]: SchemaFor<K> extends z.ZodType ? z.output<SchemaFor<K>> : never }

Defined in: packages/core-internal/src/types/specTypeSchema.ts:241

Maps each SpecTypeName to its TypeScript type.

SpecTypes['Tool'] is equivalent to importing the Tool type directly. These validators cover the NEUTRAL model — the consumer-facing shapes with no wire-only members (resultType, the reserved _meta envelope keys). Per-revision WIRE validators are deliberately not public surface; they are planned to return as versioned zod-schemas/<revision> exports for consumers who validate raw wire traffic themselves.


StoredOAuthClientInformation

StoredOAuthClientInformation = OAuthClientInformationMixed & object

Defined in: packages/core-internal/src/shared/auth.ts:278

OAuthClientInformationMixed as persisted by an OAuthClientProvider. Adds an SDK-stamped authorization-server issuer identifier so stored client credentials are bound to the AS that issued them. The issuer field is not part of the RFC 7591 wire response and is intentionally absent from the wire-response schema; the client SDK writes it before calling saveClientInformation.

Type Declaration

issuer?

optional issuer?: string


StoredOAuthTokens

StoredOAuthTokens = OAuthTokens & object

Defined in: packages/core-internal/src/shared/auth.ts:268

OAuthTokens as persisted by an OAuthClientProvider. Adds an SDK-stamped authorization-server issuer identifier so stored tokens are bound to the AS that issued them. The issuer field is not part of the RFC 6749 wire response and is intentionally absent from the wire-response schema; the client SDK writes it before calling saveTokens.

Type Declaration

issuer?

optional issuer?: string


StringSchema

StringSchema = Infer<typeof StringSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:521


SubscribeRequest

SubscribeRequest = Infer<typeof SubscribeRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:369


SubscribeRequestParams

SubscribeRequestParams = Infer<typeof SubscribeRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:368


SubscriptionFilter

SubscriptionFilter = Infer<typeof SubscriptionFilterSchema>

Defined in: packages/core-internal/src/types/types.ts:376


SubscriptionsAcknowledgedNotification

SubscriptionsAcknowledgedNotification = Infer<typeof SubscriptionsAcknowledgedNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:380


SubscriptionsAcknowledgedNotificationParams

SubscriptionsAcknowledgedNotificationParams = Infer<typeof SubscriptionsAcknowledgedNotificationParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:379


SubscriptionsListenRequest

SubscriptionsListenRequest = Infer<typeof SubscriptionsListenRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:378


SubscriptionsListenRequestParams

SubscriptionsListenRequestParams = Infer<typeof SubscriptionsListenRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:377


SubscriptionsListenResult

SubscriptionsListenResult = StripWireOnly<Infer<typeof SubscriptionsListenResultSchema>>

Defined in: packages/core-internal/src/types/types.ts:382


SubscriptionsListenResultMeta

SubscriptionsListenResultMeta = Infer<typeof SubscriptionsListenResultMetaSchema>

Defined in: packages/core-internal/src/types/types.ts:381


Task

Task = Infer<typeof TaskSchema>

Defined in: packages/core-internal/src/types/types.ts:315

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


TaskAugmentedRequestParams

TaskAugmentedRequestParams = Infer<typeof TaskAugmentedRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:225

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


TaskCreationParams

TaskCreationParams = Infer<typeof TaskCreationParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:319

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


TaskMetadata

TaskMetadata = Infer<typeof TaskMetadataSchema>

Defined in: packages/core-internal/src/types/types.ts:321

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


TaskStatus

TaskStatus = Infer<typeof TaskStatusSchema>

Defined in: packages/core-internal/src/types/types.ts:317

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


TaskStatusNotification

TaskStatusNotification = Infer<typeof TaskStatusNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:329

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


TaskStatusNotificationParams

TaskStatusNotificationParams = Infer<typeof TaskStatusNotificationParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:327

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


TextContent

TextContent = Infer<typeof TextContentSchema>

Defined in: packages/core-internal/src/types/types.ts:391


TextResourceContents

TextResourceContents = Infer<typeof TextResourceContentsSchema>

Defined in: packages/core-internal/src/types/types.ts:354


TitledMultiSelectEnumSchema

TitledMultiSelectEnumSchema = Infer<typeof TitledMultiSelectEnumSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:528


TitledSingleSelectEnumSchema

TitledSingleSelectEnumSchema = Infer<typeof TitledSingleSelectEnumSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:525


Tool

Tool = Infer<typeof ToolSchema>

Defined in: packages/core-internal/src/types/types.ts:416


ToolAnnotations

ToolAnnotations = Infer<typeof ToolAnnotationsSchema>

Defined in: packages/core-internal/src/types/types.ts:414


ToolChoice

ToolChoice = Infer<typeof ToolChoiceSchema>

Defined in: packages/core-internal/src/types/types.ts:463

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


ToolExecution

ToolExecution = Infer<typeof ToolExecutionSchema>

Defined in: packages/core-internal/src/types/types.ts:415


ToolListChangedNotification

ToolListChangedNotification = Infer<typeof ToolListChangedNotificationSchema>

Defined in: packages/core-internal/src/types/types.ts:423


ToolResultContent

ToolResultContent = Infer<typeof ToolResultContentSchema>

Defined in: packages/core-internal/src/types/types.ts:405

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


ToolUseContent

ToolUseContent = Infer<typeof ToolUseContentSchema>

Defined in: packages/core-internal/src/types/types.ts:399

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months. Migrate to calling LLM provider APIs directly.


TransportSendOptions

TransportSendOptions = object

Defined in: packages/core-internal/src/shared/transport.ts:51

Options for sending a JSON-RPC message.

Properties

headers?

optional headers?: Readonly<Record<string, string>>

Defined in: packages/core-internal/src/shared/transport.ts:102

Additional HTTP headers to send with THIS outbound message, when the transport sends one outbound message per underlying HTTP request (the Streamable HTTP transport's POST-per-request model). Transports that share a single channel (stdio, in-memory) ignore it.

The Client uses this to attach SEP-2243 Mcp-Param-{Name} headers to a tools/call request on a 2026-07-28 connection. Values are sent verbatim — encode anything that is not a safe RFC 9110 field value before passing it here.

onRequestStreamEnd?

optional onRequestStreamEnd?: () => void

Defined in: packages/core-internal/src/shared/transport.ts:89

Fired by transports that open a per-request stream (the Streamable HTTP transport's POST-per-request SSE response) when that stream ends or errors for any reason OTHER than a deliberate requestSignal abort — i.e. the server closed the stream, the network dropped it, or reconnection was exhausted. Transports that share a single channel (stdio, in-memory) ignore it.

Returns

void

onresumptiontoken?

optional onresumptiontoken?: (token) => void

Defined in: packages/core-internal/src/shared/transport.ts:69

A callback that is invoked when the resumption token changes, if supported by the transport.

This allows clients to persist the latest token for potential reconnection.

Parameters
token

string

Returns

void

relatedRequestId?

optional relatedRequestId?: RequestId

Defined in: packages/core-internal/src/shared/transport.ts:55

If present, relatedRequestId is used to indicate to the transport which incoming request to associate this outgoing message with.

requestSignal?

optional requestSignal?: AbortSignal

Defined in: packages/core-internal/src/shared/transport.ts:79

An abort signal for THIS outbound message's underlying request, when the transport sends one outbound message per underlying request (the Streamable HTTP transport's POST-per-request model). Aborting it cancels the underlying request (and its SSE response stream) without closing the transport. Transports that share a single channel (stdio, in-memory) ignore it.

resumptionToken?

optional resumptionToken?: string

Defined in: packages/core-internal/src/shared/transport.ts:62

The resumption token used to continue long-running requests that were interrupted.

This allows clients to reconnect and continue from where they left off, if supported by the transport.


UnsubscribeRequest

UnsubscribeRequest = Infer<typeof UnsubscribeRequestSchema>

Defined in: packages/core-internal/src/types/types.ts:371


UnsubscribeRequestParams

UnsubscribeRequestParams = Infer<typeof UnsubscribeRequestParamsSchema>

Defined in: packages/core-internal/src/types/types.ts:370


UntitledMultiSelectEnumSchema

UntitledMultiSelectEnumSchema = Infer<typeof UntitledMultiSelectEnumSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:527


UntitledSingleSelectEnumSchema

UntitledSingleSelectEnumSchema = Infer<typeof UntitledSingleSelectEnumSchemaSchema>

Defined in: packages/core-internal/src/types/types.ts:524


Variables

Variables = Record<string, string | string[]>

Defined in: packages/core-internal/src/shared/uriTemplate.ts:3

Variables

BAGGAGE_META_KEY

const BAGGAGE_META_KEY: "baggage" = 'baggage'

Defined in: packages/core-internal/src/types/constants.ts:94

_meta key carrying cross-cutting propagation values for distributed tracing (SEP-414).

When present, the value MUST follow the W3C Baggage header format, e.g. userId=alice,serverRegion=us-east-1.

See

https://www.w3.org/TR/baggage/


CLIENT_CAPABILITIES_META_KEY

const CLIENT_CAPABILITIES_META_KEY: "io.modelcontextprotocol/clientCapabilities" = 'io.modelcontextprotocol/clientCapabilities'

Defined in: packages/core-internal/src/types/constants.ts:32

_meta key carrying the client's capabilities for a request.

Capabilities are declared per request rather than once at initialization; servers must not infer capabilities from prior requests.


CLIENT_INFO_META_KEY

const CLIENT_INFO_META_KEY: "io.modelcontextprotocol/clientInfo" = 'io.modelcontextprotocol/clientInfo'

Defined in: packages/core-internal/src/types/constants.ts:24

_meta key identifying the client software making a request.


DEFAULT_NEGOTIATED_PROTOCOL_VERSION

const DEFAULT_NEGOTIATED_PROTOCOL_VERSION: "2025-03-26" = '2025-03-26'

Defined in: packages/core-internal/src/types/constants.ts:2


DEFAULT_REQUEST_TIMEOUT_MSEC

const DEFAULT_REQUEST_TIMEOUT_MSEC: 60000 = 60_000

Defined in: packages/core-internal/src/shared/protocol.ts:95

The default request timeout, in milliseconds.


inputRequired

const inputRequired: InputRequiredBuilder

Defined in: packages/core-internal/src/shared/inputRequired.ts:120

Builder for the input-required return value of multi-round-trip handlers, with per-kind constructors for the embedded requests (inputRequired.elicit, inputRequired.elicitUrl, inputRequired.createMessage, inputRequired.listRoots).

Example

Write-once tool requesting confirmation

ts
server.registerTool('deploy', { inputSchema: z.object({ env: z.string() }) }, async ({ env }, ctx) => {
    const confirmed = acceptedContent<{ confirm: boolean }>(ctx.mcpReq.inputResponses, 'confirm');
    if (!confirmed) {
        return inputRequired({
            inputRequests: {
                confirm: inputRequired.elicit({
                    message: `Deploy to ${env}?`,
                    requestedSchema: { type: 'object', properties: { confirm: { type: 'boolean' } }, required: ['confirm'] }
                })
            }
        });
    }
    return { content: [{ type: 'text', text: `deployed to ${env}` }] };
});

INTERNAL_ERROR

const INTERNAL_ERROR: -32603 = -32_603

Defined in: packages/core-internal/src/types/constants.ts:104


INVALID_PARAMS

const INVALID_PARAMS: -32602 = -32_602

Defined in: packages/core-internal/src/types/constants.ts:103


INVALID_REQUEST

const INVALID_REQUEST: -32600 = -32_600

Defined in: packages/core-internal/src/types/constants.ts:101


isSpecType

const isSpecType: GuardRecord

Defined in: packages/core-internal/src/types/specTypeSchema.ts:312

Type predicates for every MCP spec type, keyed by type name.

Returns true if the value satisfies the schema's input type (z.input<>, before defaults and transforms are applied), and narrows to that input type. For schemas with .default() or .preprocess(), this may accept values that do not structurally match the named output type; for example isSpecType.CallToolResult({}) is true because content has a default. Use specTypeSchemas.X['~standard'].validate(value) when you need the validated output value.

Each guard is a standalone function, so it can be passed directly as a callback.

Example

ts
if (isSpecType.ContentBlock(value)) {
    // value is ContentBlock
}

const blocks = mixed.filter(isSpecType.ContentBlock);

JSONRPC_VERSION

const JSONRPC_VERSION: "2.0" = '2.0'

Defined in: packages/core-internal/src/types/constants.ts:97


LATEST_PROTOCOL_VERSION

const LATEST_PROTOCOL_VERSION: "2025-11-25" = '2025-11-25'

Defined in: packages/core-internal/src/types/constants.ts:1


LOG_LEVEL_META_KEY

const LOG_LEVEL_META_KEY: "io.modelcontextprotocol/logLevel" = 'io.modelcontextprotocol/logLevel'

Defined in: packages/core-internal/src/types/constants.ts:56

_meta key carrying the desired log level for a request.

When absent, the server must not send notifications/message notifications for the request.

Deprecated

Deprecated as of protocol version 2026-07-28 (SEP-2577); remains in the specification for at least twelve months.


METHOD_NOT_FOUND

const METHOD_NOT_FOUND: -32601 = -32_601

Defined in: packages/core-internal/src/types/constants.ts:102


PARSE_ERROR

const PARSE_ERROR: -32700 = -32_700

Defined in: packages/core-internal/src/types/constants.ts:100


PROTOCOL_VERSION_META_KEY

const PROTOCOL_VERSION_META_KEY: "io.modelcontextprotocol/protocolVersion" = 'io.modelcontextprotocol/protocolVersion'

Defined in: packages/core-internal/src/types/constants.ts:19

_meta key carrying the MCP protocol version governing a request.

For the HTTP transport, the value must match the MCP-Protocol-Version header.


const RELATED_TASK_META_KEY: "io.modelcontextprotocol/related-task" = 'io.modelcontextprotocol/related-task'

Defined in: packages/core-internal/src/types/constants.ts:10

_meta key associating a message with a 2025-11-25 task.

Deprecated

2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.


specTypeSchemas

const specTypeSchemas: SchemaRecord

Defined in: packages/core-internal/src/types/specTypeSchema.ts:290

Runtime validators for every MCP spec type, keyed by type name.

Use this when you need to validate a spec-defined shape at a boundary the SDK does not own, for example an extension's custom-method payload that embeds a CallToolResult, or a value read from storage that should be a Tool.

Each entry implements the Standard Schema interface, so it composes with any Standard-Schema-aware library. For a simple boolean check, use isSpecType instead.

Example

ts
const result = specTypeSchemas.CallToolResult['~standard'].validate(untrusted);
if (result.issues === undefined) {
    // result.value is CallToolResult
}

STDIO_DEFAULT_MAX_BUFFER_SIZE

const STDIO_DEFAULT_MAX_BUFFER_SIZE: number

Defined in: packages/core-internal/src/shared/stdio.ts:4


SUBSCRIPTION_ID_META_KEY

const SUBSCRIPTION_ID_META_KEY: "io.modelcontextprotocol/subscriptionId" = 'io.modelcontextprotocol/subscriptionId'

Defined in: packages/core-internal/src/types/constants.ts:45

_meta key carrying the JSON-RPC ID of the subscriptions/listen request that opened the stream a notification was delivered on.

Stamped by the server on every notification delivered via a subscriptions/listen stream (including the leading notifications/subscriptions/acknowledged); on stdio, where all messages share one channel, clients use it to correlate notifications with their originating subscription. The value is the listen request's JSON-RPC ID verbatim.


SUPPORTED_PROTOCOL_VERSIONS

const SUPPORTED_PROTOCOL_VERSIONS: string[]

Defined in: packages/core-internal/src/types/constants.ts:3


TRACEPARENT_META_KEY

const TRACEPARENT_META_KEY: "traceparent" = 'traceparent'

Defined in: packages/core-internal/src/types/constants.ts:74

_meta key carrying W3C Trace Context for distributed tracing (SEP-414).

When present, the value MUST follow the W3C traceparent header format, e.g. 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01.

See

https://www.w3.org/TR/trace-context/#traceparent-header


TRACESTATE_META_KEY

const TRACESTATE_META_KEY: "tracestate" = 'tracestate'

Defined in: packages/core-internal/src/types/constants.ts:84

_meta key carrying vendor-specific trace state for distributed tracing (SEP-414).

When present, the value MUST follow the W3C tracestate header format, e.g. vendor1=value1,vendor2=value2.

See

https://www.w3.org/TR/trace-context/#tracestate-header

Functions

acceptedContent()

Call Signature

acceptedContent<T>(responses, key): T | undefined

Defined in: packages/core-internal/src/shared/inputRequired.ts:147

Reads the accepted content of a form-mode elicitation response from a retried request's inputResponses (ctx.mcpReq.inputResponses).

Returns the response's content for key when the entry is an accepted elicitation result, and undefined otherwise (missing key, declined or cancelled elicitation, or a response of another kind). The values arrive from the client and are not re-validated here — treat them as untrusted input.

Type Parameters
T

T extends Record<string, unknown> = Record<string, unknown>

Parameters
responses

Record<string, unknown> | InputResponses | undefined

key

string

Returns

T | undefined

Call Signature

acceptedContent<S>(responses, key, schema): InferOutput<S> | undefined

Defined in: packages/core-internal/src/shared/inputRequired.ts:164

Schema-aware overload: validates the accepted content against the given schema (any Standard Schema, e.g. a zod object) before returning it, so the untrusted client value arrives in the handler already validated and typed.

Returns undefined when the response is missing/declined/of another kind (as the two-argument form does) AND when the accepted content fails schema validation — handlers treat both the same way (re-issue the request or give up). Only synchronous schemas are supported (zod schemas without async refinements are synchronous); an asynchronously-validating schema throws a TypeError.

Type Parameters
S

S extends StandardSchemaV1<unknown, unknown>

Parameters
responses

Record<string, unknown> | InputResponses | undefined

key

string

schema

S

Returns

InferOutput<S> | undefined


assertCompleteRequestPrompt()

assertCompleteRequestPrompt(request): asserts request is { method: "completion/complete"; params: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; argument: { name: string; value: string }; context?: { arguments?: { [key: string]: string } }; ref: { name: string; type: "ref/prompt" } } }

Defined in: packages/core-internal/src/types/guards.ts:126

Parameters

request
method

"completion/complete" = ...

params

{ _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; argument: { name: string; value: string; }; context?: { arguments?: {[key: string]: string; }; }; ref: { type: "ref/resource"; uri: string; } | { name: string; type: "ref/prompt"; }; } = CompleteRequestParamsSchema

params._meta?

{[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; } = ...

See General fields: _meta for notes on _meta usage.

{ taskId: string; } = ...

If specified, this request is related to the provided task.

string = ...

params._meta.progressToken?

string | number = ...

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.

params.argument

{ name: string; value: string; } = ...

The argument's information

params.argument.name

string = ...

The name of the argument

params.argument.value

string = ...

The value of the argument to use for completion matching.

params.context?

{ arguments?: {[key: string]: string; }; } = ...

params.context.arguments?

{[key: string]: string; } = ...

Previously-resolved variables in a URI template or prompt.

params.ref

{ type: "ref/resource"; uri: string; } | { name: string; type: "ref/prompt"; } = ...

Returns

asserts request is { method: "completion/complete"; params: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; argument: { name: string; value: string }; context?: { arguments?: { [key: string]: string } }; ref: { name: string; type: "ref/prompt" } } }


assertCompleteRequestResourceTemplate()

assertCompleteRequestResourceTemplate(request): asserts request is { method: "completion/complete"; params: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; argument: { name: string; value: string }; context?: { arguments?: { [key: string]: string } }; ref: { type: "ref/resource"; uri: string } } }

Defined in: packages/core-internal/src/types/guards.ts:133

Parameters

request
method

"completion/complete" = ...

params

{ _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; argument: { name: string; value: string; }; context?: { arguments?: {[key: string]: string; }; }; ref: { type: "ref/resource"; uri: string; } | { name: string; type: "ref/prompt"; }; } = CompleteRequestParamsSchema

params._meta?

{[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; } = ...

See General fields: _meta for notes on _meta usage.

{ taskId: string; } = ...

If specified, this request is related to the provided task.

string = ...

params._meta.progressToken?

string | number = ...

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.

params.argument

{ name: string; value: string; } = ...

The argument's information

params.argument.name

string = ...

The name of the argument

params.argument.value

string = ...

The value of the argument to use for completion matching.

params.context?

{ arguments?: {[key: string]: string; }; } = ...

params.context.arguments?

{[key: string]: string; } = ...

Previously-resolved variables in a URI template or prompt.

params.ref

{ type: "ref/resource"; uri: string; } | { name: string; type: "ref/prompt"; } = ...

Returns

asserts request is { method: "completion/complete"; params: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; argument: { name: string; value: string }; context?: { arguments?: { [key: string]: string } }; ref: { type: "ref/resource"; uri: string } } }


checkResourceAllowed()

checkResourceAllowed(options): boolean

Defined in: packages/core-internal/src/shared/authUtils.ts:27

Checks if a requested resource URL matches a configured resource URL. A requested resource matches if it has the same scheme, domain, port, and its path starts with the configured resource's path.

Parameters

options

The options object

configuredResource

string | URL

The resource URL that has been configured

requestedResource

string | URL

The resource URL being requested

Returns

boolean

true if the requested resource matches the configured resource, false otherwise


classifyInboundRequest()

classifyInboundRequest(request): InboundClassificationOutcome

Defined in: packages/core-internal/src/shared/inboundClassification.ts:805

Classifies one inbound HTTP request for dual-era serving.

The body-primary predicate, evaluated once at the entry boundary: see the module documentation for the rules. Returns a routing outcome (legacy or modern) or a ladder rejection; it never throws.

Parameters

request

InboundHttpRequest

Returns

InboundClassificationOutcome


createFetchWithInit()

createFetchWithInit(baseFetch?, baseInit?): FetchLike

Defined in: packages/core-internal/src/shared/transport.ts:31

Creates a fetch function that includes base RequestInit options. This ensures requests inherit settings like credentials, mode, headers, etc. from the base init.

Parameters

baseFetch?

FetchLike = fetch

The base fetch function to wrap (defaults to global fetch)

baseInit?

RequestInit

The base RequestInit to merge with each request

Returns

FetchLike

A wrapped fetch function that merges base options with call-specific options


deserializeMessage()

deserializeMessage(line): JSONRPCMessage

Defined in: packages/core-internal/src/shared/stdio.ts:56

Parameters

line

string

Returns

JSONRPCMessage


getDisplayName()

getDisplayName(metadata): string

Defined in: packages/core-internal/src/shared/metadataUtils.ts:13

Gets the display name for an object with BaseMetadata. For tools, the precedence is: titleannotations.titlename For other objects: titlename This implements the spec requirement: "if no title is provided, name should be used for display purposes"

Parameters

metadata

{ name: string; title?: string; } | object & object

Type Literal

{ name: string; title?: string; }

name

string = ...

Intended for programmatic or logical use, but used as a display name in past specs or fallback

title?

string = ...

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


object & object

Returns

string


inputResponse()

inputResponse(responses, key): InputResponseView

Defined in: packages/core-internal/src/shared/inputRequired.ts:209

Reads one entry of a retried request's inputResponses (ctx.mcpReq.inputResponses) as a discriminated view, covering decline/cancel detection and the non-elicitation response kinds that acceptedContent does not surface.

The values arrive from the client and are not re-validated here — treat them as untrusted input (validate elicitation content with the schema-aware acceptedContent overload where it matters).

Parameters

responses

Record<string, unknown> | InputResponses | undefined

key

string

Returns

InputResponseView


isCallToolResult()

isCallToolResult(value): value is { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; content: ({ _meta?: { [key: string]: unknown }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number }; text: string; type: "text" } | { _meta?: { [key: string]: unknown }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number }; data: string; mimeType: string; type: "image" } | { _meta?: { [key: string]: unknown }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number }; data: string; mimeType: string; type: "audio" } | { _meta?: { [key: string]: unknown }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number }; resource: { _meta?: { [key: string]: unknown }; mimeType?: string; text: string; uri: string } | { _meta?: { [key: string]: unknown }; blob: string; mimeType?: string; uri: string }; type: "resource" } | { _meta?: { [key: string]: unknown }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number }; description?: string; icons?: { mimeType?: string; sizes?: string[]; src: string; theme?: "light" | "dark" }[]; mimeType?: string; name: string; size?: number; title?: string; type: "resource_link"; uri: string })[]; isError?: boolean; structuredContent?: unknown; [key: string]: unknown }

Defined in: packages/core-internal/src/types/guards.ts:86

Checks if a value is a valid CallToolResult.

This is a consumer-side VALUE check against the neutral model, not a wire validator: a raw wire object that additionally carries wire-only members (e.g. resultType) still passes through the loose index signature. Use a transport-level parse to validate raw wire traffic.

Parameters

value

unknown

The value to check.

Returns

value is { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; content: ({ _meta?: { [key: string]: unknown }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number }; text: string; type: "text" } | { _meta?: { [key: string]: unknown }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number }; data: string; mimeType: string; type: "image" } | { _meta?: { [key: string]: unknown }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number }; data: string; mimeType: string; type: "audio" } | { _meta?: { [key: string]: unknown }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number }; resource: { _meta?: { [key: string]: unknown }; mimeType?: string; text: string; uri: string } | { _meta?: { [key: string]: unknown }; blob: string; mimeType?: string; uri: string }; type: "resource" } | { _meta?: { [key: string]: unknown }; annotations?: { audience?: ("user" | "assistant")[]; lastModified?: string; priority?: number }; description?: string; icons?: { mimeType?: string; sizes?: string[]; src: string; theme?: "light" | "dark" }[]; mimeType?: string; name: string; size?: number; title?: string; type: "resource_link"; uri: string })[]; isError?: boolean; structuredContent?: unknown; [key: string]: unknown }

True if the value is a valid CallToolResult, false otherwise.


isInitializedNotification()

isInitializedNotification(value): value is { method: "notifications/initialized"; params?: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown } } }

Defined in: packages/core-internal/src/types/guards.ts:123

Parameters

value

unknown

Returns

value is { method: "notifications/initialized"; params?: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown } } }


isInitializeRequest()

isInitializeRequest(value): value is { method: "initialize"; params: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; capabilities: { elicitation?: { form?: { applyDefaults?: boolean; [key: string]: string | number | boolean | { [key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null } | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; url?: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; [key: string]: string | number | boolean | { [key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null } | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; experimental?: { [key: string]: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null } }; extensions?: { [key: string]: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null } }; roots?: { listChanged?: boolean }; sampling?: { context?: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; tools?: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null } }; tasks?: { cancel?: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; list?: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; requests?: { elicitation?: { create?: { [key: ...]: ... }; [key: string]: unknown }; sampling?: { createMessage?: { [key: ...]: ... }; [key: string]: unknown }; [key: string]: unknown }; [key: string]: unknown } }; clientInfo: { description?: string; icons?: { mimeType?: string; sizes?: string[]; src: string; theme?: "light" | "dark" }[]; name: string; title?: string; version: string; websiteUrl?: string }; protocolVersion: string } }

Defined in: packages/core-internal/src/types/guards.ts:121

Parameters

value

unknown

Returns

value is { method: "initialize"; params: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; capabilities: { elicitation?: { form?: { applyDefaults?: boolean; [key: string]: string | number | boolean | { [key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null } | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; url?: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; [key: string]: string | number | boolean | { [key: string]: string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null } | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; experimental?: { [key: string]: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null } }; extensions?: { [key: string]: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null } }; roots?: { listChanged?: boolean }; sampling?: { context?: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; tools?: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null } }; tasks?: { cancel?: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; list?: { [key: string]: string | number | boolean | ({ [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null)[] | null; }) | (string | number | boolean | { [x: string]: string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | number | boolean | ... | (string | ... 4 more ... | null)[] | null)[] | null)[] | null)[] | null; } | (string | ... 4 more ... | null)[] | null)[] | null }; requests?: { elicitation?: { create?: { [key: ...]: ... }; [key: string]: unknown }; sampling?: { createMessage?: { [key: ...]: ... }; [key: string]: unknown }; [key: string]: unknown }; [key: string]: unknown } }; clientInfo: { description?: string; icons?: { mimeType?: string; sizes?: string[]; src: string; theme?: "light" | "dark" }[]; name: string; title?: string; version: string; websiteUrl?: string }; protocolVersion: string } }


isInputRequiredResult()

isInputRequiredResult(value): value is InputRequiredResult

Defined in: packages/core-internal/src/types/guards.ts:103

Checks whether a value is an input-required result (protocol revision 2026-07-28): the multi-round-trip return shape discriminated by resultType: 'input_required'.

This is a discriminator check, not a full validator — the at-least-one rule (inputRequests or requestState) is enforced by the inputRequired() builder and re-checked by the server seam for hand-built values.

Parameters

value

unknown

The value to check.

Returns

value is InputRequiredResult

True if the value carries the input_required discriminator.


isJSONRPCErrorResponse()

isJSONRPCErrorResponse(value): value is { error: { code: number; data?: unknown; message: string }; id?: string | number; jsonrpc: "2.0" }

Defined in: packages/core-internal/src/types/guards.ts:63

Checks if a value is a valid JSONRPCErrorResponse.

Parameters

value

unknown

The value to check.

Returns

value is { error: { code: number; data?: unknown; message: string }; id?: string | number; jsonrpc: "2.0" }

True if the value is a valid JSONRPCErrorResponse, false otherwise.


isJSONRPCNotification()

isJSONRPCNotification(value): value is { jsonrpc: "2.0"; method: string; params?: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; [key: string]: unknown } }

Defined in: packages/core-internal/src/types/guards.ts:46

Parameters

value

unknown

Returns

value is { jsonrpc: "2.0"; method: string; params?: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; [key: string]: unknown } }


isJSONRPCRequest()

isJSONRPCRequest(value): value is { id: string | number; jsonrpc: "2.0"; method: string; params?: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; [key: string]: unknown } }

Defined in: packages/core-internal/src/types/guards.ts:44

Parameters

value

unknown

Returns

value is { id: string | number; jsonrpc: "2.0"; method: string; params?: { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; [key: string]: unknown } }


isJSONRPCResponse()

isJSONRPCResponse(value): value is JSONRPCResponse

Defined in: packages/core-internal/src/types/guards.ts:72

Checks if a value is a valid JSONRPCResponse (either a result or error response).

Parameters

value

unknown

The value to check.

Returns

value is JSONRPCResponse

True if the value is a valid JSONRPCResponse, false otherwise.


isJSONRPCResultResponse()

isJSONRPCResultResponse(value): value is JSONRPCResultResponse

Defined in: packages/core-internal/src/types/guards.ts:54

Checks if a value is a valid JSONRPCResultResponse.

Parameters

value

unknown

The value to check.

Returns

value is JSONRPCResultResponse

True if the value is a valid JSONRPCResultResponse, false otherwise.


isTaskAugmentedRequestParams()

isTaskAugmentedRequestParams(value): value is { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; task?: { ttl?: number } }

Defined in: packages/core-internal/src/types/guards.ts:118

Checks if a value is a valid TaskAugmentedRequestParams.

Parameters

value

unknown

The value to check.

Returns

value is { _meta?: { io.modelcontextprotocol/related-task?: { taskId: string }; progressToken?: string | number; [key: string]: unknown }; task?: { ttl?: number } }

True if the value is a valid TaskAugmentedRequestParams, false otherwise.

Deprecated

Recognizes 2025-11-25 task wire vocabulary, which has no SDK runtime; kept importable for interoperability only.


parseJSONRPCMessage()

parseJSONRPCMessage(value): JSONRPCMessage

Defined in: packages/core-internal/src/types/guards.ts:40

Validates and parses an unknown value as a JSON-RPC message.

Use this to validate incoming messages in custom transport implementations. Throws if the value does not conform to the JSON-RPC message schema.

Parameters

value

unknown

The value to validate (typically a parsed JSON object).

Returns

JSONRPCMessage

The validated JSONRPCMessage.

Throws

If validation fails.


resourceUrlFromServerUrl()

resourceUrlFromServerUrl(url): URL

Defined in: packages/core-internal/src/shared/authUtils.ts:11

Converts a server URL to a resource URL by removing the fragment. RFC 8707 section 2 states that resource URIs "MUST NOT include a fragment component". Keeps everything else unchanged (scheme, domain, port, path, query).

Parameters

url

string | URL

Returns

URL


serializeMessage()

serializeMessage(message): string

Defined in: packages/core-internal/src/shared/stdio.ts:60

Parameters

message

JSONRPCMessage

Returns

string

References

AnyToolHandler

Re-exports AnyToolHandler


BaseToolCallback

Re-exports BaseToolCallback


completable

Re-exports completable


CompletableSchema

Re-exports CompletableSchema


CompleteCallback

Re-exports CompleteCallback


CompleteResourceTemplateCallback

Re-exports CompleteResourceTemplateCallback


createMcpHandler

Re-exports createMcpHandler


CreateMcpHandlerOptions

Re-exports CreateMcpHandlerOptions


createRequestStateCodec

Re-exports createRequestStateCodec


EventId

Re-exports EventId


EventStore

Re-exports EventStore


fromJsonSchema

Re-exports fromJsonSchema


HandleRequestOptions

Re-exports HandleRequestOptions


hostHeaderValidationResponse

Re-exports hostHeaderValidationResponse


HostHeaderValidationResult

Re-exports HostHeaderValidationResult


InMemoryServerEventBus

Re-exports InMemoryServerEventBus


isCompletable

Re-exports isCompletable


isLegacyRequest

Re-exports isLegacyRequest


LegacyHttpHandler

Re-exports LegacyHttpHandler


legacyStatelessFallback

Re-exports legacyStatelessFallback


ListResourcesCallback

Re-exports ListResourcesCallback


localhostAllowedHostnames

Re-exports localhostAllowedHostnames


localhostAllowedOrigins

Re-exports localhostAllowedOrigins


McpHandlerRequestOptions

Re-exports McpHandlerRequestOptions


McpHttpHandler

Re-exports McpHttpHandler


McpRequestContext

Re-exports McpRequestContext


McpServer

Re-exports McpServer


McpServerFactory

Re-exports McpServerFactory


originValidationResponse

Re-exports originValidationResponse


OriginValidationResult

Re-exports OriginValidationResult


PerRequestHTTPServerTransport

Re-exports PerRequestHTTPServerTransport


PerRequestHTTPServerTransportOptions

Re-exports PerRequestHTTPServerTransportOptions


PerRequestMessageExtra

Re-exports PerRequestMessageExtra


PerRequestResponseMode

Re-exports PerRequestResponseMode


PromptCallback

Re-exports PromptCallback


ReadResourceCallback

Re-exports ReadResourceCallback


ReadResourceTemplateCallback

Re-exports ReadResourceTemplateCallback


RegisteredPrompt

Re-exports RegisteredPrompt


RegisteredResource

Re-exports RegisteredResource


RegisteredResourceTemplate

Re-exports RegisteredResourceTemplate


RegisteredTool

Re-exports RegisteredTool


RequestStateCodec

Re-exports RequestStateCodec


RequestStateCodecOptions

Re-exports RequestStateCodecOptions


ResourceMetadata

Re-exports ResourceMetadata


ResourceTemplate

Re-exports ResourceTemplate


Server

Re-exports Server


ServerEvent

Re-exports ServerEvent


ServerEventBus

Re-exports ServerEventBus


ServerNotifier

Re-exports ServerNotifier


ServerOptions

Re-exports ServerOptions


StreamId

Re-exports StreamId


ToolCallback

Re-exports ToolCallback


validateHostHeader

Re-exports validateHostHeader


validateOriginHeader

Re-exports validateOriginHeader


WebStandardStreamableHTTPServerTransport

Re-exports WebStandardStreamableHTTPServerTransport


WebStandardStreamableHTTPServerTransportOptions

Re-exports WebStandardStreamableHTTPServerTransportOptions