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.

37 lines (36 loc) 1.55 kB
//#region src/errors.ts var MCPConnectionError = class extends Error { cause; constructor(message, cause) { super(message); this.cause = cause; this.name = "MCPConnectionError"; } }; var DuplicateToolNameError = class extends Error { toolName; constructor(toolName) { super(`Duplicate MCP tool name "${toolName}". Set a unique \`prefix\` on one of the MCP clients (createMCPClient({ transport, prefix: '...' })) to disambiguate.`); this.toolName = toolName; this.name = "DuplicateToolNameError"; } }; var MCPTaskRequiredToolError = class extends Error { toolName; constructor(toolName) { super(`MCP tool "${toolName}" declares \`execution.taskSupport: 'required'\` — it can only be invoked via the MCP SDK's experimental task-based execution (client.experimental.tasks.callToolStream()), which @tanstack/ai-mcp does not support yet. Task-required tools are excluded from tools() auto-discovery; binding one explicitly via tools([toolDefinition(...)]) is an error.`); this.toolName = toolName; this.name = "MCPTaskRequiredToolError"; } }; var MCPToolNotFoundError = class extends Error { toolName; constructor(toolName) { super(`toolDefinition name "${toolName}" was passed to mcp.tools([...]) but the MCP server exposes no tool with that name. Check the name or run mcp.tools() to list.`); this.toolName = toolName; this.name = "MCPToolNotFoundError"; } }; //#endregion export { DuplicateToolNameError, MCPConnectionError, MCPTaskRequiredToolError, MCPToolNotFoundError }; //# sourceMappingURL=errors.js.map