> ## Documentation Index
> Fetch the complete documentation index at: https://fastmcp-ts.docs.prefect.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Client

Defined in: [client/client.ts:164](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L164)

## Implements

* [`IClient`](/api/client/interfaces/IClient)

## Constructors

### Constructor

```ts theme={null}
new Client(input, options?): Client;
```

Defined in: [client/client.ts:208](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L208)

#### Parameters

##### input

[`ClientTransportInput`](/api/client/type-aliases/ClientTransportInput)

##### options?

[`ClientOptions`](/api/client/interfaces/ClientOptions)

#### Returns

`Client`

## Methods

### \[asyncDispose]\()

```ts theme={null}
asyncDispose: Promise<void>;
```

Defined in: [client/client.ts:359](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L359)

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`[asyncDispose]`](/api/client/interfaces/IClient#asyncdispose)

***

### callTool()

```ts theme={null}
callTool<TData>(
   name, 
   args?, 
   options?): Promise<CallToolResult<TData>>;
```

Defined in: [client/client.ts:434](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L434)

#### Type Parameters

##### TData

`TData` = `unknown`

#### Parameters

##### name

`string`

##### args?

`Record`\<`string`, `unknown`>

##### options?

[`CallToolOptions`](/api/client/interfaces/CallToolOptions)

#### Returns

`Promise`\<[`CallToolResult`](/api/client/type-aliases/CallToolResult)\<`TData`>>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`callTool`](/api/client/interfaces/IClient#calltool)

***

### callToolRaw()

```ts theme={null}
callToolRaw<TData>(
   name, 
   args?, 
   options?): Promise<CallToolResult<TData>>;
```

Defined in: [client/client.ts:452](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L452)

Returns the full result including isError without throwing.

#### Type Parameters

##### TData

`TData` = `unknown`

#### Parameters

##### name

`string`

##### args?

`Record`\<`string`, `unknown`>

##### options?

[`CallToolOptions`](/api/client/interfaces/CallToolOptions)

#### Returns

`Promise`\<[`CallToolResult`](/api/client/type-aliases/CallToolResult)\<`TData`>>

***

### close()

```ts theme={null}
close(): Promise<void>;
```

Defined in: [client/client.ts:342](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L342)

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`close`](/api/client/interfaces/IClient#close)

***

### complete()

```ts theme={null}
complete(
   ref, 
   argument, 
   context?, 
   options?): Promise<CompletionResult>;
```

Defined in: [client/client.ts:629](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L629)

#### Parameters

##### ref

\| \{
`name`: `string`;
`type`: `"ref/prompt"`;
}
\| \{
`type`: `"ref/resource"`;
`uri`: `string`;
}

##### argument

###### name

`string`

###### value

`string`

##### context?

###### arguments?

`Record`\<`string`, `string`>

##### options?

[`RequestOptions`](/api/client/interfaces/RequestOptions)

#### Returns

`Promise`\<[`CompletionResult`](/api/client/type-aliases/CompletionResult)>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`complete`](/api/client/interfaces/IClient#complete)

***

### connect()

```ts theme={null}
connect(): Promise<void>;
```

Defined in: [client/client.ts:236](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L236)

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`connect`](/api/client/interfaces/IClient#connect)

***

### getPrompt()

```ts theme={null}
getPrompt(
   name, 
   args?, 
   options?): Promise<{
[key: string]: unknown;
}>;
```

Defined in: [client/client.ts:611](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L611)

#### Parameters

##### name

`string`

##### args?

`Record`\<`string`, `string`>

##### options?

[`RequestOptions`](/api/client/interfaces/RequestOptions)

#### Returns

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

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`getPrompt`](/api/client/interfaces/IClient#getprompt)

***

### getProtocolEra()

```ts theme={null}
getProtocolEra(): ProtocolEra | undefined;
```

Defined in: [client/client.ts:416](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L416)

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

```ts theme={null}
isConnected(): boolean;
```

Defined in: [client/client.ts:363](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L363)

#### Returns

`boolean`

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`isConnected`](/api/client/interfaces/IClient#isconnected)

***

### listPrompts()

```ts theme={null}
listPrompts(options?): Promise<{
}[]>;
```

Defined in: [client/client.ts:601](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L601)

#### Parameters

##### options?

[`RequestOptions`](/api/client/interfaces/RequestOptions)

#### Returns

`Promise`\<\{
}\[]>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`listPrompts`](/api/client/interfaces/IClient#listprompts)

***

### listResources()

```ts theme={null}
listResources(options?): Promise<{
}[]>;
```

Defined in: [client/client.ts:476](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L476)

#### Parameters

##### options?

[`RequestOptions`](/api/client/interfaces/RequestOptions)

#### Returns

`Promise`\<\{
}\[]>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`listResources`](/api/client/interfaces/IClient#listresources)

***

### listResourceTemplates()

```ts theme={null}
listResourceTemplates(options?): Promise<{
}[]>;
```

Defined in: [client/client.ts:486](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L486)

#### Parameters

##### options?

[`RequestOptions`](/api/client/interfaces/RequestOptions)

#### Returns

`Promise`\<\{
}\[]>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`listResourceTemplates`](/api/client/interfaces/IClient#listresourcetemplates)

***

### listTools()

```ts theme={null}
listTools(options?): Promise<{
}[]>;
```

Defined in: [client/client.ts:424](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L424)

#### Parameters

##### options?

[`RequestOptions`](/api/client/interfaces/RequestOptions)

#### Returns

`Promise`\<\{
}\[]>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`listTools`](/api/client/interfaces/IClient#listtools)

***

### notifyRootsChanged()

```ts theme={null}
notifyRootsChanged(): Promise<void>;
```

Defined in: [client/client.ts:908](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L908)

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

```ts theme={null}
ping(options?): Promise<boolean>;
```

Defined in: [client/client.ts:402](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L402)

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`](/api/client/interfaces/RequestOptions)

#### Returns

`Promise`\<`boolean`>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`ping`](/api/client/interfaces/IClient#ping)

***

### readResource()

```ts theme={null}
readResource(uri, options?): Promise<(
  | {
}
  | {
})[]>;
```

Defined in: [client/client.ts:496](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L496)

#### Parameters

##### uri

`string`

##### options?

[`RequestOptions`](/api/client/interfaces/RequestOptions)

#### Returns

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

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`readResource`](/api/client/interfaces/IClient#readresource)

***

### readResourceRaw()

```ts theme={null}
readResourceRaw(uri, options?): Promise<{
[key: string]: unknown;
}>;
```

Defined in: [client/client.ts:510](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L510)

Returns the raw SDK ReadResourceResult without unwrapping.

#### Parameters

##### uri

`string`

##### options?

[`RequestOptions`](/api/client/interfaces/RequestOptions)

#### Returns

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

***

### setLogLevel()

```ts theme={null}
setLogLevel(level, options?): Promise<void>;
```

Defined in: [client/client.ts:658](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L658)

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`](/api/client/interfaces/RequestOptions)

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`setLogLevel`](/api/client/interfaces/IClient#setloglevel)

***

### subscribeResource()

```ts theme={null}
subscribeResource(
   uri, 
   handler, 
   options?): Promise<void>;
```

Defined in: [client/client.ts:528](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L528)

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`](/api/client/type-aliases/ResourceUpdateHandler)

##### options?

[`RequestOptions`](/api/client/interfaces/RequestOptions)

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`subscribeResource`](/api/client/interfaces/IClient#subscriberesource)

***

### unsubscribeResource()

```ts theme={null}
unsubscribeResource(uri, options?): Promise<void>;
```

Defined in: [client/client.ts:546](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L546)

#### Parameters

##### uri

`string`

##### options?

[`RequestOptions`](/api/client/interfaces/RequestOptions)

#### Returns

`Promise`\<`void`>

#### Implementation of

[`IClient`](/api/client/interfaces/IClient).[`unsubscribeResource`](/api/client/interfaces/IClient#unsubscriberesource)

***

### connect()

#### Call Signature

```ts theme={null}
static connect(input, options?): Promise<MultiServerClient>;
```

Defined in: [client/client.ts:368](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L368)

Creates a connected MultiServerClient when given a multi-entry McpConfig.

##### Parameters

###### input

[`McpConfig`](/api/client/type-aliases/McpConfig)

###### options?

[`MultiServerOptions`](/api/client/interfaces/MultiServerOptions)

##### Returns

`Promise`\<[`MultiServerClient`](/api/client/classes/MultiServerClient)>

#### Call Signature

```ts theme={null}
static connect(input, options?): Promise<Client>;
```

Defined in: [client/client.ts:370](https://github.com/PrefectHQ/fastmcp-ts/blob/e4b6038f642b529f601463a576229747afebe9a4/src/client/client.ts#L370)

Creates a connected Client for a single-server transport. Use with `await using` for automatic cleanup.

##### Parameters

###### input

[`ClientTransportInput`](/api/client/type-aliases/ClientTransportInput)

###### options?

[`ClientOptions`](/api/client/interfaces/ClientOptions)

##### Returns

`Promise`\<`Client`>
