Skip to main content
Defined in: client/client.ts:164

Implements

Constructors

Constructor

Defined in: client/client.ts:208

Parameters

input
ClientTransportInput
options?
ClientOptions

Returns

Client

Methods

[asyncDispose]()

Defined in: client/client.ts:359

Returns

Promise<void>

Implementation of

IClient.[asyncDispose]

callTool()

Defined in: client/client.ts:434

Type Parameters

TData
TData = unknown

Parameters

name
string
args?
Record<string, unknown>
options?
CallToolOptions

Returns

Promise<CallToolResult<TData>>

Implementation of

IClient.callTool

callToolRaw()

Defined in: client/client.ts:452 Returns the full result including isError without throwing.

Type Parameters

TData
TData = unknown

Parameters

name
string
args?
Record<string, unknown>
options?
CallToolOptions

Returns

Promise<CallToolResult<TData>>

close()

Defined in: client/client.ts:342

Returns

Promise<void>

Implementation of

IClient.close

complete()

Defined in: client/client.ts:629

Parameters

ref
| { name: string; type: "ref/prompt"; } | { type: "ref/resource"; uri: string; }
argument
name
string
value
string
context?
arguments?
Record<string, string>
options?
RequestOptions

Returns

Promise<CompletionResult>

Implementation of

IClient.complete

connect()

Defined in: client/client.ts:236

Returns

Promise<void>

Implementation of

IClient.connect

getPrompt()

Defined in: client/client.ts:611

Parameters

name
string
args?
Record<string, string>
options?
RequestOptions

Returns

Promise<{ [key: string]: unknown; }>

Implementation of

IClient.getPrompt

getProtocolEra()

Defined in: client/client.ts:416 The protocol era negotiated at connect(): 'modern' for 2026-07-28 (per-request envelope), 'legacy' for 2025-11-25 and earlier (the initialize handshake). undefined before connect(). See ClientOptions.versionNegotiation.

Returns

ProtocolEra | undefined

isConnected()

Defined in: client/client.ts:363

Returns

boolean

Implementation of

IClient.isConnected

listPrompts()

Defined in: client/client.ts:601

Parameters

options?
RequestOptions

Returns

Promise<{ }[]>

Implementation of

IClient.listPrompts

listResources()

Defined in: client/client.ts:476

Parameters

options?
RequestOptions

Returns

Promise<{ }[]>

Implementation of

IClient.listResources

listResourceTemplates()

Defined in: client/client.ts:486

Parameters

options?
RequestOptions

Returns

Promise<{ }[]>

Implementation of

IClient.listResourceTemplates

listTools()

Defined in: client/client.ts:424

Parameters

options?
RequestOptions

Returns

Promise<{ }[]>

Implementation of

IClient.listTools

notifyRootsChanged()

Defined in: client/client.ts:908 Notify the connected server that the client’s roots list has changed. The server should re-issue a roots/list request to get the updated list.

Returns

Promise<void>

ping()

Defined in: client/client.ts:402 Liveness check. On a legacy-era connection this sends the ping RPC. On a modern (2026-07-28) connection ping is not a wire method — the era’s registry deliberately excludes it — so this sends server/discover instead: any successful response is equally strong liveness evidence, and discover() is the SDK-native modern equivalent (rather than a hand-rolled substitute). Returns false only on legacy ping’s own result; a modern-era failure throws, matching ping()’s existing throw-on-failure contract.

Parameters

options?
RequestOptions

Returns

Promise<boolean>

Implementation of

IClient.ping

readResource()

Defined in: client/client.ts:496

Parameters

uri
string
options?
RequestOptions

Returns

Promise<( | { } | { })[]>

Implementation of

IClient.readResource

readResourceRaw()

Defined in: client/client.ts:510 Returns the raw SDK ReadResourceResult without unwrapping.

Parameters

uri
string
options?
RequestOptions

Returns

Promise<{ [key: string]: unknown; }>

setLogLevel()

Defined in: client/client.ts:658 Sets the minimum severity level for log messages sent by the server. On a legacy-era connection this sends the logging/setLevel RPC, unchanged. On a modern (2026-07-28) connection logging/setLevel is deprecated (SEP-2577) and physically absent from the era’s registry — there is no RPC to send. Instead, the level is recorded and threaded into _meta['io.modelcontextprotocol/logLevel'] on every subsequent request via _metaParams(), per request; user-supplied _meta still wins if a caller passes one explicitly (there is no such call site in this class today).

Parameters

level
LoggingLevel
options?
RequestOptions

Returns

Promise<void>

Implementation of

IClient.setLogLevel

subscribeResource()

Defined in: client/client.ts:528 Subscribes to change notifications for a resource URI. handler fires whenever the server sends a matching update, on either protocol era: on a legacy (2025-era) connection via the resources/subscribe RPC and unsolicited notifications/resources/updated push, or on a modern (2026-07-28) connection via a subscriptions/listen stream opted into resourceSubscriptions — both dispatch to the same notifications/resources/updated handler registered in _registerHandlers, so this method is the only era-aware part.

Parameters

uri
string
handler
ResourceUpdateHandler
options?
RequestOptions

Returns

Promise<void>

Implementation of

IClient.subscribeResource

unsubscribeResource()

Defined in: client/client.ts:546

Parameters

uri
string
options?
RequestOptions

Returns

Promise<void>

Implementation of

IClient.unsubscribeResource

connect()

Call Signature

Defined in: client/client.ts:368 Creates a connected MultiServerClient when given a multi-entry McpConfig.
Parameters
input
McpConfig
options?
MultiServerOptions
Returns
Promise<MultiServerClient>

Call Signature

Defined in: client/client.ts:370 Creates a connected Client for a single-server transport. Use with await using for automatic cleanup.
Parameters
input
ClientTransportInput
options?
ClientOptions
Returns
Promise<Client>