UNPKG

@tanstack/ai-mcp

Version:

Host-side Model Context Protocol client for TanStack AI: discover and run MCP server tools, resources, and prompts in any adapter's chat() loop, with generated end-to-end types.

106 lines (105 loc) • 3.42 kB
export declare class MCPConnectionError extends Error { readonly cause?: unknown | undefined; constructor(message: string, cause?: unknown | undefined); } export declare class DuplicateToolNameError extends Error { readonly toolName: string; constructor(toolName: string); } /** * Thrown when a task-required tool is explicitly bound via `mcp.tools([...])`, * called via `callTool()`, or named in a `toolFilter` list, but the server * does not declare the tasks capability for tools/call, so the call could * never execute. (Auto-discovery without a `toolFilter` list skips such tools.) */ export declare class MCPTaskRequiredToolError extends Error { readonly toolName: string; constructor(toolName: string); } export declare class MCPToolNotFoundError extends Error { readonly toolName: string; constructor(toolName: string); } type ToolFilterDetails = { /** Listed, but the server has no tool with this name. */ missing: Array<string>; /** Listed more than once. */ repeated: Array<string>; /** The server's tool names. */ available: Array<string>; }; /** * Thrown by `tools()` when a `toolFilter` list names a tool that the server * does not have, or names a tool more than once. */ export declare class MCPToolFilterError extends Error { /** Listed, but the server has no tool with this name. */ readonly missing: Array<string>; /** Listed more than once. */ readonly repeated: Array<string>; /** The server's tool names. */ readonly available: Array<string>; constructor(details: ToolFilterDetails); } /** * The server did not advertise MCP Events, or it answered method not found. * * @experimental */ export declare class MCPEventsUnsupportedError extends Error { constructor(); } /** * Invalid MCP Events client options or subscribe arguments. * * @experimental */ export declare class MCPEventConfigError extends Error { readonly reason: string; constructor(reason: string); } /** * The event name is missing from `events/list`, or it has no webhook delivery. * * @experimental */ export declare class MCPUnknownEventError extends Error { readonly eventName: string; readonly reason: 'not-found' | 'webhook-unsupported'; constructor(eventName: string, reason: 'not-found' | 'webhook-unsupported'); } /** * Kind of a JSON-RPC error from an `events/*` request. * * @experimental */ export type MCPEventRequestKind = 'invalid-params' | 'not-found' | 'forbidden' | 'resource-exhausted' | 'unsupported' | 'callback-endpoint' | 'unknown'; /** * The server returned a JSON-RPC error for an `events/*` request. * * @experimental */ export declare class MCPEventRequestError extends Error { readonly code: number; readonly kind: MCPEventRequestKind; readonly reason?: string | undefined; readonly data?: unknown | undefined; readonly cause?: unknown | undefined; constructor(message: string, code: number, kind: MCPEventRequestKind, reason?: string | undefined, data?: unknown | undefined, cause?: unknown | undefined); } /** * `refresh` or `unsubscribe` was given a key or id that is not in the store. * * @experimental */ export declare class MCPEventSubscriptionNotFoundError extends Error { readonly ref: { key?: string; id?: string; }; constructor(ref: { key?: string; id?: string; }); } export {};