MCP TypeScript SDK (V2) / @modelcontextprotocol/server / index
index
Namespaces
Enumerations
OAuthErrorCode
Defined in: packages/core-internal/src/auth/errors.ts:8
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:45
The resource owner or authorization server denied the request.
InsufficientScope
InsufficientScope:
"insufficient_scope"
Defined in: packages/core-internal/src/auth/errors.ts:95
The request requires higher privileges than provided by the access token.
InvalidClient
InvalidClient:
"invalid_client"
Defined in: packages/core-internal/src/auth/errors.ts:19
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:85
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:25
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:90
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:13
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:40
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:100
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:70
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:75
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:50
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:55
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:80
Rate limit exceeded. (Custom, non-standard error based on RFC 6585)
UnauthorizedClient
UnauthorizedClient:
"unauthorized_client"
Defined in: packages/core-internal/src/auth/errors.ts:30
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:35
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:60
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:65
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 -32002 — resources/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:11
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:16
Transport is already connected
CapabilityNotSupported
CapabilityNotSupported:
"CAPABILITY_NOT_SUPPORTED"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:22
Required capability is not supported by the remote side
ClientHttpAuthentication
ClientHttpAuthentication:
"CLIENT_HTTP_AUTHENTICATION"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:77
ClientHttpFailedToOpenStream
ClientHttpFailedToOpenStream:
"CLIENT_HTTP_FAILED_TO_OPEN_STREAM"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:80
ClientHttpFailedToTerminateSession
ClientHttpFailedToTerminateSession:
"CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:81
ClientHttpForbidden
ClientHttpForbidden:
"CLIENT_HTTP_FORBIDDEN"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:78
ClientHttpNotImplemented
ClientHttpNotImplemented:
"CLIENT_HTTP_NOT_IMPLEMENTED"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:76
ClientHttpUnexpectedContent
ClientHttpUnexpectedContent:
"CLIENT_HTTP_UNEXPECTED_CONTENT"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:79
ConnectionClosed
ConnectionClosed:
"CONNECTION_CLOSED"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:28
Connection was closed
EraNegotiationFailed
EraNegotiationFailed:
"ERA_NEGOTIATION_FAILED"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:73
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:47
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:32
Response result failed local schema validation
ListPaginationExceeded
ListPaginationExceeded:
"LIST_PAGINATION_EXCEEDED"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:56
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:64
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:14
Transport is not connected
NotInitialized
NotInitialized:
"NOT_INITIALIZED"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:18
Protocol is not initialized
RequestTimeout
RequestTimeout:
"REQUEST_TIMEOUT"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:26
Request timed out waiting for response
SendFailed
SendFailed:
"SEND_FAILED"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:30
Failed to send message
UnsupportedResultType
UnsupportedResultType:
"UNSUPPORTED_RESULT_TYPE"
Defined in: packages/core-internal/src/errors/sdkErrors.ts:38
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
Properties
onclose?
optionalonclose?: () =>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
onerror?
optionalonerror?: (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
onmessage?
optionalonmessage?: (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
extra?
authInfo?
Returns
void
Implementation of
sessionId?
optionalsessionId?:string
Defined in: packages/core-internal/src/util/inMemory.ts:24
The session ID generated for this connection.
Implementation of
Methods
close()
close():
Promise<void>
Defined in: packages/core-internal/src/util/inMemory.ts:45
Closes the connection.
Returns
Promise<void>
Implementation of
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
options?
authInfo?
relatedRequestId?
Returns
Promise<void>
Implementation of
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
createLinkedPair()
staticcreateLinkedPair(): [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:207
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, or by instanceof — checks are brand-matched and 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:212
Parameters
data
MissingRequiredClientCapabilityErrorData
message?
string = ...
Returns
MissingRequiredClientCapabilityError
Overrides
Properties
cause?
optionalcause?:unknown
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
code
readonlycode:number
Defined in: packages/core-internal/src/types/errors.ts:47
Inherited from
data?
readonlyoptionaldata?:unknown
Defined in: packages/core-internal/src/types/errors.ts:49
Inherited from
message
message:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
name
name:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stack?
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
stackTraceLimit
staticstackTraceLimit: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
Accessors
requiredCapabilities
Get Signature
get requiredCapabilities():
object
Defined in: packages/core-internal/src/types/errors.ts:223
The capabilities the server requires from the client to process the request (only the missing capabilities are listed).
Returns
elicitation?
optionalelicitation?: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?
optionalform?: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?
optionalapplyDefaults?:boolean
elicitation.url?
optionalurl?: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?
optionalexperimental?:object
Experimental, non-standard capabilities that the client supports.
Index Signature
[key: string]: object
extensions?
optionalextensions?:object
Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
Index Signature
[key: string]: object
roots?
optionalroots?: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?
optionallistChanged?:boolean
Whether the client supports issuing notifications for changes to the roots list.
sampling?
optionalsampling?: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?
optionalcontext?: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?
optionaltools?: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?
optionaltasks?: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?
optionalcancel?: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?
optionallist?: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?
optionalrequests?:object
Capabilities for task creation on specific request types.
Index Signature
[key: string]: unknown
tasks.requests.elicitation?
optionalelicitation?:object
Task support for elicitation requests.
Index Signature
[key: string]: unknown
tasks.requests.elicitation.create?
optionalcreate?: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?
optionalsampling?:object
Task support for sampling requests.
Index Signature
[key: string]: unknown
tasks.requests.sampling.createMessage?
optionalcreateMessage?: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
[hasInstance]()
static[hasInstance](value):boolean
Defined in: packages/core-internal/src/types/errors.ts:24
Parameters
value
unknown
Returns
boolean
Inherited from
captureStackTrace()
staticcaptureStackTrace(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.
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:
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()
staticfromError(code,message,data?):ProtocolError
Defined in: packages/core-internal/src/types/errors.ts:59
Factory method to create the appropriate error type based on the error code and data
Parameters
code
number
message
string
data?
unknown
Returns
Inherited from
isError()
staticisError(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
isInstance()
staticisInstance<T>(this,value):value is InstanceType<T>
Defined in: packages/core-internal/src/types/errors.ts:37
Brand-based type guard: equivalent to value instanceof this, as an explicit static predicate (the axios/AWS-SDK isInstance style). Reads the caller's own brand via this, so every branded subclass gets a correctly-scoped guard by inheritance. Must be invoked on the class — in callback position write v => SdkError.isInstance(v), not .filter(SdkError.isInstance) (detached calls throw rather than silently matching nothing).
Type Parameters
T
T extends (...args) => unknown
Parameters
this
T
value
unknown
Returns
value is InstanceType<T>
Inherited from
prepareStackTrace()
staticprepareStackTrace(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:106
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:133
Parameters
code
string
message
string
errorUri?
string
Returns
Overrides
Error.constructor
Properties
cause?
optionalcause?: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
readonlycode:string
Defined in: packages/core-internal/src/auth/errors.ts:134
errorUri?
readonlyoptionalerrorUri?:string
Defined in: packages/core-internal/src/auth/errors.ts:136
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?
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stack
stackTraceLimit
staticstackTraceLimit: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:146
Converts the error to a standard OAuth error response object.
Returns
object
error
error:
string
error_description?
optionalerror_description?:string
error_uri?
optionalerror_uri?:string
[hasInstance]()
static[hasInstance](value):boolean
Defined in: packages/core-internal/src/auth/errors.ts:111
Parameters
value
unknown
Returns
boolean
captureStackTrace()
staticcaptureStackTrace(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.
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:
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()
staticfromResponse(response):OAuthError
Defined in: packages/core-internal/src/auth/errors.ts:162
Creates an OAuthError from an OAuth error response.
Parameters
response
error
string = ...
error_description?
string = ...
error_uri?
string = ...
Returns
isError()
staticisError(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
isInstance()
staticisInstance<T>(this,value):value is InstanceType<T>
Defined in: packages/core-internal/src/auth/errors.ts:124
Brand-based type guard: equivalent to value instanceof this, as an explicit static predicate (the axios/AWS-SDK isInstance style). Reads the caller's own brand via this, so every branded subclass gets a correctly-scoped guard by inheritance. Must be invoked on the class — in callback position write v => SdkError.isInstance(v), not .filter(SdkError.isInstance) (detached calls throw rather than silently matching nothing).
Type Parameters
T
T extends (...args) => unknown
Parameters
this
T
value
unknown
Returns
value is InstanceType<T>
prepareStackTrace()
staticprepareStackTrace(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
abstract Protocol
Defined in: packages/core-internal/src/shared/protocol.ts:557
Implements MCP protocol framing on top of a pluggable transport, including features like request/response linking, notifications, and progress.
Protocol is abstract; Client and Server are the concrete role-specific implementations most code should use.
Extended by
Type Parameters
ContextT
ContextT extends BaseContext
Constructors
Constructor
new Protocol<
ContextT>(_options?):Protocol<ContextT>
Defined in: packages/core-internal/src/shared/protocol.ts:608
Parameters
_options?
Returns
Protocol<ContextT>
Properties
_negotiatedProtocolVersion?
protectedoptional_negotiatedProtocolVersion?:string
Defined in: packages/core-internal/src/shared/protocol.ts:574
The protocol version negotiated for the current connection (undefined before negotiation completes), which determines the wire era this instance speaks. Set by the SDK's negotiation and initialize paths (Client.connect, Server._oninitialize).
_supportedProtocolVersions
protected_supportedProtocolVersions:string[]
Defined in: packages/core-internal/src/shared/protocol.ts:582
fallbackNotificationHandler?
optionalfallbackNotificationHandler?: (notification) =>Promise<void>
Defined in: packages/core-internal/src/shared/protocol.ts:606
A handler to invoke for any notification types that do not have their own handler installed.
Parameters
notification
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 MCP specification for notes on _meta usage.
params._meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
params._meta.io.modelcontextprotocol/related-task.taskId
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.
Returns
Promise<void>
fallbackRequestHandler?
optionalfallbackRequestHandler?: (request,ctx) =>Promise<{[key:string]:unknown;_meta?: {[key:string]:unknown;io.modelcontextprotocol/related-task?: {taskId:string; };progressToken?:string|number; }; }>
Defined in: packages/core-internal/src/shared/protocol.ts:601
A handler to invoke for any request types that do not have their own handler installed.
Parameters
request
id
string | number = RequestIdSchema
jsonrpc
"2.0" = ...
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.
params._meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
params._meta.io.modelcontextprotocol/related-task.taskId
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.
ctx
ContextT
Returns
Promise<{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; }>
onclose?
optionalonclose?: () =>void
Defined in: packages/core-internal/src/shared/protocol.ts:589
Callback for when the connection is closed for any reason.
This is invoked when close() is called as well.
Returns
void
onerror?
optionalonerror?: (error) =>void
Defined in: packages/core-internal/src/shared/protocol.ts:596
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
Accessors
transport
Get Signature
get transport():
Transport|undefined
Defined in: packages/core-internal/src/shared/protocol.ts:1217
Returns
Transport | undefined
Methods
_getRequestHandler()
protected_getRequestHandler(method): ((request,ctx) =>Promise<{[key:string]:unknown;_meta?: {[key:string]:unknown;io.modelcontextprotocol/related-task?: {taskId:string; };progressToken?:string|number; }; }>) |undefined
Defined in: packages/core-internal/src/shared/protocol.ts:721
Protected accessor for a registered request handler. Used by role classes that dispatch synthesized requests through the same stored handler chain (e.g. the Client fulfilling an embedded multi-round-trip input request).
Parameters
method
string
Returns
((request, ctx) => Promise<{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; }>) | undefined
_onclose()
protected_onclose():void
Defined in: packages/core-internal/src/shared/protocol.ts:824
Transport-close hook. Subclass overrides MUST call super._onclose() after their own cleanup — base teardown (response-handler settlement, timeout clearing, in-flight request abort) does not run otherwise.
Returns
void
_onnotification()
protected_onnotification(rawNotification,extra?):void
Defined in: packages/core-internal/src/shared/protocol.ts:865
Inbound-notification dispatch. Subclass overrides MUST delegate unmatched traffic to super._onnotification(rawNotification, extra) — an override that consumes only what it owns and falls through to base dispatch for everything else.
Parameters
rawNotification
jsonrpc
"2.0" = ...
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 MCP specification for notes on _meta usage.
params._meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
params._meta.io.modelcontextprotocol/related-task.taskId
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.
extra?
Returns
void
_onresponse()
protected_onresponse(response):void
Defined in: packages/core-internal/src/shared/protocol.ts:1196
Inbound-response dispatch. Subclass overrides MUST delegate unmatched traffic to super._onresponse(response) — an override that consumes only what it owns and falls through to base dispatch for everything else.
Parameters
response
Returns
void
_outboundMetaEnvelope()
protected_outboundMetaEnvelope():Readonly<Record<string,unknown>> |undefined
Defined in: packages/core-internal/src/shared/protocol.ts:663
The per-request _meta envelope this instance attaches to every outgoing request and notification, when one applies. The base implementation returns undefined (no envelope — the 2025-era posture, so legacy-era outbound traffic is byte-identical to a build without this seam). Client overrides it on a connection that negotiated a modern (2026-07-28+) era to return the reserved protocol-version / client-info / client-capabilities keys. User-supplied _meta keys take precedence over the auto-attached ones.
Returns
Readonly<Record<string, unknown>> | undefined
_requestWithSchema()
protected_requestWithSchema<T>(request,resultSchema,options?):Promise<InferOutput<T>>
Defined in: packages/core-internal/src/shared/protocol.ts:1345
Sends a request and waits for a response, using the provided schema for validation instead of the era registry's method-keyed entry.
This is the internal implementation used by SDK methods whose result schema cannot be expressed as a method-keyed registry entry — the one surviving case is server.createMessage, whose result schema depends on the REQUEST params (tools vs no tools) — and by callers passing explicit compatibility schemas. Spec methods are still era-gated here: an explicit schema never smuggles a deleted method onto the wire.
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.
params._meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
params._meta.io.modelcontextprotocol/related-task.taskId
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?
Returns
Promise<InferOutput<T>>
_resolveNonCompleteResult()
protected_resolveNonCompleteResult<T>(decoded,flow):Promise<unknown>
Defined in: packages/core-internal/src/shared/protocol.ts:703
Extension point for non-complete decoded results in the response funnel: a result the wire codec discriminated into a kind other than 'complete' or 'invalid' is handed here for the role class to resolve. The base default surfaces it as a typed SdkErrorCode.UnsupportedResultType error (no retry).
Intended consumers (named so the seam stays accountable):
- the
Client's multi-round-trip auto-fulfilment engine, which fulfils'input_required'results through the registered elicitation/sampling/roots handlers and retries viaflow.retry; - a future client-side terminal-result handler for
subscriptions/listen, when the spec defines one.
Server instances never receive input_required responses on their outbound legs and leave the base behavior in place.
Type Parameters
T
T extends StandardSchemaV1<unknown, unknown>
Parameters
decoded
DecodedResult & object
flow
NonCompleteResultFlow<T>
Returns
Promise<unknown>
_shouldDropInbound()
protected_shouldDropInbound(_message):"drop"|undefined
Defined in: packages/core-internal/src/shared/protocol.ts:649
Drop consult for inbound messages whose transport did not classify them at the edge — long-lived channels such as stdio, where a role class may need to decline traffic the negotiated era has no answer for (the client-side inbound-request drop on modern-era connections: the 2026-07-28 era has no server→client request channel, and on stdio the client must never write JSON-RPC responses).
Consulted ONLY when the transport supplied no MessageExtraInfo.classification: edge-classified traffic never reaches the hook. Returning 'drop' discards the message without writing any response (requests are surfaced via onerror). The base implementation returns undefined: unclassified traffic keeps today's dispatch path unchanged. Era selection never happens here — era is instance state, owned by the serving entry that constructed and connected the instance.
Parameters
_message
{ id: string | number; jsonrpc: "2.0"; method: string; params?: {[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; }; } | { jsonrpc: "2.0"; method: string; params?: {[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; }; }
Returns
"drop" | undefined
_wireCodec()
protected_wireCodec():WireCodec
Defined in: packages/core-internal/src/shared/protocol.ts:1297
Protected accessor for the instance's negotiated wire codec, for role classes (Client/Server/McpServer) routing era-dependent behavior through the codec's function-only surface — samplingResultVariant, outboundEnvelope, projectCallToolResult — instead of branching on the protocol version themselves.
Returns
WireCodec
_wrapHandler()
protected_wrapHandler(_method,handler): (request,ctx) =>Promise<{[key:string]:unknown;_meta?: {[key:string]:unknown;io.modelcontextprotocol/related-task?: {taskId:string; };progressToken?:string|number; }; }>
Defined in: packages/core-internal/src/shared/protocol.ts:1748
Hook for subclasses to wrap a registered request handler with role-specific validation or behavior (e.g. Server validates tools/call results, Client validates elicitation/create mode and result). Runs for both the 2-arg and 3-arg registration paths. The default implementation is identity.
Subclasses overriding this hook avoid redeclaring setRequestHandler's overload set.
Parameters
_method
string
handler
(request, ctx) => Promise<{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; }>
Returns
(request, ctx) => Promise<{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; }>
assertCanSetRequestHandler()
assertCanSetRequestHandler(
method):void
Defined in: packages/core-internal/src/shared/protocol.ts:1765
Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
Parameters
method
string
Returns
void
assertCapabilityForMethod()
abstractprotectedassertCapabilityForMethod(method):void
Defined in: packages/core-internal/src/shared/protocol.ts:1233
A method to check if a capability is supported by the remote side, for the given method to be called.
This should be implemented by subclasses.
Parameters
method
string
Returns
void
assertNotificationCapability()
abstractprotectedassertNotificationCapability(method):void
Defined in: packages/core-internal/src/shared/protocol.ts:1240
A method to check if a notification is supported by the local side, for the given method to be sent.
This should be implemented by subclasses.
Parameters
method
string
Returns
void
assertRequestHandlerCapability()
abstractprotectedassertRequestHandlerCapability(method):void
Defined in: packages/core-internal/src/shared/protocol.ts:1247
A method to check if a request handler is supported by the local side, for the given method to be handled.
This should be implemented by subclasses.
Parameters
method
string
Returns
void
buildContext()
abstractprotectedbuildContext(ctx,transportInfo?):ContextT
Defined in: packages/core-internal/src/shared/protocol.ts:630
Builds the context object for request handlers. Subclasses must override to return the appropriate context type (e.g., ServerContext adds HTTP request info).
Parameters
ctx
transportInfo?
Returns
ContextT
close()
close():
Promise<void>
Defined in: packages/core-internal/src/shared/protocol.ts:1224
Closes the connection.
Returns
Promise<void>
connect()
connect(
transport):Promise<void>
Defined in: packages/core-internal/src/shared/protocol.ts:782
Attaches to the given transport, starts it, and starts listening for messages.
The caller assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward.
Parameters
transport
Returns
Promise<void>
notification()
notification(
notification,options?):Promise<void>
Defined in: packages/core-internal/src/shared/protocol.ts:1582
Emits a notification, which is a one-way message that does not expect a response.
Parameters
notification
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 MCP specification for notes on _meta usage.
params._meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
params._meta.io.modelcontextprotocol/related-task.taskId
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.
options?
Returns
Promise<void>
removeNotificationHandler()
removeNotificationHandler(
method):void
Defined in: packages/core-internal/src/shared/protocol.ts:1841
Removes the notification handler for the given method.
Parameters
method
string
Returns
void
removeRequestHandler()
removeRequestHandler(
method):void
Defined in: packages/core-internal/src/shared/protocol.ts:1758
Removes the request handler for the given method.
Parameters
method
string
Returns
void
request()
Call Signature
request<
M>(request,options?):Promise<ResultTypeMap[M]>
Defined in: packages/core-internal/src/shared/protocol.ts:1259
Sends a request and waits for a response.
For spec methods the result schema is resolved automatically from the method name and the return type is method-keyed. For custom (non-spec) methods, pass a resultSchema as the second argument; the response is validated against it and the return type is inferred from the schema.
Do not use this method to emit notifications! Use notification() instead.
Type Parameters
M
M extends RequestMethod
Parameters
request
method
M
params?
Record<string, unknown>
options?
Returns
Promise<ResultTypeMap[M]>
Call Signature
request<
T>(request,resultSchema,options?):Promise<InferOutput<T>>
Defined in: packages/core-internal/src/shared/protocol.ts:1263
Sends a request and waits for a response.
For spec methods the result schema is resolved automatically from the method name and the return type is method-keyed. For custom (non-spec) methods, pass a resultSchema as the second argument; the response is validated against it and the return type is inferred from the schema.
Do not use this method to emit notifications! Use notification() instead.
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.
params._meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
params._meta.io.modelcontextprotocol/related-task.taskId
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?
Returns
Promise<InferOutput<T>>
setNotificationHandler()
Call Signature
setNotificationHandler<
M>(method,handler):void
Defined in: packages/core-internal/src/shared/protocol.ts:1784
Registers a handler to invoke when this protocol object receives a notification with the given method.
Note that this will replace any previous notification handler for the same method.
For spec methods, pass (method, handler); the notification is parsed with the spec schema. For custom (non-spec) methods, pass (method, schemas, handler); params are validated against schemas.params and the handler receives the parsed params object directly. The raw notification is passed as the second argument; _meta is recoverable via notification.params?._meta (minus the reserved io.modelcontextprotocol/* envelope keys, which the protocol layer lifts out before dispatch).
Type Parameters
M
M extends NotificationMethod
Parameters
method
M
handler
(notification) => void | Promise<void>
Returns
void
Call Signature
setNotificationHandler<
P>(method,schemas,handler):void
Defined in: packages/core-internal/src/shared/protocol.ts:1788
Registers a handler to invoke when this protocol object receives a notification with the given method.
Note that this will replace any previous notification handler for the same method.
For spec methods, pass (method, handler); the notification is parsed with the spec schema. For custom (non-spec) methods, pass (method, schemas, handler); params are validated against schemas.params and the handler receives the parsed params object directly. The raw notification is passed as the second argument; _meta is recoverable via notification.params?._meta (minus the reserved io.modelcontextprotocol/* envelope keys, which the protocol layer lifts out before dispatch).
Type Parameters
P
P extends StandardSchemaV1<unknown, unknown>
Parameters
method
string
schemas
params
P
handler
(params, notification) => void | Promise<void>
Returns
void
setRequestHandler()
Call Signature
setRequestHandler<
M>(method,handler):void
Defined in: packages/core-internal/src/shared/protocol.ts:1668
Registers a handler to invoke when this protocol object receives a request with the given method.
Note that this will replace any previous request handler for the same method.
For spec methods, pass (method, handler); the request is parsed with the spec schema and the handler receives the typed Request. For custom (non-spec) methods, pass (method, schemas, handler); params are validated against schemas.params and the handler receives the parsed params object directly. Supplying schemas.result types the handler's return value.
Type Parameters
M
M extends RequestMethod
Parameters
method
M
handler
(request, ctx) => HandlerResultTypeMap[M] | Promise<HandlerResultTypeMap[M]>
Returns
void
Example
Custom request method
const SearchParams = z.object({ query: z.string(), limit: z.number().optional() });
const SearchResult = z.object({ hits: z.array(z.string()) });
protocol.setRequestHandler('acme/search', { params: SearchParams, result: SearchResult }, async (params, _ctx) => {
return { hits: [`result for ${params.query}`] };
});Call Signature
setRequestHandler<
P,R>(method,schemas,handler):void
Defined in: packages/core-internal/src/shared/protocol.ts:1672
Registers a handler to invoke when this protocol object receives a request with the given method.
Note that this will replace any previous request handler for the same method.
For spec methods, pass (method, handler); the request is parsed with the spec schema and the handler receives the typed Request. For custom (non-spec) methods, pass (method, schemas, handler); params are validated against schemas.params and the handler receives the parsed params object directly. Supplying schemas.result types the handler's return value.
Type Parameters
P
P extends StandardSchemaV1<unknown, unknown>
R
R extends StandardSchemaV1<unknown, unknown> | undefined = undefined
Parameters
method
string
schemas
params
P
result?
R
handler
(params, ctx) => InferHandlerResult<R> | Promise<InferHandlerResult<R>>
Returns
void
Example
Custom request method
const SearchParams = z.object({ query: z.string(), limit: z.number().optional() });
const SearchResult = z.object({ hits: z.array(z.string()) });
protocol.setRequestHandler('acme/search', { params: SearchParams, result: SearchResult }, async (params, _ctx) => {
return { hits: [`result for ${params.query}`] };
});ProtocolError
Defined in: packages/core-internal/src/types/errors.ts:19
Protocol errors are JSON-RPC errors that cross the wire as error responses. They use numeric error codes from the ProtocolErrorCode enum.
instanceof on this class (and its subclasses) is brand-matched, so it works across separately bundled copies of the SDK — e.g. an error constructed by @modelcontextprotocol/client matches the class re-exported by @modelcontextprotocol/server in the same process.
Extends
Error
Extended by
MissingRequiredClientCapabilityErrorResourceNotFoundErrorUnsupportedProtocolVersionErrorUrlElicitationRequiredError
Constructors
Constructor
new ProtocolError(
code,message,data?):ProtocolError
Defined in: packages/core-internal/src/types/errors.ts:46
Parameters
code
number
message
string
data?
unknown
Returns
Overrides
Error.constructor
Properties
cause?
optionalcause?: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
readonlycode:number
Defined in: packages/core-internal/src/types/errors.ts:47
data?
readonlyoptionaldata?:unknown
Defined in: packages/core-internal/src/types/errors.ts:49
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?
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stack
stackTraceLimit
staticstackTraceLimit: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
[hasInstance]()
static[hasInstance](value):boolean
Defined in: packages/core-internal/src/types/errors.ts:24
Parameters
value
unknown
Returns
boolean
captureStackTrace()
staticcaptureStackTrace(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.
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:
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()
staticfromError(code,message,data?):ProtocolError
Defined in: packages/core-internal/src/types/errors.ts:59
Factory method to create the appropriate error type based on the error code and data
Parameters
code
number
message
string
data?
unknown
Returns
isError()
staticisError(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
isInstance()
staticisInstance<T>(this,value):value is InstanceType<T>
Defined in: packages/core-internal/src/types/errors.ts:37
Brand-based type guard: equivalent to value instanceof this, as an explicit static predicate (the axios/AWS-SDK isInstance style). Reads the caller's own brand via this, so every branded subclass gets a correctly-scoped guard by inheritance. Must be invoked on the class — in callback position write v => SdkError.isInstance(v), not .filter(SdkError.isInstance) (detached calls throw rather than silently matching nothing).
Type Parameters
T
T extends (...args) => unknown
Parameters
this
T
value
unknown
Returns
value is InstanceType<T>
prepareStackTrace()
staticprepareStackTrace(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
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:125
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). instanceof checks are brand-matched and 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:130
Parameters
uri
string
message?
string = ...
Returns
Overrides
Properties
cause?
optionalcause?:unknown
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
code
readonlycode:number
Defined in: packages/core-internal/src/types/errors.ts:47
Inherited from
data?
readonlyoptionaldata?:unknown
Defined in: packages/core-internal/src/types/errors.ts:49
Inherited from
message
message:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
name
name:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stack?
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
stackTraceLimit
staticstackTraceLimit: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
Accessors
uri
Get Signature
get uri():
string
Defined in: packages/core-internal/src/types/errors.ts:135
The URI that was requested and not found.
Returns
string
Methods
[hasInstance]()
static[hasInstance](value):boolean
Defined in: packages/core-internal/src/types/errors.ts:24
Parameters
value
unknown
Returns
boolean
Inherited from
captureStackTrace()
staticcaptureStackTrace(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.
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:
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()
staticfromError(code,message,data?):ProtocolError
Defined in: packages/core-internal/src/types/errors.ts:59
Factory method to create the appropriate error type based on the error code and data
Parameters
code
number
message
string
data?
unknown
Returns
Inherited from
isError()
staticisError(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
isInstance()
staticisInstance<T>(this,value):value is InstanceType<T>
Defined in: packages/core-internal/src/types/errors.ts:37
Brand-based type guard: equivalent to value instanceof this, as an explicit static predicate (the axios/AWS-SDK isInstance style). Reads the caller's own brand via this, so every branded subclass gets a correctly-scoped guard by inheritance. Must be invoked on the class — in callback position write v => SdkError.isInstance(v), not .filter(SdkError.isInstance) (detached calls throw rather than silently matching nothing).
Type Parameters
T
T extends (...args) => unknown
Parameters
this
T
value
unknown
Returns
value is InstanceType<T>
Inherited from
prepareStackTrace()
staticprepareStackTrace(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:102
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
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:129
Parameters
code
message
string
data?
unknown
Returns
Overrides
Error.constructor
Properties
cause?
optionalcause?: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
readonlycode:SdkErrorCode
Defined in: packages/core-internal/src/errors/sdkErrors.ts:130
data?
readonlyoptionaldata?:unknown
Defined in: packages/core-internal/src/errors/sdkErrors.ts:132
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?
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stack
stackTraceLimit
staticstackTraceLimit: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
[hasInstance]()
static[hasInstance](value):boolean
Defined in: packages/core-internal/src/errors/sdkErrors.ts:107
Parameters
value
unknown
Returns
boolean
captureStackTrace()
staticcaptureStackTrace(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.
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:
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()
staticisError(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
isInstance()
staticisInstance<T>(this,value):value is InstanceType<T>
Defined in: packages/core-internal/src/errors/sdkErrors.ts:120
Brand-based type guard: equivalent to value instanceof this, as an explicit static predicate (the axios/AWS-SDK isInstance style). Reads the caller's own brand via this, so every branded subclass gets a correctly-scoped guard by inheritance. Must be invoked on the class — in callback position write v => SdkError.isInstance(v), not .filter(SdkError.isInstance) (detached calls throw rather than silently matching nothing).
Type Parameters
T
T extends (...args) => unknown
Parameters
this
T
value
unknown
Returns
value is InstanceType<T>
prepareStackTrace()
staticprepareStackTrace(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:165
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
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:172
Parameters
code
message
string
data
Returns
Overrides
Properties
cause?
optionalcause?:unknown
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
code
readonlycode:SdkErrorCode
Defined in: packages/core-internal/src/errors/sdkErrors.ts:130
Inherited from
data
readonlydata:SdkHttpErrorData
Defined in: packages/core-internal/src/errors/sdkErrors.ts:170
Overrides
message
message:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
name
name:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stack?
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
stackTraceLimit
staticstackTraceLimit: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
Accessors
status
Get Signature
get status():
number
Defined in: packages/core-internal/src/errors/sdkErrors.ts:177
Returns
number
statusText
Get Signature
get statusText():
string|undefined
Defined in: packages/core-internal/src/errors/sdkErrors.ts:181
Returns
string | undefined
Methods
[hasInstance]()
static[hasInstance](value):boolean
Defined in: packages/core-internal/src/errors/sdkErrors.ts:107
Parameters
value
unknown
Returns
boolean
Inherited from
captureStackTrace()
staticcaptureStackTrace(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.
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:
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
isError()
staticisError(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
isInstance()
staticisInstance<T>(this,value):value is InstanceType<T>
Defined in: packages/core-internal/src/errors/sdkErrors.ts:120
Brand-based type guard: equivalent to value instanceof this, as an explicit static predicate (the axios/AWS-SDK isInstance style). Reads the caller's own brand via this, so every branded subclass gets a correctly-scoped guard by inheritance. Must be invoked on the class — in callback position write v => SdkError.isInstance(v), not .filter(SdkError.isInstance) (detached calls throw rather than silently matching nothing).
Type Parameters
T
T extends (...args) => unknown
Parameters
this
T
value
unknown
Returns
value is InstanceType<T>
Inherited from
prepareStackTrace()
staticprepareStackTrace(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
UnsupportedProtocolVersionError
Defined in: packages/core-internal/src/types/errors.ts:169
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:174
Parameters
data
UnsupportedProtocolVersionErrorData
message?
string = ...
Returns
UnsupportedProtocolVersionError
Overrides
Properties
cause?
optionalcause?:unknown
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
code
readonlycode:number
Defined in: packages/core-internal/src/types/errors.ts:47
Inherited from
data?
readonlyoptionaldata?:unknown
Defined in: packages/core-internal/src/types/errors.ts:49
Inherited from
message
message:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
name
name:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stack?
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
stackTraceLimit
staticstackTraceLimit: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
Accessors
requested
Get Signature
get requested():
string
Defined in: packages/core-internal/src/types/errors.ts:188
The protocol version that was requested.
Returns
string
supported
Get Signature
get supported():
string[]
Defined in: packages/core-internal/src/types/errors.ts:181
Protocol versions the receiver supports.
Returns
string[]
Methods
[hasInstance]()
static[hasInstance](value):boolean
Defined in: packages/core-internal/src/types/errors.ts:24
Parameters
value
unknown
Returns
boolean
Inherited from
captureStackTrace()
staticcaptureStackTrace(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.
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:
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()
staticfromError(code,message,data?):ProtocolError
Defined in: packages/core-internal/src/types/errors.ts:59
Factory method to create the appropriate error type based on the error code and data
Parameters
code
number
message
string
data?
unknown
Returns
Inherited from
isError()
staticisError(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
isInstance()
staticisInstance<T>(this,value):value is InstanceType<T>
Defined in: packages/core-internal/src/types/errors.ts:37
Brand-based type guard: equivalent to value instanceof this, as an explicit static predicate (the axios/AWS-SDK isInstance style). Reads the caller's own brand via this, so every branded subclass gets a correctly-scoped guard by inheritance. Must be invoked on the class — in callback position write v => SdkError.isInstance(v), not .filter(SdkError.isInstance) (detached calls throw rather than silently matching nothing).
Type Parameters
T
T extends (...args) => unknown
Parameters
this
T
value
unknown
Returns
value is InstanceType<T>
Inherited from
prepareStackTrace()
staticprepareStackTrace(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
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
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()
staticisTemplate(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:144
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:149
Parameters
elicitations
object[]
message?
string = ...
Returns
Overrides
Properties
cause?
optionalcause?:unknown
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
code
readonlycode:number
Defined in: packages/core-internal/src/types/errors.ts:47
Inherited from
data?
readonlyoptionaldata?:unknown
Defined in: packages/core-internal/src/types/errors.ts:49
Inherited from
message
message:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
name
name:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
stack?
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
stackTraceLimit
staticstackTraceLimit: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
Accessors
elicitations
Get Signature
get elicitations():
object[]
Defined in: packages/core-internal/src/types/errors.ts:155
Returns
Methods
[hasInstance]()
static[hasInstance](value):boolean
Defined in: packages/core-internal/src/types/errors.ts:24
Parameters
value
unknown
Returns
boolean
Inherited from
captureStackTrace()
staticcaptureStackTrace(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.
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:
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()
staticfromError(code,message,data?):ProtocolError
Defined in: packages/core-internal/src/types/errors.ts:59
Factory method to create the appropriate error type based on the error code and data
Parameters
code
number
message
string
data?
unknown
Returns
Inherited from
isError()
staticisError(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
isInstance()
staticisInstance<T>(this,value):value is InstanceType<T>
Defined in: packages/core-internal/src/types/errors.ts:37
Brand-based type guard: equivalent to value instanceof this, as an explicit static predicate (the axios/AWS-SDK isInstance style). Reads the caller's own brand via this, so every branded subclass gets a correctly-scoped guard by inheritance. Must be invoked on the class — in callback position write v => SdkError.isInstance(v), not .filter(SdkError.isInstance) (detached calls throw rather than silently matching nothing).
Type Parameters
T
T extends (...args) => unknown
Parameters
this
T
value
unknown
Returns
value is InstanceType<T>
Inherited from
prepareStackTrace()
staticprepareStackTrace(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
AuthInfo
Defined in: packages/core-internal/src/types/types.ts:722
Information about a validated access token, provided to request handlers.
Properties
clientId
clientId:
string
Defined in: packages/core-internal/src/types/types.ts:731
The client ID associated with this token.
expiresAt?
optionalexpiresAt?:number
Defined in: packages/core-internal/src/types/types.ts:741
When the token expires (in seconds since epoch).
extra?
optionalextra?:Record<string,unknown>
Defined in: packages/core-internal/src/types/types.ts:753
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?
optionalresource?:URL
Defined in: packages/core-internal/src/types/types.ts:747
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:736
Scopes associated with this token.
token
token:
string
Defined in: packages/core-internal/src/types/types.ts:726
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?
optionalcacheScope?: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?
optionalttlMs?:number
Defined in: packages/core-internal/src/shared/resultCacheHints.ts:35
Cache lifetime in milliseconds. Must be a non-negative safe integer.
CreateMessageRequestParamsWithTools
Defined in: packages/core-internal/src/types/types.ts:937
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/src/schemas.ts:54
See General fields: _meta for notes on _meta usage.
Index Signature
[key: string]: unknown
io.modelcontextprotocol/related-task?
optionalio.modelcontextprotocol/related-task?:object
If specified, this request is related to the provided task.
io.modelcontextprotocol/related-task.taskId
taskId:
string
progressToken?
optionalprogressToken?: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?
optionalincludeContext?:"none"|"thisServer"|"allServers"
Defined in: packages/core/src/schemas.ts:1706
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/src/schemas.ts:1713
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/src/schemas.ts:1686
_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?
optionalannotations?:object
Optional annotations for the client.
annotations.audience?
optionalaudience?: ("user"|"assistant")[]
Intended audience(s) for the resource.
annotations.lastModified?
optionallastModified?:string
ISO 8601 timestamp for the most recent modification.
annotations.priority?
optionalpriority?: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?
optionalannotations?:object
Optional annotations for the client.
annotations.audience?
optionalaudience?: ("user"|"assistant")[]
Intended audience(s) for the resource.
annotations.lastModified?
optionallastModified?:string
ISO 8601 timestamp for the most recent modification.
annotations.priority?
optionalpriority?: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?
optionalannotations?:object
Optional annotations for the client.
annotations.audience?
optionalaudience?: ("user"|"assistant")[]
Intended audience(s) for the resource.
annotations.lastModified?
optionallastModified?:string
ISO 8601 timestamp for the most recent modification.
annotations.priority?
optionalpriority?: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?
optionalisError?:boolean
structuredContent?
optionalstructuredContent?: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?
optionalmetadata?:object
Defined in: packages/core/src/schemas.ts:1718
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?
optionalmodelPreferences?:object
Defined in: packages/core/src/schemas.ts:1690
The server's preferences for which model to select. The client MAY modify or omit this request.
costPriority?
optionalcostPriority?:number
How much to prioritize cost when selecting a model.
hints?
optionalhints?:object[]
Optional hints to use for model selection.
intelligencePriority?
optionalintelligencePriority?:number
How much to prioritize intelligence and capabilities when selecting a model.
speedPriority?
optionalspeedPriority?:number
How much to prioritize sampling speed (latency) when selecting a model.
Inherited from
CreateMessageRequestParams.modelPreferences
stopSequences?
optionalstopSequences?:string[]
Defined in: packages/core/src/schemas.ts:1714
Inherited from
CreateMessageRequestParams.stopSequences
systemPrompt?
optionalsystemPrompt?:string
Defined in: packages/core/src/schemas.ts:1694
An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
Inherited from
CreateMessageRequestParams.systemPrompt
task?
optionaltask?:object
Defined in: packages/core/src/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?
optionalttl?:number
Inherited from
CreateMessageRequestParams.task
temperature?
optionaltemperature?:number
Defined in: packages/core/src/schemas.ts:1707
Inherited from
CreateMessageRequestParams.temperature
toolChoice?
optionaltoolChoice?:object
Defined in: packages/core/src/schemas.ts:1729
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?
optionalmode?:"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:938
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?
optionalannotations?:object
Optional additional tool information.
annotations.destructiveHint?
optionaldestructiveHint?: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?
optionalidempotentHint?: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?
optionalopenWorldHint?: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?
optionalreadOnlyHint?:boolean
If true, the tool does not modify its environment.
Default: false
annotations.title?
optionaltitle?:string
A human-readable title for the tool.
description?
optionaldescription?:string
A human-readable description of the tool.
execution?
optionalexecution?:object
Execution-related properties for this tool.
execution.taskSupport?
optionaltaskSupport?:"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?
optionalicons?: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(andimage/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?
optionalproperties?: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?
optionalrequired?: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?
optionaloutputSchema?: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?
optionaltitle?: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?
optionalbody?: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?
optionalmcpMethodHeader?:string
Defined in: packages/core-internal/src/shared/inboundClassification.ts:96
The value of the Mcp-Method header, when present.
mcpNameHeader?
optionalmcpNameHeader?:string
Defined in: packages/core-internal/src/shared/inboundClassification.ts:98
The value of the Mcp-Name header, when present.
protocolVersionHeader?
optionalprotocolVersionHeader?: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?
optionaldata?: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?
optionalrequestedVersion?: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:603
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:642
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/src/schemas.ts:97
See MCP specification for notes on _meta usage.
Index Signature
[key: string]: unknown
io.modelcontextprotocol/related-task?
optionalio.modelcontextprotocol/related-task?:object
If specified, this request is related to the provided task.
io.modelcontextprotocol/related-task.taskId
taskId:
string
progressToken?
optionalprogressToken?: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?
optionalinputRequests?:InputRequests
Defined in: packages/core-internal/src/types/types.ts:645
Embedded requests the client must fulfil before retrying.
requestState?
optionalrequestState?:string
Defined in: packages/core-internal/src/types/types.ts:647
Opaque server state the client echoes back verbatim on retry.
resultType
resultType:
"input_required"
Defined in: packages/core-internal/src/types/types.ts:643
InputRequiredSpec
Defined in: packages/core-internal/src/shared/inputRequired.ts:40
The shape accepted by inputRequired.
Properties
inputRequests?
optionalinputRequests?:InputRequests
Defined in: packages/core-internal/src/shared/inputRequired.ts:42
Embedded requests the client must fulfil before retrying.
requestState?
optionalrequestState?:string
Defined in: packages/core-internal/src/shared/inputRequired.ts:44
Opaque server state echoed back verbatim by the client on retry.
InputResponses
Defined in: packages/core-internal/src/types/types.ts:612
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:770
Extends
JSONRPCErrorObject
Properties
code
code:
-32603
Defined in: packages/core-internal/src/types/types.ts:771
Overrides
JSONRPCErrorObject.code
data?
optionaldata?:unknown
Defined in: packages/core-internal/src/types/types.ts:756
Inherited from
JSONRPCErrorObject.data
message
message:
string
Defined in: packages/core-internal/src/types/types.ts:756
Inherited from
JSONRPCErrorObject.message
InvalidParamsError
Defined in: packages/core-internal/src/types/types.ts:767
Extends
JSONRPCErrorObject
Properties
code
code:
-32602
Defined in: packages/core-internal/src/types/types.ts:768
Overrides
JSONRPCErrorObject.code
data?
optionaldata?:unknown
Defined in: packages/core-internal/src/types/types.ts:756
Inherited from
JSONRPCErrorObject.data
message
message:
string
Defined in: packages/core-internal/src/types/types.ts:756
Inherited from
JSONRPCErrorObject.message
InvalidRequestError
Defined in: packages/core-internal/src/types/types.ts:761
Extends
JSONRPCErrorObject
Properties
code
code:
-32600
Defined in: packages/core-internal/src/types/types.ts:762
Overrides
JSONRPCErrorObject.code
data?
optionaldata?:unknown
Defined in: packages/core-internal/src/types/types.ts:756
Inherited from
JSONRPCErrorObject.data
message
message:
string
Defined in: packages/core-internal/src/types/types.ts:756
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
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
Standard JSON Schema object
Returns
A validator function that can be called multiple times
MessageClassification
Defined in: packages/core-internal/src/types/types.ts:869
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:874
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?
optionalrevision?:string
Defined in: packages/core-internal/src/types/types.ts:879
The exact protocol revision, when the classifier derived one.
MessageExtraInfo
Defined in: packages/core-internal/src/types/types.ts:885
Extra information about a message.
Properties
authInfo?
optionalauthInfo?:AuthInfo
Defined in: packages/core-internal/src/types/types.ts:902
The authentication information.
classification?
optionalclassification?:MessageClassification
Defined in: packages/core-internal/src/types/types.ts:897
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?
optionalcloseSSEStream?: () =>void
Defined in: packages/core-internal/src/types/types.ts:908
Callback to close the SSE stream for this request, triggering client reconnection. Only available when using NodeStreamableHTTPServerTransport with eventStore configured.
Returns
void
closeStandaloneSSEStream?
optionalcloseStandaloneSSEStream?: () =>void
Defined in: packages/core-internal/src/types/types.ts:914
Callback to close the standalone GET SSE stream, triggering client reconnection. Only available when using NodeStreamableHTTPServerTransport with eventStore configured.
Returns
void
request?
optionalrequest?:Request
Defined in: packages/core-internal/src/types/types.ts:889
The original HTTP request.
MethodNotFoundError
Defined in: packages/core-internal/src/types/types.ts:764
Extends
JSONRPCErrorObject
Properties
code
code:
-32601
Defined in: packages/core-internal/src/types/types.ts:765
Overrides
JSONRPCErrorObject.code
data?
optionaldata?:unknown
Defined in: packages/core-internal/src/types/types.ts:756
Inherited from
JSONRPCErrorObject.data
message
message:
string
Defined in: packages/core-internal/src/types/types.ts:756
Inherited from
JSONRPCErrorObject.message
MissingRequiredClientCapabilityErrorData
Defined in: packages/core-internal/src/types/types.ts:778
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:784
The capabilities the server requires from the client to process the request, in the ClientCapabilities shape (only the missing capabilities are listed).
elicitation?
optionalelicitation?: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?
optionalform?: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?
optionalapplyDefaults?:boolean
elicitation.url?
optionalurl?: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?
optionalexperimental?:object
Experimental, non-standard capabilities that the client supports.
Index Signature
[key: string]: object
extensions?
optionalextensions?:object
Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
Index Signature
[key: string]: object
roots?
optionalroots?: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?
optionallistChanged?:boolean
Whether the client supports issuing notifications for changes to the roots list.
sampling?
optionalsampling?: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?
optionalcontext?: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?
optionaltools?: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?
optionaltasks?: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?
optionalcancel?: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?
optionallist?: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?
optionalrequests?:object
Capabilities for task creation on specific request types.
Index Signature
[key: string]: unknown
tasks.requests.elicitation?
optionalelicitation?:object
Task support for elicitation requests.
Index Signature
[key: string]: unknown
tasks.requests.elicitation.create?
optionalcreate?: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?
optionalsampling?:object
Task support for sampling requests.
Index Signature
[key: string]: unknown
tasks.requests.sampling.createMessage?
optionalcreateMessage?: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:758
Extends
JSONRPCErrorObject
Properties
code
code:
-32700
Defined in: packages/core-internal/src/types/types.ts:759
Overrides
JSONRPCErrorObject.code
data?
optionaldata?:unknown
Defined in: packages/core-internal/src/types/types.ts:756
Inherited from
JSONRPCErrorObject.data
message
message:
string
Defined in: packages/core-internal/src/types/types.ts:756
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?
optionalresult?:R
Defined in: packages/core-internal/src/shared/protocol.ts:1858
SdkHttpErrorData
Defined in: packages/core-internal/src/errors/sdkErrors.ts:143
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:144
statusText?
optionalstatusText?:string
Defined in: packages/core-internal/src/errors/sdkErrors.ts:145
StandardSchemaV1
Defined in: packages/core-internal/src/util/standardSchema.ts:35
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:36
StandardSchemaV1Sync
Defined in: packages/core-internal/src/util/standardSchema.ts:128
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
StandardSchemaV1<Input,Output>
Type Parameters
Input
Input = unknown
Output
Output = Input
Properties
~standard
readonly~standard:Props<Input,Output>
Defined in: packages/core-internal/src/util/standardSchema.ts:129
Overrides
StandardSchemaWithJSON
Defined in: packages/core-internal/src/util/standardSchema.ts:110
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:111
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?
readonlyoptionalhasPerRequestStream?: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?
optionalonclose?: () =>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?
optionalonerror?: (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?
optionalonmessage?: <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?
Returns
void
sessionId?
optionalsessionId?:string
Defined in: packages/core-internal/src/shared/transport.ts:167
The session ID generated for this connection.
setProtocolVersion?
optionalsetProtocolVersion?: (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?
optionalsetSupportedProtocolVersions?: (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
options?
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:791
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:800
The protocol version that was requested.
supported
supported:
string[]
Defined in: packages/core-internal/src/types/types.ts:796
Protocol versions the receiver supports. The sender should choose a mutually supported version from this list and retry.
Type Aliases
Annotations
Annotations =
Infer<typeofAnnotationsSchema>
Defined in: packages/core-internal/src/types/types.ts:265
AudioContent
AudioContent =
Infer<typeofAudioContentSchema>
Defined in: packages/core-internal/src/types/types.ts:391
AuthorizationServerMetadata
AuthorizationServerMetadata =
OAuthMetadata|OpenIdProviderDiscoveryMetadata
Defined in: packages/core/src/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?
optionalhttp?:object
Defined in: packages/core-internal/src/shared/protocol.ts:439
HTTP transport information, only available when using an HTTP-based transport.
authInfo?
optionalauthInfo?: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?
optionaldroppedInputResponseKeys?: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?
optionalenvelope?: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?
optionalinputResponses?: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
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?
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.
params._meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
params._meta.io.modelcontextprotocol/related-task.taskId
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?
Returns
Promise<InferOutput<T>>
signal
signal:
AbortSignal
An abort signal used to communicate if the request was cancelled from the sender's side.
sessionId?
optionalsessionId?:string
Defined in: packages/core-internal/src/shared/protocol.ts:330
The session ID from the transport, if available.
BaseMetadata
BaseMetadata =
Infer<typeofBaseMetadataSchema>
Defined in: packages/core-internal/src/types/types.ts:264
BlobResourceContents
BlobResourceContents =
Infer<typeofBlobResourceContentsSchema>
Defined in: packages/core-internal/src/types/types.ts:353
BooleanSchema
BooleanSchema =
Infer<typeofBooleanSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:518
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<typeofCallToolRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:420
CallToolRequestParams
CallToolRequestParams =
Infer<typeofCallToolRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:417
CallToolResult
CallToolResult =
StripWireOnly<Infer<typeofCallToolResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:418
CancelledNotification
CancelledNotification =
Infer<typeofCancelledNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:259
CancelledNotificationParams
CancelledNotificationParams =
Infer<typeofCancelledNotificationParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:258
CancelTaskRequest
CancelTaskRequest =
Infer<typeofCancelTaskRequestSchema>
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.
CancelTaskResult
CancelTaskResult =
StripWireOnly<Infer<typeofCancelTaskResultSchema>>
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.
ClientCapabilities
ClientCapabilities =
Infer<typeofClientCapabilitiesSchema>
Defined in: packages/core-internal/src/types/types.ts:277
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<typeofClientNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:652
ClientRequest
ClientRequest =
Infer<typeofClientRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:651
ClientResult
ClientResult =
StripWireOnly<Infer<typeofClientResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:653
CompatibilityCallToolResult
CompatibilityCallToolResult =
StripWireOnly<Infer<typeofCompatibilityCallToolResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:419
CompleteRequest
CompleteRequest =
Infer<typeofCompleteRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:544
CompleteRequestParams
CompleteRequestParams =
Infer<typeofCompleteRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:543
CompleteRequestPrompt
CompleteRequestPrompt =
ExpandRecursively<CompleteRequest&object>
Defined in: packages/core-internal/src/types/types.ts:944
CompleteRequestResourceTemplate
CompleteRequestResourceTemplate =
ExpandRecursively<CompleteRequest&object>
Defined in: packages/core-internal/src/types/types.ts:941
CompleteResult
CompleteResult =
StripWireOnly<Infer<typeofCompleteResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:545
ContentBlock
ContentBlock =
Infer<typeofContentBlockSchema>
Defined in: packages/core-internal/src/types/types.ts:406
CreateMessageRequest
CreateMessageRequest =
Infer<typeofCreateMessageRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:503
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<typeofCreateMessageRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:497
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:928
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<typeofCreateMessageResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:509
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<typeofCreateMessageResultWithToolsSchema>>
Defined in: packages/core-internal/src/types/types.ts:515
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<typeofCreateTaskResultSchema>>
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.
Cursor
Cursor =
Infer<typeofCursorSchema>
Defined in: packages/core-internal/src/types/types.ts:220
DiscoverRequest
DiscoverRequest =
Infer<typeofDiscoverRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:292
DiscoverResult
DiscoverResult =
StripWireOnly<Infer<typeofDiscoverResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:293
ElicitationCompleteNotification
ElicitationCompleteNotification =
Infer<typeofElicitationCompleteNotificationSchema>
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.
ElicitationCompleteNotificationParams
ElicitationCompleteNotificationParams =
Infer<typeofElicitationCompleteNotificationParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:535
Deprecated
Removed from the spec by #2891 (2026-07-28). 2025-era only; the 2026-07-28 wire codec excludes this notification.
ElicitInputParams
ElicitInputParams =
Omit<ElicitRequestFormParams,"requestedSchema"> &object
Defined in: packages/core-internal/src/shared/elicitation.ts:21
Input accepted by inputRequired.elicit(): a wire-ready elicitation JSON Schema or a Standard Schema.
Type Declaration
requestedSchema
requestedSchema:
ElicitRequestFormParams["requestedSchema"] |StandardSchemaWithJSON
ElicitRequest
ElicitRequest =
Infer<typeofElicitRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:533
ElicitRequestFormParams
ElicitRequestFormParams =
Infer<typeofElicitRequestFormParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:531
ElicitRequestParams
ElicitRequestParams =
Infer<typeofElicitRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:530
ElicitRequestURLParams
ElicitRequestURLParams =
Infer<typeofElicitRequestURLParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:532
ElicitResult
ElicitResult =
StripWireOnly<Infer<typeofElicitResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:538
EmbeddedResource
EmbeddedResource =
Infer<typeofEmbeddedResourceSchema>
Defined in: packages/core-internal/src/types/types.ts:404
EmptyResult
EmptyResult =
StripWireOnly<Infer<typeofEmptyResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:255
EnumSchema
EnumSchema =
Infer<typeofEnumSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:521
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<typeofGetPromptRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:388
GetPromptRequestParams
GetPromptRequestParams =
Infer<typeofGetPromptRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:387
GetPromptResult
GetPromptResult =
StripWireOnly<Infer<typeofGetPromptResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:408
GetTaskPayloadRequest
GetTaskPayloadRequest =
Infer<typeofGetTaskPayloadRequestSchema>
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.
GetTaskPayloadResult
GetTaskPayloadResult =
StripWireOnly<Infer<typeofGetTaskPayloadResultSchema>>
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.
GetTaskRequest
GetTaskRequest =
Infer<typeofGetTaskRequestSchema>
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.
GetTaskResult
GetTaskResult =
StripWireOnly<Infer<typeofGetTaskResultSchema>>
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.
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:713
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<typeofIconSchema>
Defined in: packages/core-internal/src/types/types.ts:262
Icons
Icons =
Infer<typeofIconsSchema>
Defined in: packages/core-internal/src/types/types.ts:263
IdJagTokenExchangeResponse
IdJagTokenExchangeResponse =
z.infer<typeofIdJagTokenExchangeResponseSchema>
Defined in: packages/core/src/auth.ts:163
ImageContent
ImageContent =
Infer<typeofImageContentSchema>
Defined in: packages/core-internal/src/types/types.ts:390
Implementation
Implementation =
Infer<typeofImplementationSchema>
Defined in: packages/core-internal/src/types/types.ts:269
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<typeofInitializedNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:289
InitializeRequest
InitializeRequest =
Infer<typeofInitializeRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:279
InitializeRequestParams
InitializeRequestParams =
Infer<typeofInitializeRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:278
InitializeResult
InitializeResult =
StripWireOnly<Infer<typeofInitializeResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:288
InputRequest
InputRequest =
CreateMessageRequest|ListRootsRequest|ElicitRequest
Defined in: packages/core-internal/src/types/types.ts:590
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:597
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:208
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/src/types.ts:4
JSONObject
JSONObject =
object
Defined in: packages/core/src/types.ts:3
Index Signature
[key: string]: JSONValue
JSONRPCErrorResponse
JSONRPCErrorResponse =
Infer<typeofJSONRPCErrorResponseSchema>
Defined in: packages/core-internal/src/types/types.ts:230
JSONRPCMessage
JSONRPCMessage =
JSONRPCRequest|JSONRPCNotification|JSONRPCResultResponse|JSONRPCErrorResponse
Defined in: packages/core-internal/src/types/types.ts:235
JSONRPCNotification
JSONRPCNotification =
Infer<typeofJSONRPCNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:229
JSONRPCRequest
JSONRPCRequest =
Infer<typeofJSONRPCRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:228
JSONRPCResponse
JSONRPCResponse =
JSONRPCResultResponse|JSONRPCErrorResponse
Defined in: packages/core-internal/src/types/types.ts:234
JSONRPCResultResponse
JSONRPCResultResponse =
Omit<Infer<typeofJSONRPCResultResponseSchema>,"result"> &object
Defined in: packages/core-internal/src/types/types.ts:233
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
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/src/types.ts:2
LegacyTitledEnumSchema
LegacyTitledEnumSchema =
Infer<typeofLegacyTitledEnumSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:524
ListChangedCallback
ListChangedCallback<
T> = (error,items) =>void
Defined in: packages/core-internal/src/types/types.ts:806
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:843
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?
optionalprompts?:ListChangedOptions<Prompt>
Defined in: packages/core-internal/src/types/types.ts:851
Handler for prompt list changes.
resources?
optionalresources?:ListChangedOptions<Resource>
Defined in: packages/core-internal/src/types/types.ts:855
Handler for resource list changes.
tools?
optionaltools?:ListChangedOptions<Tool>
Defined in: packages/core-internal/src/types/types.ts:847
Handler for tool list changes.
ListChangedOptions
ListChangedOptions<
T> =object
Defined in: packages/core-internal/src/types/types.ts:813
Options for subscribing to list changed notifications.
Type Parameters
T
T
The type of items in the list (Tool, Prompt, or Resource)
Properties
autoRefresh?
optionalautoRefresh?:boolean
Defined in: packages/core-internal/src/types/types.ts:818
If true, the list will be refreshed automatically when a list changed notification is received.
Default
truedebounceMs?
optionaldebounceMs?:number
Defined in: packages/core-internal/src/types/types.ts:823
Debounce time in milliseconds. Set to 0 to disable.
Default
300onChanged
onChanged:
ListChangedCallback<T>
Defined in: packages/core-internal/src/types/types.ts:830
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<typeofListPromptsRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:385
ListPromptsResult
ListPromptsResult =
StripWireOnly<Infer<typeofListPromptsResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:386
ListResourcesRequest
ListResourcesRequest =
Infer<typeofListResourcesRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:357
ListResourcesResult
ListResourcesResult =
StripWireOnly<Infer<typeofListResourcesResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:358
ListResourceTemplatesRequest
ListResourceTemplatesRequest =
Infer<typeofListResourceTemplatesRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:359
ListResourceTemplatesResult
ListResourceTemplatesResult =
StripWireOnly<Infer<typeofListResourceTemplatesResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:360
ListRootsRequest
ListRootsRequest =
Infer<typeofListRootsRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:559
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<typeofListRootsResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:565
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<typeofListTasksRequestSchema>
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.
ListTasksResult
ListTasksResult =
StripWireOnly<Infer<typeofListTasksResultSchema>>
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.
ListToolsRequest
ListToolsRequest =
Infer<typeofListToolsRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:415
ListToolsResult
ListToolsResult =
StripWireOnly<Infer<typeofListToolsResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:416
LoggingLevel
LoggingLevel =
Infer<typeofLoggingLevelSchema>
Defined in: packages/core-internal/src/types/types.ts:429
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<typeofLoggingMessageNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:453
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<typeofLoggingMessageNotificationParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:447
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:917
ModelHint
ModelHint =
Infer<typeofModelHintSchema>
Defined in: packages/core-internal/src/types/types.ts:467
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<typeofModelPreferencesSchema>
Defined in: packages/core-internal/src/types/types.ts:473
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<typeofMultiSelectEnumSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:528
Notification
Notification =
Infer<typeofNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:225
NotificationMethod
NotificationMethod =
Exclude<ClientNotification["method"] |ServerNotification["method"],TaskNotificationMethod>
Defined in: packages/core-internal/src/types/types.ts:674
NotificationOptions
NotificationOptions =
object
Defined in: packages/core-internal/src/shared/protocol.ts:172
Options that can be given per notification.
Properties
relatedRequestId?
optionalrelatedRequestId?: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<typeofNotificationsParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:237
NotificationTypeMap
NotificationTypeMap =
MethodToTypeMap<Exclude<ClientNotification|ServerNotification, {method:TaskNotificationMethod; }>>
Defined in: packages/core-internal/src/types/types.ts:676
NumberSchema
NumberSchema =
Infer<typeofNumberSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:520
OAuthClientInformation
OAuthClientInformation =
z.infer<typeofOAuthClientInformationSchema>
Defined in: packages/core/src/auth.ts:257
OAuthClientInformationFull
OAuthClientInformationFull =
z.infer<typeofOAuthClientInformationFullSchema>
Defined in: packages/core/src/auth.ts:258
OAuthClientInformationMixed
OAuthClientInformationMixed =
OAuthClientInformation|OAuthClientInformationFull
Defined in: packages/core/src/auth.ts:259
OAuthClientMetadata
OAuthClientMetadata =
z.infer<typeofOAuthClientMetadataSchema>
Defined in: packages/core/src/auth.ts:256
OAuthClientRegistrationError
OAuthClientRegistrationError =
z.infer<typeofOAuthClientRegistrationErrorSchema>
Defined in: packages/core/src/auth.ts:280
OAuthErrorResponse
OAuthErrorResponse =
z.infer<typeofOAuthErrorResponseSchema>
Defined in: packages/core/src/auth.ts:255
OAuthMetadata
OAuthMetadata =
z.infer<typeofOAuthMetadataSchema>
Defined in: packages/core/src/auth.ts:250
OAuthProtectedResourceMetadata
OAuthProtectedResourceMetadata =
z.infer<typeofOAuthProtectedResourceMetadataSchema>
Defined in: packages/core/src/auth.ts:282
OAuthTokenRevocationRequest
OAuthTokenRevocationRequest =
z.infer<typeofOAuthTokenRevocationRequestSchema>
Defined in: packages/core/src/auth.ts:281
OAuthTokens
OAuthTokens =
z.infer<typeofOAuthTokensSchema>
Defined in: packages/core/src/auth.ts:254
OpenIdProviderDiscoveryMetadata
OpenIdProviderDiscoveryMetadata =
z.infer<typeofOpenIdProviderDiscoveryMetadataSchema>
Defined in: packages/core/src/auth.ts:252
OpenIdProviderMetadata
OpenIdProviderMetadata =
z.infer<typeofOpenIdProviderMetadataSchema>
Defined in: packages/core/src/auth.ts:251
PaginatedRequest
PaginatedRequest =
Infer<typeofPaginatedRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:347
PaginatedRequestParams
PaginatedRequestParams =
Infer<typeofPaginatedRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:346
PaginatedResult
PaginatedResult =
StripWireOnly<Infer<typeofPaginatedResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:348
PingRequest
PingRequest =
Infer<typeofPingRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:296
PrimitiveSchemaDefinition
PrimitiveSchemaDefinition =
Infer<typeofPrimitiveSchemaDefinitionSchema>
Defined in: packages/core-internal/src/types/types.ts:529
Progress
Progress =
Infer<typeofProgressSchema>
Defined in: packages/core-internal/src/types/types.ts:299
ProgressCallback
ProgressCallback = (
progress) =>void
Defined in: packages/core-internal/src/shared/protocol.ts:59
Callback for progress notifications.
Parameters
progress
Returns
void
ProgressNotification
ProgressNotification =
Infer<typeofProgressNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:301
ProgressNotificationParams
ProgressNotificationParams =
Infer<typeofProgressNotificationParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:300
ProgressToken
ProgressToken =
Infer<typeofProgressTokenSchema>
Defined in: packages/core-internal/src/types/types.ts:219
Prompt
Prompt =
Infer<typeofPromptSchema>
Defined in: packages/core-internal/src/types/types.ts:384
PromptArgument
PromptArgument =
Infer<typeofPromptArgumentSchema>
Defined in: packages/core-internal/src/types/types.ts:383
PromptListChangedNotification
PromptListChangedNotification =
Infer<typeofPromptListChangedNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:409
PromptMessage
PromptMessage =
Infer<typeofPromptMessageSchema>
Defined in: packages/core-internal/src/types/types.ts:407
PromptReference
PromptReference =
Infer<typeofPromptReferenceSchema>
Defined in: packages/core-internal/src/types/types.ts:542
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?
optionaldebouncedNotificationMethods?: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?
optionalenforceStrictCapabilities?: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?
optionalsupportedProtocolVersions?: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
ReadResourceRequest
ReadResourceRequest =
Infer<typeofReadResourceRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:363
ReadResourceRequestParams
ReadResourceRequestParams =
Infer<typeofReadResourceRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:362
ReadResourceResult
ReadResourceResult =
StripWireOnly<Infer<typeofReadResourceResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:364
RelatedTaskMetadata
RelatedTaskMetadata =
Infer<typeofRelatedTaskMetadataSchema>
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.
Request
Request =
Infer<typeofRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:221
RequestId
RequestId =
Infer<typeofRequestIdSchema>
Defined in: packages/core-internal/src/types/types.ts:227
RequestMeta
RequestMeta =
Infer<typeofRequestMetaSchema>
Defined in: packages/core-internal/src/types/types.ts:224
RequestMetaEnvelope
RequestMetaEnvelope =
object
Defined in: packages/core-internal/src/types/types.ts:247
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:250
io.modelcontextprotocol/clientInfo
io.modelcontextprotocol/clientInfo:
Implementation
Defined in: packages/core-internal/src/types/types.ts:249
io.modelcontextprotocol/logLevel?
optionalio.modelcontextprotocol/logLevel?:LoggingLevel
Defined in: packages/core-internal/src/types/types.ts:251
io.modelcontextprotocol/protocolVersion
io.modelcontextprotocol/protocolVersion:
string
Defined in: packages/core-internal/src/types/types.ts:248
RequestMetaObject
RequestMetaObject =
RequestMeta
Defined in: packages/core-internal/src/types/types.ts:918
RequestMethod
RequestMethod =
Exclude<ClientRequest["method"] |ServerRequest["method"],TaskRequestMethod>
Defined in: packages/core-internal/src/types/types.ts:673
RequestOptions
RequestOptions =
object&TransportSendOptions
Defined in: packages/core-internal/src/shared/protocol.ts:100
Options that can be given per request.
Type Declaration
allowInputRequired?
optionalallowInputRequired?: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?
optionalmaxTotalTimeout?: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?
optionalonprogress?:ProgressCallback
If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked.
resetTimeoutOnProgress?
optionalresetTimeoutOnProgress?: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?
optionalsignal?:AbortSignal
Can be used to cancel an in-flight request. This will cause an AbortError to be raised from request().
timeout?
optionaltimeout?: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<typeofBaseRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:236
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:675
Resource
Resource =
Infer<typeofResourceSchema>
Defined in: packages/core-internal/src/types/types.ts:354
ResourceContents
ResourceContents =
Infer<typeofResourceContentsSchema>
Defined in: packages/core-internal/src/types/types.ts:351
ResourceLink
ResourceLink =
Infer<typeofResourceLinkSchema>
Defined in: packages/core-internal/src/types/types.ts:405
ResourceListChangedNotification
ResourceListChangedNotification =
Infer<typeofResourceListChangedNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:365
ResourceRequestParams
ResourceRequestParams =
Infer<typeofResourceRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:361
ResourceTemplateReference
ResourceTemplateReference =
Infer<typeofResourceTemplateReferenceSchema>
Defined in: packages/core-internal/src/types/types.ts:541
ResourceTemplateType
ResourceTemplateType =
Infer<typeofResourceTemplateSchema>
Defined in: packages/core-internal/src/types/types.ts:356
ResourceUpdatedNotification
ResourceUpdatedNotification =
Infer<typeofResourceUpdatedNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:371
ResourceUpdatedNotificationParams
ResourceUpdatedNotificationParams =
Infer<typeofResourceUpdatedNotificationParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:370
Result
Result =
StripWireOnly<Infer<typeofResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:226
ResultTypeMap
ResultTypeMap =
object
Defined in: packages/core-internal/src/types/types.ts:677
Properties
completion/complete
completion/complete:
CompleteResult
Defined in: packages/core-internal/src/types/types.ts:681
elicitation/create
elicitation/create:
ElicitResult
Defined in: packages/core-internal/src/types/types.ts:698
initialize
initialize:
InitializeResult
Defined in: packages/core-internal/src/types/types.ts:679
logging/setLevel
logging/setLevel:
EmptyResult
Defined in: packages/core-internal/src/types/types.ts:682
ping
ping:
EmptyResult
Defined in: packages/core-internal/src/types/types.ts:678
prompts/get
prompts/get:
GetPromptResult
Defined in: packages/core-internal/src/types/types.ts:683
prompts/list
prompts/list:
ListPromptsResult
Defined in: packages/core-internal/src/types/types.ts:684
resources/list
resources/list:
ListResourcesResult
Defined in: packages/core-internal/src/types/types.ts:685
resources/read
resources/read:
ReadResourceResult
Defined in: packages/core-internal/src/types/types.ts:687
resources/subscribe
resources/subscribe:
EmptyResult
Defined in: packages/core-internal/src/types/types.ts:688
resources/templates/list
resources/templates/list:
ListResourceTemplatesResult
Defined in: packages/core-internal/src/types/types.ts:686
resources/unsubscribe
resources/unsubscribe:
EmptyResult
Defined in: packages/core-internal/src/types/types.ts:689
roots/list
roots/list:
ListRootsResult
Defined in: packages/core-internal/src/types/types.ts:699
sampling/createMessage
sampling/createMessage:
CreateMessageResult|CreateMessageResultWithTools
Defined in: packages/core-internal/src/types/types.ts:697
server/discover
server/discover:
DiscoverResult
Defined in: packages/core-internal/src/types/types.ts:680
subscriptions/listen
subscriptions/listen:
SubscriptionsListenResult
Defined in: packages/core-internal/src/types/types.ts:694
tools/call
tools/call:
CallToolResult
Defined in: packages/core-internal/src/types/types.ts:695
tools/list
tools/list:
ListToolsResult
Defined in: packages/core-internal/src/types/types.ts:696
Role
Role =
Infer<typeofRoleSchema>
Defined in: packages/core-internal/src/types/types.ts:266
Root
Root =
Infer<typeofRootSchema>
Defined in: packages/core-internal/src/types/types.ts:553
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<typeofRootsListChangedNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:571
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<typeofSamplingContentSchema>
Defined in: packages/core-internal/src/types/types.ts:479
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<typeofSamplingMessageSchema>
Defined in: packages/core-internal/src/types/types.ts:491
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<typeofSamplingMessageContentBlockSchema>
Defined in: packages/core-internal/src/types/types.ts:485
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<typeofServerCapabilitiesSchema>
Defined in: packages/core-internal/src/types/types.ts:287
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?
optionalhttp?:object
http.closeSSE?
optionalcloseSSE?: () =>void
Closes the SSE stream for this request, triggering client reconnection. Only available when using a StreamableHTTPServerTransport with eventStore configured.
Returns
void
http.closeStandaloneSSE?
optionalcloseStandaloneSSE?: () =>void
Closes the standalone GET SSE stream, triggering client reconnection. Only available when using a StreamableHTTPServerTransport with eventStore configured.
Returns
void
http.req?
optionalreq?: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?
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
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?
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<typeofServerNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:657
ServerRequest
ServerRequest =
Infer<typeofServerRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:656
ServerResult
ServerResult =
StripWireOnly<Infer<typeofServerResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:658
SetLevelRequest
SetLevelRequest =
Infer<typeofSetLevelRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:441
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<typeofSetLevelRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:435
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<typeofSingleSelectEnumSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:527
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/src/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?
optionalissuer?:string
StoredOAuthTokens
StoredOAuthTokens =
OAuthTokens&object
Defined in: packages/core/src/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?
optionalissuer?:string
StringSchema
StringSchema =
Infer<typeofStringSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:519
SubscribeRequest
SubscribeRequest =
Infer<typeofSubscribeRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:367
SubscribeRequestParams
SubscribeRequestParams =
Infer<typeofSubscribeRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:366
SubscriptionFilter
SubscriptionFilter =
Infer<typeofSubscriptionFilterSchema>
Defined in: packages/core-internal/src/types/types.ts:374
SubscriptionsAcknowledgedNotification
SubscriptionsAcknowledgedNotification =
Infer<typeofSubscriptionsAcknowledgedNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:378
SubscriptionsAcknowledgedNotificationParams
SubscriptionsAcknowledgedNotificationParams =
Infer<typeofSubscriptionsAcknowledgedNotificationParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:377
SubscriptionsListenRequest
SubscriptionsListenRequest =
Infer<typeofSubscriptionsListenRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:376
SubscriptionsListenRequestParams
SubscriptionsListenRequestParams =
Infer<typeofSubscriptionsListenRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:375
SubscriptionsListenResult
SubscriptionsListenResult =
StripWireOnly<Infer<typeofSubscriptionsListenResultSchema>>
Defined in: packages/core-internal/src/types/types.ts:380
SubscriptionsListenResultMeta
SubscriptionsListenResultMeta =
Infer<typeofSubscriptionsListenResultMetaSchema>
Defined in: packages/core-internal/src/types/types.ts:379
Task
Task =
Infer<typeofTaskSchema>
Defined in: packages/core-internal/src/types/types.ts:313
Deprecated
2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.
TaskAugmentedRequestParams
TaskAugmentedRequestParams =
Infer<typeofTaskAugmentedRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:223
Deprecated
2025-11-25 wire vocabulary with no SDK runtime; kept importable for interoperability only.
TaskCreationParams
TaskCreationParams =
Infer<typeofTaskCreationParamsSchema>
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.
TaskMetadata
TaskMetadata =
Infer<typeofTaskMetadataSchema>
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.
TaskStatus
TaskStatus =
Infer<typeofTaskStatusSchema>
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.
TaskStatusNotification
TaskStatusNotification =
Infer<typeofTaskStatusNotificationSchema>
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.
TaskStatusNotificationParams
TaskStatusNotificationParams =
Infer<typeofTaskStatusNotificationParamsSchema>
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.
TextContent
TextContent =
Infer<typeofTextContentSchema>
Defined in: packages/core-internal/src/types/types.ts:389
TextResourceContents
TextResourceContents =
Infer<typeofTextResourceContentsSchema>
Defined in: packages/core-internal/src/types/types.ts:352
TitledMultiSelectEnumSchema
TitledMultiSelectEnumSchema =
Infer<typeofTitledMultiSelectEnumSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:526
TitledSingleSelectEnumSchema
TitledSingleSelectEnumSchema =
Infer<typeofTitledSingleSelectEnumSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:523
Tool
Tool =
Infer<typeofToolSchema>
Defined in: packages/core-internal/src/types/types.ts:414
ToolAnnotations
ToolAnnotations =
Infer<typeofToolAnnotationsSchema>
Defined in: packages/core-internal/src/types/types.ts:412
ToolChoice
ToolChoice =
Infer<typeofToolChoiceSchema>
Defined in: packages/core-internal/src/types/types.ts:461
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<typeofToolExecutionSchema>
Defined in: packages/core-internal/src/types/types.ts:413
ToolListChangedNotification
ToolListChangedNotification =
Infer<typeofToolListChangedNotificationSchema>
Defined in: packages/core-internal/src/types/types.ts:421
ToolResultContent
ToolResultContent =
Infer<typeofToolResultContentSchema>
Defined in: packages/core-internal/src/types/types.ts:403
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<typeofToolUseContentSchema>
Defined in: packages/core-internal/src/types/types.ts:397
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?
optionalheaders?: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?
optionalonRequestStreamEnd?: () =>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?
optionalonresumptiontoken?: (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?
optionalrelatedRequestId?: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?
optionalrequestSignal?: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?
optionalresumptionToken?: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<typeofUnsubscribeRequestSchema>
Defined in: packages/core-internal/src/types/types.ts:369
UnsubscribeRequestParams
UnsubscribeRequestParams =
Infer<typeofUnsubscribeRequestParamsSchema>
Defined in: packages/core-internal/src/types/types.ts:368
UntitledMultiSelectEnumSchema
UntitledMultiSelectEnumSchema =
Infer<typeofUntitledMultiSelectEnumSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:525
UntitledSingleSelectEnumSchema
UntitledSingleSelectEnumSchema =
Infer<typeofUntitledSingleSelectEnumSchemaSchema>
Defined in: packages/core-internal/src/types/types.ts:522
Variables
Variables =
Record<string,string|string[]>
Defined in: packages/core-internal/src/shared/uriTemplate.ts:3
Variables
BAGGAGE_META_KEY
constBAGGAGE_META_KEY:"baggage"='baggage'
Defined in: packages/core/src/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
constCLIENT_CAPABILITIES_META_KEY:"io.modelcontextprotocol/clientCapabilities"='io.modelcontextprotocol/clientCapabilities'
Defined in: packages/core/src/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
constCLIENT_INFO_META_KEY:"io.modelcontextprotocol/clientInfo"='io.modelcontextprotocol/clientInfo'
Defined in: packages/core/src/constants.ts:24
_meta key identifying the client software making a request.
DEFAULT_NEGOTIATED_PROTOCOL_VERSION
constDEFAULT_NEGOTIATED_PROTOCOL_VERSION:"2025-03-26"='2025-03-26'
Defined in: packages/core/src/constants.ts:2
DEFAULT_REQUEST_TIMEOUT_MSEC
constDEFAULT_REQUEST_TIMEOUT_MSEC:60000=60_000
Defined in: packages/core-internal/src/shared/protocol.ts:95
The default request timeout, in milliseconds.
inputRequired
constinputRequired:InputRequiredBuilder
Defined in: packages/core-internal/src/shared/inputRequired.ts:131
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
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
constINTERNAL_ERROR:-32603=-32_603
Defined in: packages/core/src/constants.ts:104
INVALID_PARAMS
constINVALID_PARAMS:-32602=-32_602
Defined in: packages/core/src/constants.ts:103
INVALID_REQUEST
constINVALID_REQUEST:-32600=-32_600
Defined in: packages/core/src/constants.ts:101
isSpecType
constisSpecType: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
if (isSpecType.ContentBlock(value)) {
// value is ContentBlock
}
const blocks = mixed.filter(isSpecType.ContentBlock);JSONRPC_VERSION
constJSONRPC_VERSION:"2.0"='2.0'
Defined in: packages/core/src/constants.ts:97
LATEST_PROTOCOL_VERSION
constLATEST_PROTOCOL_VERSION:"2025-11-25"='2025-11-25'
Defined in: packages/core/src/constants.ts:1
LOG_LEVEL_META_KEY
constLOG_LEVEL_META_KEY:"io.modelcontextprotocol/logLevel"='io.modelcontextprotocol/logLevel'
Defined in: packages/core/src/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
constMETHOD_NOT_FOUND:-32601=-32_601
Defined in: packages/core/src/constants.ts:102
PARSE_ERROR
constPARSE_ERROR:-32700=-32_700
Defined in: packages/core/src/constants.ts:100
PROTOCOL_VERSION_META_KEY
constPROTOCOL_VERSION_META_KEY:"io.modelcontextprotocol/protocolVersion"='io.modelcontextprotocol/protocolVersion'
Defined in: packages/core/src/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.
RELATED_TASK_META_KEY
constRELATED_TASK_META_KEY:"io.modelcontextprotocol/related-task"='io.modelcontextprotocol/related-task'
Defined in: packages/core/src/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
constspecTypeSchemas: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
const result = specTypeSchemas.CallToolResult['~standard'].validate(untrusted);
if (result.issues === undefined) {
// result.value is CallToolResult
}STDIO_DEFAULT_MAX_BUFFER_SIZE
constSTDIO_DEFAULT_MAX_BUFFER_SIZE:number
Defined in: packages/core-internal/src/shared/stdio.ts:4
SUBSCRIPTION_ID_META_KEY
constSUBSCRIPTION_ID_META_KEY:"io.modelcontextprotocol/subscriptionId"='io.modelcontextprotocol/subscriptionId'
Defined in: packages/core/src/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
constSUPPORTED_PROTOCOL_VERSIONS:string[]
Defined in: packages/core/src/constants.ts:3
TRACEPARENT_META_KEY
constTRACEPARENT_META_KEY:"traceparent"='traceparent'
Defined in: packages/core/src/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
constTRACESTATE_META_KEY:"tracestate"='tracestate'
Defined in: packages/core/src/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:162
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:179
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:128
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.
params._meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
params._meta.io.modelcontextprotocol/related-task.taskId
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:135
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.
params._meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
params._meta.io.modelcontextprotocol/related-task.taskId
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:840
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
Returns
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
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
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: title → annotations.title → name For other objects: title → name 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:224
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
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:125
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:123
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:105
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.
isJsonContentType()
isJsonContentType(
header):boolean
Defined in: packages/core-internal/src/shared/mediaType.ts:51
Whether a raw Content-Type header value denotes application/json. Parameters (for example charset=utf-8) are allowed and ignored; malformed parameter sections do not reject a header whose media type is unambiguously application/json (see mediaTypeEssence for the exact grammar).
Parameters
header
string | null | undefined
Returns
boolean
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:120
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.
mergeCapabilities()
Call Signature
mergeCapabilities(
base,additional):object
Defined in: packages/core-internal/src/shared/protocol.ts:1867
Parameters
base
completions?
{[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; } = ...
Present if the server supports sending completions to the client.
experimental?
{[key: string]: object; } = ...
Experimental, non-standard capabilities that the server supports.
extensions?
{[key: string]: object; } = ...
Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
logging?
{[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; } = ...
Present if the server supports sending log messages to the client.
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.
prompts?
{ listChanged?: boolean; } = ...
Present if the server offers any prompt templates.
prompts.listChanged?
boolean = ...
Whether this server supports issuing notifications for changes to the prompt list.
resources?
{ listChanged?: boolean; subscribe?: boolean; } = ...
Present if the server offers any resources to read.
resources.listChanged?
boolean = ...
Whether this server supports issuing notifications for changes to the resource list.
resources.subscribe?
boolean = ...
Whether this server supports clients subscribing to resource updates.
tasks?
{[key: string]: unknown; 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?: {[key: string]: unknown; tools?: {[key: string]: unknown; call?: {[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; }; }; }; } = ...
Present if the server supports task creation.
Deprecated
2025-11-25 wire vocabulary with no SDK runtime; parsed for interoperability only — servers built on this SDK never advertise it.
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; } = ...
Present if the server supports cancelling tasks.
tasks.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; } = ...
Present if the server supports listing tasks.
tasks.requests?
{[key: string]: unknown; tools?: {[key: string]: unknown; call?: {[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; }; }; } = ...
Capabilities for task creation on specific request types.
tasks.requests.tools?
{[key: string]: unknown; call?: {[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; }; } = ...
Task support for tool requests.
tasks.requests.tools.call?
{[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; } = ...
tools?
{ listChanged?: boolean; } = ...
Present if the server offers any tools to call.
tools.listChanged?
boolean = ...
Whether this server supports issuing notifications for changes to the tool list.
additional
Partial<ServerCapabilities>
Returns
completions?
optionalcompletions?:object
Present if the server supports sending completions to the client.
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?
optionalexperimental?:object
Experimental, non-standard capabilities that the server supports.
Index Signature
[key: string]: object
extensions?
optionalextensions?:object
Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name).
Index Signature
[key: string]: object
logging?
optionallogging?:object
Present if the server supports sending log messages to the client.
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
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.
prompts?
optionalprompts?:object
Present if the server offers any prompt templates.
prompts.listChanged?
optionallistChanged?:boolean
Whether this server supports issuing notifications for changes to the prompt list.
resources?
optionalresources?:object
Present if the server offers any resources to read.
resources.listChanged?
optionallistChanged?:boolean
Whether this server supports issuing notifications for changes to the resource list.
resources.subscribe?
optionalsubscribe?:boolean
Whether this server supports clients subscribing to resource updates.
tasks?
optionaltasks?:object
Present if the server 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?
optionalcancel?:object
Present if the server 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?
optionallist?:object
Present if the server 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?
optionalrequests?:object
Capabilities for task creation on specific request types.
Index Signature
[key: string]: unknown
tasks.requests.tools?
optionaltools?:object
Task support for tool requests.
Index Signature
[key: string]: unknown
tasks.requests.tools.call?
optionalcall?: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
tools?
optionaltools?:object
Present if the server offers any tools to call.
tools.listChanged?
optionallistChanged?:boolean
Whether this server supports issuing notifications for changes to the tool list.
Call Signature
mergeCapabilities(
base,additional):object
Defined in: packages/core-internal/src/shared/protocol.ts:1868
Parameters
base
elicitation?
{[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; form?: {[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; applyDefaults?: boolean; }; 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; }; } = ...
Present if the client supports eliciting user input.
elicitation.form?
{[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; applyDefaults?: boolean; } = ...
elicitation.form.applyDefaults?
boolean = ...
elicitation.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; } = ...
experimental?
{[key: string]: object; } = ...
Experimental, non-standard capabilities that the client supports.
extensions?
{[key: string]: object; } = ...
Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
roots?
{ listChanged?: boolean; } = ...
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?
boolean = ...
Whether the client supports issuing notifications for changes to the roots list.
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; }; } = ...
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?
{[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; } = ...
Present if the client supports context inclusion via includeContext parameter. If not declared, servers SHOULD only use includeContext: "none" (or omit it).
sampling.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; } = ...
Present if the client supports tool use via tools and toolChoice parameters.
tasks?
{[key: string]: unknown; 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?: {[key: string]: unknown; elicitation?: {[key: string]: unknown; create?: {[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; }; }; sampling?: {[key: string]: unknown; createMessage?: {[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; }; }; }; } = ...
Present if the client supports task creation.
Deprecated
2025-11-25 wire vocabulary with no SDK runtime; parsed for interoperability only — servers built on this SDK never advertise it.
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; } = ...
Present if the client supports cancelling tasks.
tasks.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; } = ...
Present if the client supports listing tasks.
tasks.requests?
{[key: string]: unknown; elicitation?: {[key: string]: unknown; create?: {[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; }; }; sampling?: {[key: string]: unknown; createMessage?: {[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; }; }; } = ...
Capabilities for task creation on specific request types.
tasks.requests.elicitation?
{[key: string]: unknown; create?: {[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; }; } = ...
Task support for elicitation requests.
tasks.requests.elicitation.create?
{[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?
{[key: string]: unknown; createMessage?: {[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; }; } = ...
Task support for sampling requests.
tasks.requests.sampling.createMessage?
{[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; } = ...
additional
Partial<ClientCapabilities>
Returns
elicitation?
optionalelicitation?: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?
optionalform?: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?
optionalapplyDefaults?:boolean
elicitation.url?
optionalurl?: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?
optionalexperimental?:object
Experimental, non-standard capabilities that the client supports.
Index Signature
[key: string]: object
extensions?
optionalextensions?:object
Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name).
Index Signature
[key: string]: object
roots?
optionalroots?: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?
optionallistChanged?:boolean
Whether the client supports issuing notifications for changes to the roots list.
sampling?
optionalsampling?: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?
optionalcontext?: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?
optionaltools?: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?
optionaltasks?: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?
optionalcancel?: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?
optionallist?: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?
optionalrequests?:object
Capabilities for task creation on specific request types.
Index Signature
[key: string]: unknown
tasks.requests.elicitation?
optionalelicitation?:object
Task support for elicitation requests.
Index Signature
[key: string]: unknown
tasks.requests.elicitation.create?
optionalcreate?: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?
optionalsampling?:object
Task support for sampling requests.
Index Signature
[key: string]: unknown
tasks.requests.sampling.createMessage?
optionalcreateMessage?: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
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
The validated JSONRPCMessage.
Throws
If validation fails.
preloadSchemas()
preloadSchemas():
void
Defined in: packages/core-internal/src/wire/preload.ts:47
Eagerly builds every lazily-constructed wire-schema layer, so that no later validation pays schema-construction cost.
Synchronous and idempotent: every layer is a memo, so the first call does all the work and subsequent calls return immediately. Reference identity is unaffected — this forces the same memos every lazy consumer pulls through.
Call it at module scope on platforms that bill per-request CPU but not module evaluation (isolate-based edge/serverless runtimes), where deferring construction would move it into the first request of every fresh isolate:
// from '@modelcontextprotocol/server' or '@modelcontextprotocol/client' —
// each package bundles its own schema copy, so warm the one(s) you import.
preloadSchemas(); // module scope — runs during isolate warm-upOn Node CLIs and other process-per-invocation runtimes, prefer the lazy default — there, module-scope construction is pure added boot latency.
Returns
void
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
Returns
string
References
AnyToolHandler
Re-exports AnyToolHandler
AuthMetadataOptions
Re-exports AuthMetadataOptions
BaseToolCallback
Re-exports BaseToolCallback
bearerAuthChallengeResponse
Re-exports bearerAuthChallengeResponse
BearerAuthOptions
Re-exports BearerAuthOptions
buildOAuthProtectedResourceMetadata
Re-exports buildOAuthProtectedResourceMetadata
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
getOAuthProtectedResourceMetadataUrl
Re-exports getOAuthProtectedResourceMetadataUrl
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
oauthMetadataResponse
Re-exports oauthMetadataResponse
OAuthTokenVerifier
Re-exports OAuthTokenVerifier
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
requireBearerAuth
Re-exports requireBearerAuth
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
verifyBearerToken
Re-exports verifyBearerToken
WebStandardStreamableHTTPServerTransport
Re-exports WebStandardStreamableHTTPServerTransport