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

MCP TypeScript SDK (V2) / @modelcontextprotocol/client / client/versionNegotiation

client/versionNegotiation ​

Interfaces ​

NegotiationDeps ​

Defined in: packages/client/src/client/versionNegotiation.ts:437

Properties ​

capabilities ​

capabilities: object

Defined in: packages/client/src/client/versionNegotiation.ts:440

elicitation? ​

optional elicitation?: object

Present if the client supports eliciting user input.

Index Signature ​

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

elicitation.form? ​

optional form?: object

Index Signature ​

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

elicitation.form.applyDefaults? ​

optional applyDefaults?: boolean

elicitation.url? ​

optional url?: object

Index Signature ​

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

experimental? ​

optional experimental?: object

Experimental, non-standard capabilities that the client supports.

Index Signature ​

[key: string]: object

extensions? ​

optional extensions?: object

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

Index Signature ​

[key: string]: object

roots? ​

optional roots?: object

Present if the client supports listing roots.

Deprecated ​

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

roots.listChanged? ​

optional listChanged?: boolean

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

sampling? ​

optional sampling?: object

Present if the client supports sampling from an LLM.

Deprecated ​

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

sampling.context? ​

optional context?: object

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

Index Signature ​

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

sampling.tools? ​

optional tools?: object

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

Index Signature ​

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

tasks? ​

optional tasks?: object

Present if the client supports task creation.

Index Signature ​

[key: string]: unknown

Deprecated ​

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

tasks.cancel? ​

optional cancel?: object

Present if the client supports cancelling tasks.

Index Signature ​

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

tasks.list? ​

optional list?: object

Present if the client supports listing tasks.

Index Signature ​

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

tasks.requests? ​

optional requests?: object

Capabilities for task creation on specific request types.

Index Signature ​

[key: string]: unknown

tasks.requests.elicitation? ​

optional elicitation?: object

Task support for elicitation requests.

Index Signature ​

[key: string]: unknown

tasks.requests.elicitation.create? ​

optional create?: object

Index Signature ​

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

tasks.requests.sampling? ​

optional sampling?: object

Task support for sampling requests.

Index Signature ​

[key: string]: unknown

tasks.requests.sampling.createMessage? ​

optional createMessage?: object

Index Signature ​

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

clientInfo ​

clientInfo: object

Defined in: packages/client/src/client/versionNegotiation.ts:439

description? ​

optional description?: string

An optional human-readable description of what this implementation does.

This can be used by clients or servers to provide context about their purpose and capabilities. For example, a server might describe the types of resources or tools it provides, while a client might describe its intended use case.

icons? ​

optional icons?: object[]

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

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

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

Clients that support rendering icons SHOULD also support:

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

name: string

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

title? ​

optional title?: string

Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.

If not provided, the name should be used for display (except for Tool, where annotations.title should be given precedence over using name, if present).

version ​

version: string

websiteUrl? ​

optional websiteUrl?: string

An optional URL of the website for this implementation.

defaultTimeoutMs ​

defaultTimeoutMs: number

Defined in: packages/client/src/client/versionNegotiation.ts:445

The standard request timeout for this connect (probe inherits it unless probe.timeoutMs overrides).

disposableProbe? ​

optional disposableProbe?: boolean

Defined in: packages/client/src/client/versionNegotiation.ts:453

The probe transport is a disposable sibling (see negotiateStdioViaSibling): a mid-probe close is ordinary legacy evidence — the probe child spent itself — never a connect-fatal condition. Absent for in-place probes, where a closed connection has no fallback stream and stays a typed error.

environment ​

environment: ProbeEnvironment

Defined in: packages/client/src/client/versionNegotiation.ts:441

transport ​

transport: Transport

Defined in: packages/client/src/client/versionNegotiation.ts:438

transportKind ​

transportKind: ProbeTransportKind

Defined in: packages/client/src/client/versionNegotiation.ts:443

The transport class, for the transport-aware timeout and closed verdicts (see ProbeTransportKind).


VersionNegotiationOptions ​

Defined in: packages/client/src/client/versionNegotiation.ts:96

Opt-in protocol version negotiation, configured on ClientOptions.versionNegotiation.

Properties ​

mode? ​

optional mode?: VersionNegotiationMode

Defined in: packages/client/src/client/versionNegotiation.ts:100

Default ​
ts
'legacy'
probe? ​

optional probe?: VersionNegotiationProbeOptions

Defined in: packages/client/src/client/versionNegotiation.ts:105

Probe timeout/retry policy (only consulted by the probing modes).


VersionNegotiationProbeOptions ​

Defined in: packages/client/src/client/versionNegotiation.ts:39

Probe policy for 'auto' and pinned negotiation modes.

There is no special probe timeout opinion: the probe inherits the client's STANDARD request timeout unless timeoutMs overrides it.

Properties ​

maxRetries? ​

optional maxRetries?: number

Defined in: packages/client/src/client/versionNegotiation.ts:64

Number of times to re-send the probe after a timeout before reaching the timeout verdict. Governs timeout re-sends only — the spec-mandated -32022 corrective continuation (select-and-continue with a mutual version) is a separate negotiation step and is never counted against maxRetries.

Default ​
ts
0 (no retries)
timeoutMs? ​

optional timeoutMs?: number

Defined in: packages/client/src/client/versionNegotiation.ts:53

Timeout for the probe exchange, in milliseconds.

The timeout verdict is transport-aware: on stdio, a probe that gets no response within the timeout indicates a legacy server and falls back to the initialize handshake (measured on the disposable sibling for the SDK's own stdio transport, with the fallback running on the session child's fresh pipe; in place for custom stdio-shaped transports); on HTTP, where a deployed server answers and silence means an outage, connect() rejects with the standard typed timeout error instead.

Default ​

the standard request timeout (DEFAULT_REQUEST_TIMEOUT_MSEC, or the timeout passed to connect())

Type Aliases ​

NegotiationResult ​

NegotiationResult = { discover: DiscoverResult; era: "modern"; version: string; } | { era: "legacy"; }

Defined in: packages/client/src/client/versionNegotiation.ts:456


ResolvedVersionNegotiation ​

ResolvedVersionNegotiation = { kind: "legacy"; } | { fallbackAvailable: boolean; kind: "auto"; modernVersions: string[]; probe: VersionNegotiationProbeOptions; } | { kind: "pin"; probe: VersionNegotiationProbeOptions; version: string; }

Defined in: packages/client/src/client/versionNegotiation.ts:115

A fully resolved negotiation plan for one connect() call.

Union Members ​

Type Literal ​

{ kind: "legacy"; }


Type Literal ​

{ fallbackAvailable: boolean; kind: "auto"; modernVersions: string[]; probe: VersionNegotiationProbeOptions; }

fallbackAvailable ​

fallbackAvailable: boolean

Whether this client can fall back to the legacy initialize handshake.

kind ​

kind: "auto"

modernVersions ​

modernVersions: string[]

Modern versions this client offers, in preference order (never empty).

probe ​

probe: VersionNegotiationProbeOptions


Type Literal ​

{ kind: "pin"; probe: VersionNegotiationProbeOptions; version: string; }


VersionNegotiationMode ​

VersionNegotiationMode = "legacy" | "auto" | { pin: string; }

Defined in: packages/client/src/client/versionNegotiation.ts:90

Negotiation mode:

  • 'legacy' — no negotiation: the plain 2025 connect sequence, byte-identical to a client without this option.
  • 'auto' — probe with server/discover at connect; conservative fallback to the plain legacy initialize handshake unless the outcome is definitive modern evidence. Network outage rejects with a typed connect error; a probe timeout falls back to initialize on stdio (a silent server on a local pipe is a legacy server) and rejects with a typed timeout error on HTTP (silence there is an outage). On the SDK's stdio transport (the base StdioClientTransport exactly; subclasses probe in place) the probe runs on a short-lived sibling process spawned from the same parameters (its stderr is discarded) and the caller's transport starts once, after the era is known — so a child that exits on the unrecognized probe, the shape of servers built on SDKs that terminate on any pre-initialize request, is simply a legacy server. A mid-probe connection close on HTTP (or on a custom stdio-shaped transport, which probes in place) rejects with the typed connect error.
  • { pin: '<version>' } — modern era at exactly the pinned revision: the connect-time server/discover must offer it. No fallback — anything else fails loudly with a typed error.

Functions ​

buildProbeRequest() ​

buildProbeRequest(id, protocolVersion, clientInfo, capabilities): object

Defined in: packages/client/src/client/versionNegotiation.ts:356

Build the probe request: server/discover carrying the full per-request _meta envelope.

Parameters ​

id ​

string

protocolVersion ​

string

clientInfo ​
description? ​

string = ...

An optional human-readable description of what this implementation does.

This can be used by clients or servers to provide context about their purpose and capabilities. For example, a server might describe the types of resources or tools it provides, while a client might describe its intended use case.

icons? ​

object[] = ...

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

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

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

Clients that support rendering icons SHOULD also support:

  • image/svg+xml - SVG images (scalable but requires security precautions)
  • image/webp - WebP images (modern, efficient format)
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).

version ​

string = ...

websiteUrl? ​

string = ...

An optional URL of the website for this implementation.

capabilities ​
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; } = ...

Returns ​

object

id ​

id: string | number = RequestIdSchema

jsonrpc ​

jsonrpc: "2.0"

method ​

method: string

params? ​

optional params?: object

Index Signature ​

[key: string]: unknown

params._meta? ​

optional _meta?: object

See General fields: _meta for notes on _meta usage.

Index Signature ​

[key: string]: unknown

optional io.modelcontextprotocol/related-task?: object

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

taskId: string

params._meta.progressToken? ​

optional progressToken?: string | number

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


detectProbeEnvironment() ​

detectProbeEnvironment(): ProbeEnvironment

Defined in: packages/client/src/client/versionNegotiation.ts:157

Detect the probe environment for the network-failure row — see ProbeEnvironment.

Returns ​

ProbeEnvironment


detectProbeTransportKind() ​

detectProbeTransportKind(transport): ProbeTransportKind

Defined in: packages/client/src/client/versionNegotiation.ts:168

Detect the transport class for the transport-aware timeout and closed verdicts (see ProbeTransportKind). The stdio child-process transport is recognized structurally (stderr/pid accessors, no instanceof — safe across bundles); everything else is treated like HTTP.

Parameters ​

transport ​

Transport

Returns ​

ProbeTransportKind


disarmSpentCloseGuard() ​

disarmSpentCloseGuard(transport): void

Defined in: packages/client/src/client/versionNegotiation.ts:349

Disarm a failed negotiation's spent-close guard once the cleanup close() has settled. Any re-delivery of the spent mid-window close happens DURING that close (HTTP transports re-fire onclose there; stdio transports never do — their close event already fired), so after it every close is genuine and must reach the caller's pre-set observer.

Parameters ​

transport ​

Transport

Returns ​

void


negotiateEra() ​

negotiateEra(negotiation, deps): Promise<NegotiationResult>

Defined in: packages/client/src/client/versionNegotiation.ts:465

Run the negotiation probe state machine on a raw (not yet Protocol-connected) transport. Resolves with the negotiated era; throws typed connect errors. On return the probe window has been released: the transport is started, handler-free, and ready for Protocol.connect() handover. On throw the window is detached and the transport's start is left untouched.

Parameters ​

negotiation ​

{ fallbackAvailable: boolean; kind: "auto"; modernVersions: string[]; probe: VersionNegotiationProbeOptions; } | { kind: "pin"; probe: VersionNegotiationProbeOptions; version: string; }

Type Literal ​

{ fallbackAvailable: boolean; kind: "auto"; modernVersions: string[]; probe: VersionNegotiationProbeOptions; }

fallbackAvailable ​

boolean

Whether this client can fall back to the legacy initialize handshake.

kind ​

"auto"

modernVersions ​

string[]

Modern versions this client offers, in preference order (never empty).

probe ​

VersionNegotiationProbeOptions

deps ​

NegotiationDeps

Returns ​

Promise<NegotiationResult>


negotiateStdioViaSibling() ​

negotiateStdioViaSibling(negotiation, sessionTransport, params, deps): Promise<NegotiationResult>

Defined in: packages/client/src/client/versionNegotiation.ts:613

stdio era negotiation on a DISPOSABLE SIBLING: stdio servers built on SDKs that terminate on any pre-initialize request exit when the probe arrives, so the probe must not spend the caller's one process life. server/discover runs on a short-lived sibling spawned from the same parameters; the caller's transport starts exactly once, after the era is known. The sibling is invisible infrastructure: its stderr is discarded, and it is reaped before this resolves (signal escalation awaiting process exit — a helper holding its pipes never blocks disposal). A caller close() on the session transport during the probe aborts the connect with the typed negotiation error, and the session transport is never started.

Parameters ​

negotiation ​

{ fallbackAvailable: boolean; kind: "auto"; modernVersions: string[]; probe: VersionNegotiationProbeOptions; } | { kind: "pin"; probe: VersionNegotiationProbeOptions; version: string; }

Type Literal ​

{ fallbackAvailable: boolean; kind: "auto"; modernVersions: string[]; probe: VersionNegotiationProbeOptions; }

fallbackAvailable ​

boolean

Whether this client can fall back to the legacy initialize handshake.

kind ​

"auto"

modernVersions ​

string[]

Modern versions this client offers, in preference order (never empty).

probe ​

VersionNegotiationProbeOptions

sessionTransport ​

Transport

params ​

Record<string, unknown>

deps ​

Omit<NegotiationDeps, "transport" | "transportKind" | "disposableProbe">

Returns ​

Promise<NegotiationResult>


readStdioServerParams() ​

readStdioServerParams(transport): Record<string, unknown> | undefined

Defined in: packages/client/src/client/versionNegotiation.ts:590

Structural read of the SDK stdio transport's retained spawn parameters — undefined for stdio-shaped transports that do not expose them, and for SUBCLASSES of the SDK transport (those probe in place, where a mid-probe close stays a typed connect error). The sibling path requires the transport to be exactly the base class: a subclass cannot be faithfully cloned by re-invoking its constructor with the retained params alone (extra ctor arguments, transformed state, side effects). Exactness is checked without importing the class (the negotiation graph must stay runtime-neutral): only the base class's own prototype carries the internal _dispose reaper the sibling flow depends on — a subclass's prototype does not own it.

Parameters ​

transport ​

Transport

Returns ​

Record<string, unknown> | undefined


resolveVersionNegotiation() ​

resolveVersionNegotiation(options, supportedProtocolVersionsOption): ResolvedVersionNegotiation

Defined in: packages/client/src/client/versionNegotiation.ts:132

Resolve the negotiation options into a per-connect plan. The raw (not defaulted) supportedProtocolVersions option supplies the modern offer list; a list without any legacy version makes this a modern-only client (no fallback).

Parameters ​

options ​

VersionNegotiationOptions | undefined

supportedProtocolVersionsOption ​

readonly string[] | undefined

Returns ​

ResolvedVersionNegotiation