import { type Duration, type RetryPolicy } from '@temporalio/common'; import { type StatefulTemporalMCPServer } from '../common/mcp-types'; export interface StatefulMcpServerOptions { /** Activity options for tool operation Activities on the dedicated Worker. */ config?: { startToCloseTimeout?: Duration; scheduleToStartTimeout?: Duration; heartbeatTimeout?: Duration; taskQueue?: string; retryPolicy?: RetryPolicy; }; /** Activity options for the long-running server-session Activity. */ serverSessionConfig?: { startToCloseTimeout?: Duration; heartbeatTimeout?: Duration; }; factoryArgument?: unknown; /** * When `true` (the default), the agent SDK caches `listTools` for the * agent's lifetime. Set to `false` if the server's tool set may change * mid-run. */ cacheToolsList?: boolean; } /** * Workflow-side handle for a stateful MCP server connection. Tool operations * route to a dedicated in-process Worker on a per-run Task Queue, preserving * server state across calls. */ export declare class StatefulMCPServerReference implements StatefulTemporalMCPServer { private readonly _name; private readonly _operationConfig; private readonly _sessionConfig; private readonly _factoryArgument; private readonly _cacheToolsList; private _sessionScope; private _sessionPromise; private _connected; constructor(name: string, options?: StatefulMcpServerOptions); get name(): string; get cacheToolsList(): boolean; /** Starts the per-run server-session Activity. */ connect(): Promise; /** Cancels the server-session Activity, tearing down the dedicated Worker. */ cleanup(): Promise; /** Alias for `cleanup()` — matches the MCPServer interface. */ close(): Promise; private assertConnected; listTools(): Promise; callTool(toolName: string, args: Record | null): Promise; invalidateToolsCache(): Promise; } /** * Creates a stateful MCP server handle. Maintains a persistent MCP connection * across the Workflow via a dedicated per-run Worker. * * If the dedicated Worker fails (startup timeout or missed heartbeat), * operations throw `ApplicationFailure` with type `"DedicatedWorkerFailure"`. * * @param name - Server name; must match the `StatefulMCPServerProvider` registered on the Worker side. */ export declare function statefulMcpServer(name: string, options?: StatefulMcpServerOptions): StatefulTemporalMCPServer;