AxMCPClient Generated TypeScript API reference. typescript api api/reference build/apidocs/Class.AxMCPClient.md class AxMCPClient

AxMCPClient

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L250

Constructors

Constructor

TypeScript
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

ParameterType
transportAxMCPTransport
optionsReadonly<AxMCPClientOptions>

Returns

AxMCPClient

Methods

acquireResourceSubscription()

TypeScript
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

ParameterType
uristring
ownerstring

Returns

Promise<void>


batch()

TypeScript
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

ParameterType
requestsreadonly Readonly<AxMCPBatchRequest<unknown>>[]
options?Readonly<AxMCPRequestOptions>

Returns

Promise<readonly AxMCPBatchResponse<unknown>[]>


callTool()

Call Signature

TypeScript
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
ParameterType
namestring
argsunknown
optionsReadonly<AxMCPRequestOptions & object>
Returns

Promise<AxMCPCreateTaskResult>

Call Signature

TypeScript
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
ParameterType
namestring
args?unknown
options?Readonly<AxMCPRequestOptions & object>
Returns

Promise<AxMCPToolCallResult>

Call Signature

TypeScript
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
ParameterType
namestring
argsunknown
optionsReadonly<AxMCPRequestOptions>
Returns

Promise< | AxMCPToolCallResult | AxMCPCreateTaskResult>


callToolOutcome()

TypeScript
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

ParameterType
namestring
args?unknown
options?Readonly<AxMCPRequestOptions>

Returns

Promise<AxMCPToolCallOutcome>


callToolTask()

TypeScript
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

ParameterType
namestring
args?unknown
task?AxMCPTaskMetadata
options?Readonly<AxMCPRequestOptions>

Returns

Promise<AxMCPLegacyCreateTaskResult>


cancelRequest()

TypeScript
cancelRequest(id: string): void;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1932

Parameters

ParameterType
idstring

Returns

void


cancelTask()

TypeScript
cancelTask(taskId: string): Promise<undefined | AxMCPTask>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1437

Parameters

ParameterType
taskIdstring

Returns

Promise<undefined | AxMCPTask>


close()

TypeScript
close(): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L720

Returns

Promise<void>


complete()

TypeScript
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

ParameterType
refAxMCPCompletionReference
argumentAxMCPCompletionArgument
context?{ arguments?: Record<string, string>; }
context.arguments?Record<string, string>

Returns

Promise<AxMCPCompletionResult>


discover()

TypeScript
discover(): Promise<AxMCPDiscoverResult>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L539

Returns

Promise<AxMCPDiscoverResult>


getCapabilities()

TypeScript
getCapabilities(): object;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1115

Returns

object

NameType
promptsboolean
resourcesboolean
toolsboolean

getCatalogRevision()

TypeScript
getCatalogRevision(): number;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L696

Returns

number


getEra()

TypeScript
getEra(): undefined | AxMCPEra;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L535

Returns

undefined | AxMCPEra


getEvaluationMode()

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

TypeScript
getKnownTasks(): readonly AxMCPTask[];

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1451

Returns

readonly AxMCPTask[]


getNamespace()

TypeScript
getNamespace(): string;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L671

Returns

string


getNegotiatedExtensions()

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

TypeScript
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

ParameterType
namestring
args?Record<string, string>
options?Readonly<AxMCPRequestOptions>

Returns

Promise<AxMCPPromptGetResult>


getPrompts()

TypeScript
getPrompts(): readonly AxMCPPrompt[];

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L684

Returns

readonly AxMCPPrompt[]


getProtocolVersion()

TypeScript
getProtocolVersion(): undefined | string;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L604

Returns

undefined | string


getResources()

TypeScript
getResources(): readonly AxMCPResource[];

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L688

Returns

readonly AxMCPResource[]


getResourceSubscriptions()

TypeScript
getResourceSubscriptions(): readonly string[];

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1883

Returns

readonly string[]


getResourceTemplates()

TypeScript
getResourceTemplates(): readonly AxMCPResourceTemplate[];

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L692

Returns

readonly AxMCPResourceTemplate[]


getServerCapabilities()

TypeScript
getServerCapabilities(): AxMCPServerCapabilities;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L657

Returns

AxMCPServerCapabilities


getServerInfo()

TypeScript
getServerInfo(): 
  | undefined
  | AxMCPImplementationInfo;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L649

Returns

| undefined | AxMCPImplementationInfo


getServerInstructions()

TypeScript
getServerInstructions(): undefined | string;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L653

Returns

undefined | string


getTask()

TypeScript
getTask(taskId: string): Promise<AxMCPTask>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1396

Parameters

ParameterType
taskIdstring

Returns

Promise<AxMCPTask>


getTaskResult()

TypeScript
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 ParameterDefault type
TAxMCPToolCallResult

Parameters

ParameterType
taskIdstring

Returns

Promise<T>


getTools()

TypeScript
getTools(): readonly AxMCPTool[];

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L680

Returns

readonly AxMCPTool[]


hasCompletionsCapability()

TypeScript
hasCompletionsCapability(): boolean;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1141

Returns

boolean


hasExtension()

TypeScript
hasExtension(name: string): boolean;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L667

Parameters

ParameterType
namestring

Returns

boolean


hasLoggingCapability()

TypeScript
hasLoggingCapability(): boolean;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1147

Returns

boolean


hasPromptsCapability()

TypeScript
hasPromptsCapability(): boolean;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1129

Returns

boolean


hasResourcesCapability()

TypeScript
hasResourcesCapability(): boolean;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1135

Returns

boolean


hasTasksCapability()

TypeScript
hasTasksCapability(): boolean;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1153

Returns

boolean


hasToolsCapability()

TypeScript
hasToolsCapability(): boolean;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1123

Returns

boolean


init()

TypeScript
init(): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L344

Returns

Promise<void>


inspectCatalog()

TypeScript
inspectCatalog(options: Readonly<{
  refresh?: boolean;
}>): Promise<AxMCPCatalogSnapshot>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L700

Parameters

ParameterType
optionsReadonly<{ refresh?: boolean; }>

Returns

Promise<AxMCPCatalogSnapshot>


listPrompts()

TypeScript
listPrompts(cursor?: string): Promise<AxMCPPromptsListResult>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1733

Parameters

ParameterType
cursor?string

Returns

Promise<AxMCPPromptsListResult>


listResources()

TypeScript
listResources(cursor?: string): Promise<AxMCPResourcesListResult>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1765

Parameters

ParameterType
cursor?string

Returns

Promise<AxMCPResourcesListResult>


listResourceTemplates()

TypeScript
listResourceTemplates(cursor?: string): Promise<AxMCPResourceTemplatesListResult>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1779

Parameters

ParameterType
cursor?string

Returns

Promise<AxMCPResourceTemplatesListResult>


listTasks()

TypeScript
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

ParameterType
cursor?string

Returns

Promise<AxMCPTasksListResult>


listTools()

TypeScript
listTools(cursor?: string): Promise<AxMCPToolsListResult>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1162

Parameters

ParameterType
cursor?string

Returns

Promise<AxMCPToolsListResult>


ping()

TypeScript
ping(timeout: number): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1086

Parameters

ParameterTypeDefault value
timeoutnumber3000

Returns

Promise<void>


provideTaskInput()

TypeScript
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

ParameterType
taskIdstring
inputResponsesReadonly<Record<string, AxMCPInputResponse>>

Returns

Promise<void>


readResource()

TypeScript
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

ParameterType
uristring
options?Readonly<AxMCPRequestOptions>

Returns

Promise<AxMCPResourceReadResult>


refresh()

TypeScript
refresh(options: Readonly<{
  force?: boolean;
}>): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L552

Parameters

ParameterType
optionsReadonly<{ force?: boolean; }>

Returns

Promise<void>


releaseResourceSubscription()

TypeScript
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

ParameterType
uristring
ownerstring

Returns

Promise<void>


setLoggingLevel()

TypeScript
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

ParameterType
levelAxMCPLoggingLevel

Returns

Promise<void>


startListening()

TypeScript
startListening(options: Readonly<AxMCPClientListeningOptions>): Promise<AxMCPListeningHandle>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1491

Parameters

ParameterType
optionsReadonly<AxMCPClientListeningOptions>

Returns

Promise<AxMCPListeningHandle>


subscribeEvents()

TypeScript
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

ParameterType
listener(event: Readonly<AxMCPClientEvent>) => void | Promise<void>

Returns

TypeScript
(): void;
Returns

void


subscribeResource()

TypeScript
subscribeResource(uri: string): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1830

Parameters

ParameterType
uristring

Returns

Promise<void>


subscribeTaskStatus()

TypeScript
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

ParameterType
listener(task: Readonly<AxMCPTask>) => void | Promise<void>

Returns

TypeScript
(): void;
Returns

void


toFunction()

TypeScript
toFunction(): AxFunction[];

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1107

Returns

AxFunction[]


unsubscribeResource()

TypeScript
unsubscribeResource(uri: string): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/7965c876f6a5b641e0cf166e8942e540cfde65e1/src/ax/mcp/client.ts#L1837

Parameters

ParameterType
uristring

Returns

Promise<void>


waitForTask()

TypeScript
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 ParameterDefault type
TAxMCPToolCallResult

Parameters

ParameterType
taskIdstring
optionsReadonly<{ defaultPollIntervalMs?: number; signal?: AbortSignal; timeoutMs?: number; }>

Returns

Promise<T>

Docs