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

MCP TypeScript SDK / shared/protocol

shared/protocol

Classes

abstract Protocol

Defined in: src/shared/protocol.ts:320

Implements MCP protocol framing on top of a pluggable transport, including features like request/response linking, notifications, and progress.

Extended by

Type Parameters

SendRequestT

SendRequestT extends Request

SendNotificationT

SendNotificationT extends Notification

SendResultT

SendResultT extends Result

Constructors

Constructor

new Protocol<SendRequestT, SendNotificationT, SendResultT>(_options?): Protocol<SendRequestT, SendNotificationT, SendResultT>

Defined in: src/shared/protocol.ts:366

Parameters
_options?

ProtocolOptions

Returns

Protocol<SendRequestT, SendNotificationT, SendResultT>

Properties

fallbackNotificationHandler?

optional fallbackNotificationHandler?: (notification) => Promise<void>

Defined in: src/shared/protocol.ts:364

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.

{ taskId: string; } = ...

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

string = ...

params._meta.progressToken?

string | number = ...

If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.

Returns

Promise<void>

fallbackRequestHandler?

optional fallbackRequestHandler?: (request, extra) => Promise<SendResultT>

Defined in: src/shared/protocol.ts:359

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.

{ taskId: string; } = ...

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

string = ...

params._meta.progressToken?

string | number = ...

If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.

extra

RequestHandlerExtra<SendRequestT, SendNotificationT>

Returns

Promise<SendResultT>

onclose?

optional onclose?: () => void

Defined in: src/shared/protocol.ts:347

Callback for when the connection is closed for any reason.

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

Returns

void

onerror?

optional onerror?: (error) => void

Defined in: src/shared/protocol.ts:354

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: src/shared/protocol.ts:935

Returns

Transport | undefined

Methods

assertCanSetRequestHandler()

assertCanSetRequestHandler(method): void

Defined in: src/shared/protocol.ts:1444

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

abstract protected assertCapabilityForMethod(method): void

Defined in: src/shared/protocol.ts:951

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

SendRequestT["method"]

Returns

void

assertNotificationCapability()

abstract protected assertNotificationCapability(method): void

Defined in: src/shared/protocol.ts:958

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

SendNotificationT["method"]

Returns

void

assertRequestHandlerCapability()

abstract protected assertRequestHandlerCapability(method): void

Defined in: src/shared/protocol.ts:965

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

assertTaskCapability()

abstract protected assertTaskCapability(method): void

Defined in: src/shared/protocol.ts:972

A method to check if task creation is supported for the given request method.

This should be implemented by subclasses.

Parameters
method

string

Returns

void

assertTaskHandlerCapability()

abstract protected assertTaskHandlerCapability(method): void

Defined in: src/shared/protocol.ts:979

A method to check if task 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

cancelTask()

protected cancelTask(params, options?): Promise<{ _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; createdAt: string; lastUpdatedAt: string; pollInterval?: number; status: "working" | "input_required" | "completed" | "failed" | "cancelled"; statusMessage?: string; taskId: string; ttl: number | null; }>

Defined in: src/shared/protocol.ts:1295

Experimental

Cancels a specific task.

Use client.experimental.tasks.cancelTask() to access this method.

Parameters
params
taskId

string

options?

RequestOptions

Returns

Promise<{ _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; createdAt: string; lastUpdatedAt: string; pollInterval?: number; status: "working" | "input_required" | "completed" | "failed" | "cancelled"; statusMessage?: string; taskId: string; ttl: number | null; }>

close()

close(): Promise<void>

Defined in: src/shared/protocol.ts:942

Closes the connection.

Returns

Promise<void>

connect()

connect(transport): Promise<void>

Defined in: src/shared/protocol.ts:607

Attaches to the given transport, starts it, and starts listening for messages.

The Protocol object 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

Transport

Returns

Promise<void>

getTask()

protected getTask(params, options?): Promise<{ _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; createdAt: string; lastUpdatedAt: string; pollInterval?: number; status: "working" | "input_required" | "completed" | "failed" | "cancelled"; statusMessage?: string; taskId: string; ttl: number | null; }>

Defined in: src/shared/protocol.ts:1261

Experimental

Gets the current status of a task.

Use client.experimental.tasks.getTask() to access this method.

Parameters
params
_meta?

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

See General fields: _meta for notes on _meta usage.

{ taskId: string; } = ...

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

string = ...

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

taskId

string = ...

options?

RequestOptions

Returns

Promise<{ _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; createdAt: string; lastUpdatedAt: string; pollInterval?: number; status: "working" | "input_required" | "completed" | "failed" | "cancelled"; statusMessage?: string; taskId: string; ttl: number | null; }>

getTaskResult()

protected getTaskResult<T>(params, resultSchema, options?): Promise<SchemaOutput<T>>

Defined in: src/shared/protocol.ts:1271

Experimental

Retrieves the result of a completed task.

Use client.experimental.tasks.getTaskResult() to access this method.

Type Parameters
T

T extends AnySchema

Parameters
params
_meta?

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

See General fields: _meta for notes on _meta usage.

{ taskId: string; } = ...

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

string = ...

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

taskId

string = ...

resultSchema

T

options?

RequestOptions

Returns

Promise<SchemaOutput<T>>

listTasks()

protected listTasks(params?, options?): Promise<{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; nextCursor?: string; tasks: object[]; }>

Defined in: src/shared/protocol.ts:1285

Experimental

Lists tasks, optionally starting from a pagination cursor.

Use client.experimental.tasks.listTasks() to access this method.

Parameters
params?
cursor?

string

options?

RequestOptions

Returns

Promise<{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; nextCursor?: string; tasks: object[]; }>

notification()

notification(notification, options?): Promise<void>

Defined in: src/shared/protocol.ts:1303

Emits a notification, which is a one-way message that does not expect a response.

Parameters
notification

SendNotificationT

options?

NotificationOptions

Returns

Promise<void>

removeNotificationHandler()

removeNotificationHandler(method): void

Defined in: src/shared/protocol.ts:1469

Removes the notification handler for the given method.

Parameters
method

string

Returns

void

removeRequestHandler()

removeRequestHandler(method): void

Defined in: src/shared/protocol.ts:1437

Removes the request handler for the given method.

Parameters
method

string

Returns

void

request()

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

Defined in: src/shared/protocol.ts:1098

Sends a request and waits for a response.

Do not use this method to emit notifications! Use notification() instead.

Type Parameters
T

T extends AnySchema

Parameters
request

SendRequestT

resultSchema

T

options?

RequestOptions

Returns

Promise<SchemaOutput<T>>

requestStream()

protected requestStream<T>(request, resultSchema, options?): AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>

Defined in: src/shared/protocol.ts:1008

Experimental

Sends a request and returns an AsyncGenerator that yields response messages. The generator is guaranteed to end with either a 'result' or 'error' message.

Type Parameters
T

T extends AnySchema

Parameters
request

SendRequestT

resultSchema

T

options?

RequestOptions

Returns

AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>

Example
typescript
const stream = protocol.requestStream(request, resultSchema, options);
for await (const message of stream) {
  switch (message.type) {
    case 'taskCreated':
      console.log('Task created:', message.task.taskId);
      break;
    case 'taskStatus':
      console.log('Task status:', message.task.status);
      break;
    case 'result':
      console.log('Final result:', message.result);
      break;
    case 'error':
      console.error('Error:', message.error);
      break;
  }
}

Use client.experimental.tasks.requestStream() to access this method.

setNotificationHandler()

setNotificationHandler<T>(notificationSchema, handler): void

Defined in: src/shared/protocol.ts:1455

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.

Type Parameters
T

T extends AnyObjectSchema

Parameters
notificationSchema

T

handler

(notification) => void | Promise<void>

Returns

void

setRequestHandler()

setRequestHandler<T>(requestSchema, handler): void

Defined in: src/shared/protocol.ts:1418

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.

Type Parameters
T

T extends AnyObjectSchema

Parameters
requestSchema

T

handler

(request, extra) => SendResultT | Promise<SendResultT>

Returns

void

Interfaces

RequestTaskStore

Defined in: src/shared/protocol.ts:180

Request-scoped TaskStore interface.

Methods

createTask()

createTask(taskParams): Promise<{ createdAt: string; lastUpdatedAt: string; pollInterval?: number; status: "working" | "input_required" | "completed" | "failed" | "cancelled"; statusMessage?: string; taskId: string; ttl: number | null; }>

Defined in: src/shared/protocol.ts:188

Creates a new task with the given creation parameters. The implementation generates a unique taskId and createdAt timestamp.

Parameters
taskParams

CreateTaskOptions

The task creation parameters from the request

Returns

Promise<{ createdAt: string; lastUpdatedAt: string; pollInterval?: number; status: "working" | "input_required" | "completed" | "failed" | "cancelled"; statusMessage?: string; taskId: string; ttl: number | null; }>

The created task object

getTask()

getTask(taskId): Promise<{ createdAt: string; lastUpdatedAt: string; pollInterval?: number; status: "working" | "input_required" | "completed" | "failed" | "cancelled"; statusMessage?: string; taskId: string; ttl: number | null; }>

Defined in: src/shared/protocol.ts:197

Gets the current status of a task.

Parameters
taskId

string

The task identifier

Returns

Promise<{ createdAt: string; lastUpdatedAt: string; pollInterval?: number; status: "working" | "input_required" | "completed" | "failed" | "cancelled"; statusMessage?: string; taskId: string; ttl: number | null; }>

The task object

Throws

If the task does not exist

getTaskResult()

getTaskResult(taskId): Promise<{[key: string]: unknown; _meta?: {[key: string]: unknown; io.modelcontextprotocol/related-task?: { taskId: string; }; progressToken?: string | number; }; }>

Defined in: src/shared/protocol.ts:214

Retrieves the stored result of a task.

Parameters
taskId

string

The task identifier

Returns

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

The stored result

listTasks()

listTasks(cursor?): Promise<{ nextCursor?: string; tasks: object[]; }>

Defined in: src/shared/protocol.ts:231

Lists tasks, optionally starting from a pagination cursor.

Parameters
cursor?

string

Optional cursor for pagination

Returns

Promise<{ nextCursor?: string; tasks: object[]; }>

An object containing the tasks array and an optional nextCursor

storeTaskResult()

storeTaskResult(taskId, status, result): Promise<void>

Defined in: src/shared/protocol.ts:206

Stores the result of a task and sets its final status.

Parameters
taskId

string

The task identifier

status

"completed" | "failed"

The final status: 'completed' for success, 'failed' for errors

result

The result to store

_meta?

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

See MCP specification for notes on _meta usage.

{ taskId: string; } = ...

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

string = ...

_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>

updateTaskStatus()

updateTaskStatus(taskId, status, statusMessage?): Promise<void>

Defined in: src/shared/protocol.ts:223

Updates a task's status (e.g., to 'cancelled', 'failed', 'completed').

Parameters
taskId

string

The task identifier

status

"working" | "input_required" | "completed" | "failed" | "cancelled"

The new status

statusMessage?

string

Optional diagnostic message for failed tasks or other status information

Returns

Promise<void>

Type Aliases

NotificationOptions

NotificationOptions = object

Defined in: src/shared/protocol.ts:159

Options that can be given per notification.

Properties

relatedRequestId?

optional relatedRequestId?: RequestId

Defined in: src/shared/protocol.ts:163

May be used to indicate to the transport which incoming request to associate this outgoing notification with.

relatedTask?

optional relatedTask?: RelatedTaskMetadata

Defined in: src/shared/protocol.ts:168

If provided, associates this notification with a related task.


ProgressCallback

ProgressCallback = (progress) => void

Defined in: src/shared/protocol.ts:57

Callback for progress notifications.

Parameters

progress

Progress

Returns

void


ProtocolOptions

ProtocolOptions = object

Defined in: src/shared/protocol.ts:62

Additional initialization options.

Properties

debouncedNotificationMethods?

optional debouncedNotificationMethods?: string[]

Defined in: src/shared/protocol.ts:77

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']

defaultTaskPollInterval?

optional defaultTaskPollInterval?: number

Defined in: src/shared/protocol.ts:92

Default polling interval (in milliseconds) for task status checks when no pollInterval is provided by the server. Defaults to 5000ms if not specified.

enforceStrictCapabilities?

optional enforceStrictCapabilities?: boolean

Defined in: src/shared/protocol.ts:70

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.

maxTaskQueueSize?

optional maxTaskQueueSize?: number

Defined in: src/shared/protocol.ts:100

Maximum number of messages that can be queued per task for side-channel delivery. If undefined, the queue size is unbounded. When the limit is exceeded, the TaskMessageQueue implementation's enqueue() method will throw an error. It's the implementation's responsibility to handle overflow appropriately (e.g., by failing the task, dropping messages, etc.).

taskMessageQueue?

optional taskMessageQueue?: TaskMessageQueue

Defined in: src/shared/protocol.ts:87

Optional task message queue implementation for managing server-initiated messages that will be delivered through the tasks/result response stream.

taskStore?

optional taskStore?: TaskStore

Defined in: src/shared/protocol.ts:82

Optional task storage implementation. If provided, enables task-related request handlers and provides task storage capabilities to request handlers.


RequestHandlerExtra

RequestHandlerExtra<SendRequestT, SendNotificationT> = object

Defined in: src/shared/protocol.ts:237

Extra data given to request handlers.

Extended by

Type Parameters

SendRequestT

SendRequestT extends Request

SendNotificationT

SendNotificationT extends Notification

Properties

_meta?

optional _meta?: RequestMeta

Defined in: src/shared/protocol.ts:256

Metadata from the original request.

authInfo?

optional authInfo?: AuthInfo

Defined in: src/shared/protocol.ts:246

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

closeSSEStream?

optional closeSSEStream?: () => void

Defined in: src/shared/protocol.ts:294

Closes the SSE stream for this request, triggering client reconnection. Only available when using StreamableHTTPServerTransport with eventStore configured. Use this to implement polling behavior during long-running operations.

Returns

void

closeStandaloneSSEStream?

optional closeStandaloneSSEStream?: () => void

Defined in: src/shared/protocol.ts:301

Closes the standalone GET SSE stream, triggering client reconnection. Only available when using StreamableHTTPServerTransport with eventStore configured. Use this to implement polling behavior for server-initiated notifications.

Returns

void

requestId

requestId: RequestId

Defined in: src/shared/protocol.ts:262

The JSON-RPC ID of the request being handled. This can be useful for tracking or logging purposes.

requestInfo?

optional requestInfo?: RequestInfo

Defined in: src/shared/protocol.ts:273

The original HTTP request.

sendNotification

sendNotification: (notification) => Promise<void>

Defined in: src/shared/protocol.ts:280

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

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

Parameters
notification

SendNotificationT

Returns

Promise<void>

sendRequest

sendRequest: <U>(request, resultSchema, options?) => Promise<SchemaOutput<U>>

Defined in: src/shared/protocol.ts:287

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

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

Type Parameters
U

U extends AnySchema

Parameters
request

SendRequestT

resultSchema

U

options?

TaskRequestOptions

Returns

Promise<SchemaOutput<U>>

sessionId?

optional sessionId?: string

Defined in: src/shared/protocol.ts:251

The session ID from the transport, if available.

signal

signal: AbortSignal

Defined in: src/shared/protocol.ts:241

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

taskId?

optional taskId?: string

Defined in: src/shared/protocol.ts:264

taskRequestedTtl?

optional taskRequestedTtl?: number

Defined in: src/shared/protocol.ts:268

taskStore?

optional taskStore?: RequestTaskStore

Defined in: src/shared/protocol.ts:266


RequestOptions

RequestOptions = object & TransportSendOptions

Defined in: src/shared/protocol.ts:111

Options that can be given per request.

Type Declaration

maxTotalTimeout?

optional maxTotalTimeout?: number

Maximum total time (in milliseconds) to wait for a response. If exceeded, an McpError with code RequestTimeout will be raised, regardless of progress notifications. If not specified, there is no maximum total timeout.

onprogress?

optional onprogress?: ProgressCallback

If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked.

For task-augmented requests: progress notifications continue after CreateTaskResult is returned and stop automatically when the task reaches a terminal status.

relatedTask?

optional relatedTask?: RelatedTaskMetadata

If provided, associates this request with a related task.

resetTimeoutOnProgress?

optional resetTimeoutOnProgress?: boolean

If true, receiving a progress notification will reset the request timeout. This is useful for long-running operations that send periodic progress updates. Default: false

signal?

optional signal?: AbortSignal

Can be used to cancel an in-flight request. This will cause an AbortError to be raised from request().

task?

optional task?: TaskCreationParams

If provided, augments the request with task creation parameters to enable call-now, fetch-later execution patterns.

timeout?

optional timeout?: number

A timeout (in milliseconds) for this request. If exceeded, an McpError with code RequestTimeout will be raised from request().

If not specified, DEFAULT_REQUEST_TIMEOUT_MSEC will be used as the timeout.


TaskRequestOptions

TaskRequestOptions = Omit<RequestOptions, "relatedTask">

Defined in: src/shared/protocol.ts:175

Options that can be given per request.

Variables

DEFAULT_REQUEST_TIMEOUT_MSEC

const DEFAULT_REQUEST_TIMEOUT_MSEC: 60000 = 60000

Defined in: src/shared/protocol.ts:106

The default request timeout, in miliseconds.

Functions

mergeCapabilities()

Call Signature

mergeCapabilities(base, additional): object

Defined in: src/shared/protocol.ts:1666

Parameters
base
completions?

object = ...

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?

object = ...

Present if the server supports sending log messages to the client.

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?: object; list?: object; requests?: {[key: string]: unknown; tools?: {[key: string]: unknown; call?: object; }; }; } = ...

Present if the server supports task creation.

tasks.cancel?

object = ...

Present if the server supports cancelling tasks.

tasks.list?

object = ...

Present if the server supports listing tasks.

tasks.requests?

{[key: string]: unknown; tools?: {[key: string]: unknown; call?: object; }; } = ...

Capabilities for task creation on specific request types.

tasks.requests.tools?

{[key: string]: unknown; call?: object; } = ...

Task support for tool requests.

tasks.requests.tools.call?

object = ...

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?

optional completions?: object

Present if the server supports sending completions to the client.

experimental?

optional experimental?: object

Experimental, non-standard capabilities that the server supports.

Index Signature

[key: string]: object

extensions?

optional extensions?: object

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

Index Signature

[key: string]: object

logging?

optional logging?: object

Present if the server supports sending log messages to the client.

prompts?

optional prompts?: object

Present if the server offers any prompt templates.

prompts.listChanged?

optional listChanged?: boolean

Whether this server supports issuing notifications for changes to the prompt list.

resources?

optional resources?: object

Present if the server offers any resources to read.

resources.listChanged?

optional listChanged?: boolean

Whether this server supports issuing notifications for changes to the resource list.

resources.subscribe?

optional subscribe?: boolean

Whether this server supports clients subscribing to resource updates.

tasks?

optional tasks?: object

Present if the server supports task creation.

Index Signature

[key: string]: unknown

tasks.cancel?

optional cancel?: object

Present if the server supports cancelling tasks.

tasks.list?

optional list?: object

Present if the server supports listing tasks.

tasks.requests?

optional requests?: object

Capabilities for task creation on specific request types.

Index Signature

[key: string]: unknown

tasks.requests.tools?

optional tools?: object

Task support for tool requests.

Index Signature

[key: string]: unknown

tasks.requests.tools.call?

optional call?: object

tools?

optional tools?: object

Present if the server offers any tools to call.

tools.listChanged?

optional listChanged?: boolean

Whether this server supports issuing notifications for changes to the tool list.

Call Signature

mergeCapabilities(base, additional): object

Defined in: src/shared/protocol.ts:1667

Parameters
base
elicitation?

{[key: string]: unknown; form?: {[key: string]: unknown; applyDefaults?: boolean; }; url?: object; } = ...

Present if the client supports eliciting user input.

elicitation.form?

{[key: string]: unknown; applyDefaults?: boolean; } = ...

elicitation.form.applyDefaults?

boolean = ...

elicitation.url?

object = ...

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.

roots.listChanged?

boolean = ...

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

sampling?

{ context?: object; tools?: object; } = ...

Present if the client supports sampling from an LLM.

sampling.context?

object = ...

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

sampling.tools?

object = ...

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

tasks?

{[key: string]: unknown; cancel?: object; list?: object; requests?: {[key: string]: unknown; elicitation?: {[key: string]: unknown; create?: object; }; sampling?: {[key: string]: unknown; createMessage?: object; }; }; } = ...

Present if the client supports task creation.

tasks.cancel?

object = ...

Present if the client supports cancelling tasks.

tasks.list?

object = ...

Present if the client supports listing tasks.

tasks.requests?

{[key: string]: unknown; elicitation?: {[key: string]: unknown; create?: object; }; sampling?: {[key: string]: unknown; createMessage?: object; }; } = ...

Capabilities for task creation on specific request types.

tasks.requests.elicitation?

{[key: string]: unknown; create?: object; } = ...

Task support for elicitation requests.

tasks.requests.elicitation.create?

object = ...

tasks.requests.sampling?

{[key: string]: unknown; createMessage?: object; } = ...

Task support for sampling requests.

tasks.requests.sampling.createMessage?

object = ...

additional

Partial<ClientCapabilities>

Returns
elicitation?

optional elicitation?: object

Present if the client supports eliciting user input.

Index Signature

[key: string]: unknown

elicitation.form?

optional form?: object

Index Signature

[key: string]: unknown

elicitation.form.applyDefaults?

optional applyDefaults?: boolean

elicitation.url?

optional url?: object

experimental?

optional experimental?: object

Experimental, non-standard capabilities that the client supports.

Index Signature

[key: string]: object

extensions?

optional extensions?: object

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

Index Signature

[key: string]: object

roots?

optional roots?: object

Present if the client supports listing roots.

roots.listChanged?

optional listChanged?: boolean

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

sampling?

optional sampling?: object

Present if the client supports sampling from an LLM.

sampling.context?

optional context?: object

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

sampling.tools?

optional tools?: object

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

tasks?

optional tasks?: object

Present if the client supports task creation.

Index Signature

[key: string]: unknown

tasks.cancel?

optional cancel?: object

Present if the client supports cancelling tasks.

tasks.list?

optional list?: object

Present if the client supports listing tasks.

tasks.requests?

optional requests?: object

Capabilities for task creation on specific request types.

Index Signature

[key: string]: unknown

tasks.requests.elicitation?

optional elicitation?: object

Task support for elicitation requests.

Index Signature

[key: string]: unknown

tasks.requests.elicitation.create?

optional create?: object

tasks.requests.sampling?

optional sampling?: object

Task support for sampling requests.

Index Signature

[key: string]: unknown

tasks.requests.sampling.createMessage?

optional createMessage?: object