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?
Returns
Protocol<SendRequestT, SendNotificationT, SendResultT>
Properties
fallbackNotificationHandler?
optionalfallbackNotificationHandler?: (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.
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,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.
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
RequestHandlerExtra<SendRequestT, SendNotificationT>
Returns
Promise<SendResultT>
onclose?
optionalonclose?: () =>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?
optionalonerror?: (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()
abstractprotectedassertCapabilityForMethod(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()
abstractprotectedassertNotificationCapability(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()
abstractprotectedassertRequestHandlerCapability(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()
abstractprotectedassertTaskCapability(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()
abstractprotectedassertTaskHandlerCapability(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()
protectedcancelTask(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?
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
Returns
Promise<void>
getTask()
protectedgetTask(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.
_meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
_meta.io.modelcontextprotocol/related-task.taskId
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?
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()
protectedgetTaskResult<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.
_meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
_meta.io.modelcontextprotocol/related-task.taskId
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?
Returns
Promise<SchemaOutput<T>>
listTasks()
protectedlistTasks(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?
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?
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?
Returns
Promise<SchemaOutput<T>>
requestStream()
protectedrequestStream<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?
Returns
AsyncGenerator<ResponseMessage<SchemaOutput<T>>, void, void>
Example
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
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.
_meta.io.modelcontextprotocol/related-task?
{ taskId: string; } = ...
If specified, this request is related to the provided task.
_meta.io.modelcontextprotocol/related-task.taskId
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?
optionalrelatedRequestId?: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?
optionalrelatedTask?: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
Returns
void
ProtocolOptions
ProtocolOptions =
object
Defined in: src/shared/protocol.ts:62
Additional initialization options.
Properties
debouncedNotificationMethods?
optionaldebouncedNotificationMethods?: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?
optionaldefaultTaskPollInterval?: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?
optionalenforceStrictCapabilities?: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?
optionalmaxTaskQueueSize?: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?
optionaltaskMessageQueue?: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?
optionaltaskStore?: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?
optionalauthInfo?:AuthInfo
Defined in: src/shared/protocol.ts:246
Information about a validated access token, provided to request handlers.
closeSSEStream?
optionalcloseSSEStream?: () =>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?
optionalcloseStandaloneSSEStream?: () =>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?
optionalrequestInfo?: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?
Returns
Promise<SchemaOutput<U>>
sessionId?
optionalsessionId?: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?
optionaltaskId?:string
Defined in: src/shared/protocol.ts:264
taskRequestedTtl?
optionaltaskRequestedTtl?:number
Defined in: src/shared/protocol.ts:268
taskStore?
optionaltaskStore?: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?
optionalmaxTotalTimeout?: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?
optionalonprogress?: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?
optionalrelatedTask?:RelatedTaskMetadata
If provided, associates this request with a related task.
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().
task?
optionaltask?:TaskCreationParams
If provided, augments the request with task creation parameters to enable call-now, fetch-later execution patterns.
timeout?
optionaltimeout?: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
constDEFAULT_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?
optionalcompletions?:object
Present if the server supports sending completions to the client.
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.
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
tasks.cancel?
optionalcancel?:object
Present if the server supports cancelling tasks.
tasks.list?
optionallist?:object
Present if the server supports listing tasks.
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
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: 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?
optionalelicitation?:object
Present if the client supports eliciting user input.
Index Signature
[key: string]: unknown
elicitation.form?
optionalform?:object
Index Signature
[key: string]: unknown
elicitation.form.applyDefaults?
optionalapplyDefaults?:boolean
elicitation.url?
optionalurl?:object
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.
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.
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).
sampling.tools?
optionaltools?:object
Present if the client supports tool use via tools and toolChoice parameters.
tasks?
optionaltasks?:object
Present if the client supports task creation.
Index Signature
[key: string]: unknown
tasks.cancel?
optionalcancel?:object
Present if the client supports cancelling tasks.
tasks.list?
optionallist?:object
Present if the client supports listing tasks.
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
tasks.requests.sampling?
optionalsampling?:object
Task support for sampling requests.
Index Signature
[key: string]: unknown
tasks.requests.sampling.createMessage?
optionalcreateMessage?:object