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

Implements

Constructors

Constructor

Defined in: client/client.ts:217

Parameters

input
ClientTransportInput
options?
ClientOptions

Returns

Client

Methods

[asyncDispose]()

Defined in: client/client.ts:373

Returns

Promise<void>

Implementation of

IClient.[asyncDispose]

callTool()

Defined in: client/client.ts:480

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:498 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:356

Returns

Promise<void>

Implementation of

IClient.close

complete()

Defined in: client/client.ts:675

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:245

Returns

Promise<void>

Implementation of

IClient.connect

getInstructions()

Defined in: client/client.ts:453 The server’s instructions string, when the server provided one — from the legacy initialize result or, on a modern (2026-07-28) connection, from the server/discover result. undefined otherwise and before connect().

Returns

string | undefined

getPrompt()

Defined in: client/client.ts:657

Parameters

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

Returns

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

Implementation of

IClient.getPrompt

getProtocolEra()

Defined in: client/client.ts:430 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

getServerCapabilities()

Defined in: client/client.ts:462 The capabilities the server advertised during connection — on the legacy initialize result, or on the server/discover result for a modern (2026-07-28) connection. undefined before connect().

Returns

| { } | undefined

getServerInfo()

Defined in: client/client.ts:443 The connected server’s self-reported identity (serverInfo: name, version, and optional title / websiteUrl / icons), when it identified itself. On a legacy connection it comes from the initialize result, where it is required. On a modern (2026-07-28) connection it comes from the server/discover result’s metadata — FastMCP servers advertise it there, but an anonymous modern server may omit it, leaving this undefined. undefined before connect().

Returns

| { } | undefined

isConnected()

Defined in: client/client.ts:377

Returns

boolean

Implementation of

IClient.isConnected

listPrompts()

Defined in: client/client.ts:647

Parameters

options?
RequestOptions

Returns

Promise<{ }[]>

Implementation of

IClient.listPrompts

listResources()

Defined in: client/client.ts:522

Parameters

options?
RequestOptions

Returns

Promise<{ }[]>

Implementation of

IClient.listResources

listResourceTemplates()

Defined in: client/client.ts:532

Parameters

options?
RequestOptions

Returns

Promise<{ }[]>

Implementation of

IClient.listResourceTemplates

listTools()

Defined in: client/client.ts:470

Parameters

options?
RequestOptions

Returns

Promise<{ }[]>

Implementation of

IClient.listTools

notifyRootsChanged()

Defined in: client/client.ts:954 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:416 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:542

Parameters

uri
string
options?
RequestOptions

Returns

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

Implementation of

IClient.readResource

readResourceRaw()

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

Parameters

uri
string
options?
RequestOptions

Returns

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

setLogLevel()

Defined in: client/client.ts:704 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:574 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:592

Parameters

uri
string
options?
RequestOptions

Returns

Promise<void>

Implementation of

IClient.unsubscribeResource

connect()

Call Signature

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