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

AxMCPExecutionContext

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L95

Run-scoped MCP state shared by Ax programs.

Constructors

Constructor

TypeScript
new AxMCPExecutionContext(
   clients: 
  | AxMCPClient
  | readonly AxMCPClient[], 
   inheritance: AxMCPInheritance, 
   ucpClients: 
  | AxUCPClient
  | readonly AxUCPClient[]): AxMCPExecutionContext;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L101

Parameters

ParameterTypeDefault value
clients| AxMCPClient | readonly AxMCPClient[]undefined
inheritanceAxMCPInheritance'all'
ucpClients| AxUCPClient | readonly AxUCPClient[][]

Returns

AxMCPExecutionContext

Properties

PropertyModifierTypeDefault value
inheritancereadonlyAxMCPInheritance'all'

Accessors

clients

Get Signature

TypeScript
get clients(): readonly AxMCPClient[];

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L127

Returns

readonly AxMCPClient[]


ucpClients

Get Signature

TypeScript
get ucpClients(): readonly AxUCPClient[];

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L131

Returns

readonly AxUCPClient[]

Methods

cancelTasksCreatedSince()

TypeScript
cancelTasksCreatedSince(snapshot: AxMCPTaskSnapshot): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L226

Parameters

ParameterType
snapshotAxMCPTaskSnapshot

Returns

Promise<void>


forChild()

TypeScript
forChild(inheritance: AxMCPInheritance): undefined | AxMCPExecutionContext;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L136

Derive the client view that a nested user program is allowed to receive.

Parameters

ParameterType
inheritanceAxMCPInheritance

Returns

undefined | AxMCPExecutionContext


getCatalogRevision()

TypeScript
getCatalogRevision(): string;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L190

Returns

string


getClient()

TypeScript
getClient(client: string | AxMCPClient): AxMCPClient;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L163

Parameters

ParameterType
clientstring | AxMCPClient

Returns

AxMCPClient


getContinuationState()

TypeScript
getContinuationState(): AxMCPContinuationState;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L204

Returns

AxMCPContinuationState


getTaskSnapshot()

TypeScript
getTaskSnapshot(): AxMCPTaskSnapshot;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L217

Returns

AxMCPTaskSnapshot


getToolBindings()

TypeScript
getToolBindings(): AxFunction[];

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L178

Bind raw MCP tools without using the lossy client.toFunction() adapter.

Returns

AxFunction[]


getUCPClient()

TypeScript
getUCPClient(client: string | AxUCPClient): AxUCPClient;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L170

Parameters

ParameterType
clientstring | AxUCPClient

Returns

AxUCPClient


initialize()

TypeScript
initialize(): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L155

Returns

Promise<void>


resolveContext()

TypeScript
resolveContext(requests: readonly AxMCPContextRequest[]): Promise<AxMCPResolvedContext[]>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L286

Parameters

ParameterTypeDefault value
requestsreadonly AxMCPContextRequest[][]

Returns

Promise<AxMCPResolvedContext[]>


resolveContextPrompt()

TypeScript
resolveContextPrompt(requests: readonly AxMCPContextRequest[]): Promise<(
  | {
  cache?: boolean;
  content: string;
  role: "system";
}
  | {
  cache?: boolean;
  content:   | string
     | (
     | {
     cache?: boolean;
     text: string;
     type: "text";
   }
     | {
     altText?: string;
     cache?: boolean;
     details?: "high" | "low" | "auto";
     image: string;
     mimeType: string;
     optimize?: "auto" | "quality" | "size";
     type: "image";
   }
     | {
     cache?: boolean;
     channels?: number;
     data: string;
     duration?: number;
     format?: AxAudioFormat;
     mimeType?: string;
     sampleRate?: number;
     transcription?: string;
     type: "audio";
   }
     | {
     cache?: boolean;
     data: string;
     extractedText?: string;
     filename?: string;
     mimeType: string;
     type: "file";
   }
     | {
     cache?: boolean;
     extractedText?: string;
     filename?: string;
     fileUri: string;
     mimeType: string;
     type: "file";
   }
     | {
     cache?: boolean;
     cachedContent?: string;
     description?: string;
     title?: string;
     type: "url";
     url: string;
   })[];
  name?: string;
  role: "user";
}
  | {
  audio?: {
     id: string;
     transcript?: string;
  };
  cache?: boolean;
  content?: string;
  functionCalls?: object[];
  name?: string;
  role: "assistant";
  thought?: string;
  thoughtBlocks?: AxThoughtBlockItem[];
}
  | {
  cache?: boolean;
  content?: AxFunctionResultContent;
  functionId: string;
  isError?: boolean;
  protocolResult?: {
     protocol: NonNullable<
        | undefined
        | {
        annotations?: Record<..., ...>;
        kind: "mcp";
        meta?: Record<..., ...>;
        name: string;
        namespace: string;
      }
        | {
        kind: "ucp";
        meta?: Record<..., ...>;
        name: string;
        namespace: string;
     }>;
     value: unknown;
  };
  result: string;
  role: "function";
})[]>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L314

Parameters

ParameterTypeDefault value
requestsreadonly AxMCPContextRequest[][]

Returns

Promise<( | { cache?: boolean; content: string; role: "system"; } | { cache?: boolean; content: | string | ( | { cache?: boolean; text: string; type: "text"; } | { altText?: string; cache?: boolean; details?: "high" | "low" | "auto"; image: string; mimeType: string; optimize?: "auto" | "quality" | "size"; type: "image"; } | { cache?: boolean; channels?: number; data: string; duration?: number; format?: AxAudioFormat; mimeType?: string; sampleRate?: number; transcription?: string; type: "audio"; } | { cache?: boolean; data: string; extractedText?: string; filename?: string; mimeType: string; type: "file"; } | { cache?: boolean; extractedText?: string; filename?: string; fileUri: string; mimeType: string; type: "file"; } | { cache?: boolean; cachedContent?: string; description?: string; title?: string; type: "url"; url: string; })[]; name?: string; role: "user"; } | { audio?: { id: string; transcript?: string; }; cache?: boolean; content?: string; functionCalls?: object[]; name?: string; role: "assistant"; thought?: string; thoughtBlocks?: AxThoughtBlockItem[]; } | { cache?: boolean; content?: AxFunctionResultContent; functionId: string; isError?: boolean; protocolResult?: { protocol: NonNullable< | undefined | { annotations?: Record<…, …>; kind: "mcp"; meta?: Record<…, …>; name: string; namespace: string; } | { kind: "ucp"; meta?: Record<…, …>; name: string; namespace: string; }>; value: unknown; }; result: string; role: "function"; })[]>


restoreContinuationState()

TypeScript
restoreContinuationState(state: 
  | undefined
| Readonly<AxMCPContinuationState>): Promise<void>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/mcp/execution.ts#L248

Parameters

ParameterType
state| undefined | Readonly<AxMCPContinuationState>

Returns

Promise<void>

Docs