AxMCPClient
Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L250
Constructors
Constructor
new AxMCPClient(transport: AxMCPTransport, options: Readonly<AxMCPClientOptions>): AxMCPClient;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L303
Parameters
| Parameter | Type |
|---|---|
transport | AxMCPTransport |
options | Readonly<AxMCPClientOptions> |
Returns
AxMCPClient
Methods
acquireResourceSubscription()
acquireResourceSubscription(uri: string, owner: string): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1845
Acquires one logical owner for a resource subscription.
Parameters
| Parameter | Type |
|---|---|
uri | string |
owner | string |
Returns
Promise<void>
batch()
batch(requests: readonly Readonly<AxMCPBatchRequest<unknown>>[], options?: Readonly<AxMCPRequestOptions>): Promise<readonly AxMCPBatchResponse<unknown>[]>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L613
Deprecated
JSON-RPC batching is a compatibility API for MCP 2025-03-26 only.
Parameters
| Parameter | Type |
|---|---|
requests | readonly Readonly<AxMCPBatchRequest<unknown>>[] |
options? | Readonly<AxMCPRequestOptions> |
Returns
Promise<readonly AxMCPBatchResponse<unknown>[]>
callTool()
Call Signature
callTool(
name: string,
args: unknown,
options: Readonly<AxMCPRequestOptions & object>): Promise<AxMCPCreateTaskResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1176
Parameters
| Parameter | Type |
|---|---|
name | string |
args | unknown |
options | Readonly<AxMCPRequestOptions & object> |
Returns
Promise<AxMCPCreateTaskResult>
Call Signature
callTool(
name: string,
args?: unknown,
options?: Readonly<AxMCPRequestOptions & object>): Promise<AxMCPToolCallResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1181
Parameters
| Parameter | Type |
|---|---|
name | string |
args? | unknown |
options? | Readonly<AxMCPRequestOptions & object> |
Returns
Promise<AxMCPToolCallResult>
Call Signature
callTool(
name: string,
args: unknown,
options: Readonly<AxMCPRequestOptions>): Promise<
| AxMCPToolCallResult
| AxMCPCreateTaskResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1188
Parameters
| Parameter | Type |
|---|---|
name | string |
args | unknown |
options | Readonly<AxMCPRequestOptions> |
Returns
Promise<
| AxMCPToolCallResult
| AxMCPCreateTaskResult>
callToolOutcome()
callToolOutcome(
name: string,
args?: unknown,
options?: Readonly<AxMCPRequestOptions>): Promise<AxMCPToolCallOutcome>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1214
Parameters
| Parameter | Type |
|---|---|
name | string |
args? | unknown |
options? | Readonly<AxMCPRequestOptions> |
Returns
Promise<AxMCPToolCallOutcome>
callToolTask()
callToolTask(
name: string,
args?: unknown,
task?: AxMCPTaskMetadata,
options?: Readonly<AxMCPRequestOptions>): Promise<AxMCPLegacyCreateTaskResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1228
Deprecated
Legacy Tasks draft API. Modern tasks are server-directed.
Parameters
| Parameter | Type |
|---|---|
name | string |
args? | unknown |
task? | AxMCPTaskMetadata |
options? | Readonly<AxMCPRequestOptions> |
Returns
Promise<AxMCPLegacyCreateTaskResult>
cancelRequest()
cancelRequest(id: string): void;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1932
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
void
cancelTask()
cancelTask(taskId: string): Promise<undefined | AxMCPTask>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1437
Parameters
| Parameter | Type |
|---|---|
taskId | string |
Returns
Promise<undefined | AxMCPTask>
close()
close(): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L720
Returns
Promise<void>
complete()
complete(
ref: AxMCPCompletionReference,
argument: AxMCPCompletionArgument,
context?: object): Promise<AxMCPCompletionResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1903
Parameters
| Parameter | Type |
|---|---|
ref | AxMCPCompletionReference |
argument | AxMCPCompletionArgument |
context? | { arguments?: Record<string, string>; } |
context.arguments? | Record<string, string> |
Returns
Promise<AxMCPCompletionResult>
discover()
discover(): Promise<AxMCPDiscoverResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L539
Returns
Promise<AxMCPDiscoverResult>
getCapabilities()
getCapabilities(): object;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1115
Returns
object
| Name | Type |
|---|---|
prompts | boolean |
resources | boolean |
tools | boolean |
getCatalogRevision()
getCatalogRevision(): number;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L696
Returns
number
getEra()
getEra(): undefined | AxMCPEra;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L535
Returns
undefined | AxMCPEra
getEvaluationMode()
getEvaluationMode(): "record" | "live" | "replay" | "sandbox";Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L608
Returns
"record" | "live" | "replay" | "sandbox"
getKnownTasks()
getKnownTasks(): readonly AxMCPTask[];Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1451
Returns
readonly AxMCPTask[]
getNamespace()
getNamespace(): string;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L671
Returns
string
getNegotiatedExtensions()
getNegotiatedExtensions(): Readonly<Record<string, AxMCPExtensionCapability>>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L661
Returns
Readonly<Record<string, AxMCPExtensionCapability>>
getPrompt()
getPrompt(
name: string,
args?: Record<string, string>,
options?: Readonly<AxMCPRequestOptions>): Promise<AxMCPPromptGetResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1747
Parameters
| Parameter | Type |
|---|---|
name | string |
args? | Record<string, string> |
options? | Readonly<AxMCPRequestOptions> |
Returns
Promise<AxMCPPromptGetResult>
getPrompts()
getPrompts(): readonly AxMCPPrompt[];Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L684
Returns
readonly AxMCPPrompt[]
getProtocolVersion()
getProtocolVersion(): undefined | string;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L604
Returns
undefined | string
getResources()
getResources(): readonly AxMCPResource[];Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L688
Returns
readonly AxMCPResource[]
getResourceSubscriptions()
getResourceSubscriptions(): readonly string[];Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1883
Returns
readonly string[]
getResourceTemplates()
getResourceTemplates(): readonly AxMCPResourceTemplate[];Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L692
Returns
readonly AxMCPResourceTemplate[]
getServerCapabilities()
getServerCapabilities(): AxMCPServerCapabilities;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L657
Returns
getServerInfo()
getServerInfo():
| undefined
| AxMCPImplementationInfo;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L649
Returns
| undefined
| AxMCPImplementationInfo
getServerInstructions()
getServerInstructions(): undefined | string;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L653
Returns
undefined | string
getTask()
getTask(taskId: string): Promise<AxMCPTask>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1396
Parameters
| Parameter | Type |
|---|---|
taskId | string |
Returns
Promise<AxMCPTask>
getTaskResult()
getTaskResult<T>(taskId: string): Promise<T>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1410
Deprecated
Modern task results are embedded in tasks/get.
Type Parameters
| Type Parameter | Default type |
|---|---|
T | AxMCPToolCallResult |
Parameters
| Parameter | Type |
|---|---|
taskId | string |
Returns
Promise<T>
getTools()
getTools(): readonly AxMCPTool[];Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L680
Returns
readonly AxMCPTool[]
hasCompletionsCapability()
hasCompletionsCapability(): boolean;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1141
Returns
boolean
hasExtension()
hasExtension(name: string): boolean;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L667
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
boolean
hasLoggingCapability()
hasLoggingCapability(): boolean;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1147
Returns
boolean
hasPromptsCapability()
hasPromptsCapability(): boolean;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1129
Returns
boolean
hasResourcesCapability()
hasResourcesCapability(): boolean;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1135
Returns
boolean
hasTasksCapability()
hasTasksCapability(): boolean;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1153
Returns
boolean
hasToolsCapability()
hasToolsCapability(): boolean;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1123
Returns
boolean
init()
init(): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L344
Returns
Promise<void>
inspectCatalog()
inspectCatalog(options: Readonly<{
refresh?: boolean;
}>): Promise<AxMCPCatalogSnapshot>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L700
Parameters
| Parameter | Type |
|---|---|
options | Readonly<{ refresh?: boolean; }> |
Returns
Promise<AxMCPCatalogSnapshot>
listPrompts()
listPrompts(cursor?: string): Promise<AxMCPPromptsListResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1733
Parameters
| Parameter | Type |
|---|---|
cursor? | string |
Returns
Promise<AxMCPPromptsListResult>
listResources()
listResources(cursor?: string): Promise<AxMCPResourcesListResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1765
Parameters
| Parameter | Type |
|---|---|
cursor? | string |
Returns
Promise<AxMCPResourcesListResult>
listResourceTemplates()
listResourceTemplates(cursor?: string): Promise<AxMCPResourceTemplatesListResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1779
Parameters
| Parameter | Type |
|---|---|
cursor? | string |
Returns
Promise<AxMCPResourceTemplatesListResult>
listTasks()
listTasks(cursor?: string): Promise<AxMCPTasksListResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1383
Deprecated
The modern Tasks v2 extension does not expose tasks/list.
Parameters
| Parameter | Type |
|---|---|
cursor? | string |
Returns
Promise<AxMCPTasksListResult>
listTools()
listTools(cursor?: string): Promise<AxMCPToolsListResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1162
Parameters
| Parameter | Type |
|---|---|
cursor? | string |
Returns
Promise<AxMCPToolsListResult>
ping()
ping(timeout: number): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1086
Parameters
| Parameter | Type | Default value |
|---|---|---|
timeout | number | 3000 |
Returns
Promise<void>
provideTaskInput()
provideTaskInput(taskId: string, inputResponses: Readonly<Record<string, AxMCPInputResponse>>): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1424
Parameters
| Parameter | Type |
|---|---|
taskId | string |
inputResponses | Readonly<Record<string, AxMCPInputResponse>> |
Returns
Promise<void>
readResource()
readResource(uri: string, options?: Readonly<AxMCPRequestOptions>): Promise<AxMCPResourceReadResult>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1795
Parameters
| Parameter | Type |
|---|---|
uri | string |
options? | Readonly<AxMCPRequestOptions> |
Returns
Promise<AxMCPResourceReadResult>
refresh()
refresh(options: Readonly<{
force?: boolean;
}>): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L552
Parameters
| Parameter | Type |
|---|---|
options | Readonly<{ force?: boolean; }> |
Returns
Promise<void>
releaseResourceSubscription()
releaseResourceSubscription(uri: string, owner: string): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1863
Releases one logical owner without disturbing other subscribers.
Parameters
| Parameter | Type |
|---|---|
uri | string |
owner | string |
Returns
Promise<void>
setLoggingLevel()
setLoggingLevel(level: AxMCPLoggingLevel): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1921
Deprecated
Set logLevel on the client or an individual modern request.
Parameters
| Parameter | Type |
|---|---|
level | AxMCPLoggingLevel |
Returns
Promise<void>
startListening()
startListening(options: Readonly<AxMCPClientListeningOptions>): Promise<AxMCPListeningHandle>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1491
Parameters
| Parameter | Type |
|---|---|
options | Readonly<AxMCPClientListeningOptions> |
Returns
Promise<AxMCPListeningHandle>
subscribeEvents()
subscribeEvents(listener: (event: Readonly<AxMCPClientEvent>) => void | Promise<void>): () => void;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1484
Parameters
| Parameter | Type |
|---|---|
listener | (event: Readonly<AxMCPClientEvent>) => void | Promise<void> |
Returns
(): void;Returns
void
subscribeResource()
subscribeResource(uri: string): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1830
Parameters
| Parameter | Type |
|---|---|
uri | string |
Returns
Promise<void>
subscribeTaskStatus()
subscribeTaskStatus(listener: (task: Readonly<AxMCPTask>) => void | Promise<void>): () => void;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1477
Parameters
| Parameter | Type |
|---|---|
listener | (task: Readonly<AxMCPTask>) => void | Promise<void> |
Returns
(): void;Returns
void
toFunction()
toFunction(): AxFunction[];Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1107
Returns
unsubscribeResource()
unsubscribeResource(uri: string): Promise<void>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1837
Parameters
| Parameter | Type |
|---|---|
uri | string |
Returns
Promise<void>
waitForTask()
waitForTask<T>(taskId: string, options: Readonly<{
defaultPollIntervalMs?: number;
signal?: AbortSignal;
timeoutMs?: number;
}>): Promise<T>;Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1631
Type Parameters
| Type Parameter | Default type |
|---|---|
T | AxMCPToolCallResult |
Parameters
| Parameter | Type |
|---|---|
taskId | string |
options | Readonly<{ defaultPollIntervalMs?: number; signal?: AbortSignal; timeoutMs?: number; }> |
Returns
Promise<T>