/** * Registry + dispatcher for `AgentTool` instances (v0.11). * * const registry = new ToolRegistry([bookAppointment, cancelAppointment]); * const descriptors = registry.describe(); // hand to AgentLLM * const result = await registry.execute(toolCall, ctx); // string result * * Enforces name uniqueness at construction time so overlapping tools fail * loudly instead of silently shadowing. `execute` validates the tool call's * arguments against the Zod schema BEFORE invoking the tool body — a Zod * failure is returned as a stringified error (the LLM reads it and re-asks * the user). Only genuine invariant violations (unknown tool, thrown * exception inside the tool body) are surfaced as thrown errors. */ import type { AgentTool, AgentToolDescriptor, ToolCall } from './types.js'; export interface ToolExecuteResult { /** Correlates back to the assistant's `toolCalls[i].id`. */ toolCallId: string; toolName: string; /** Serialized output (JSON.stringify of the tool's return value, or an error message). */ content: string; /** True when execution succeeded; false when Zod validation failed or the tool body threw. */ ok: boolean; } type AnyToolFor = AgentTool; export declare class ToolRegistry { private readonly tools; constructor(tools: ReadonlyArray>); /** Number of registered tools. */ get size(): number; /** True if the tool is registered. */ has(name: string): boolean; /** Provider-neutral descriptors ready for `AgentLLM.generate({ tools })`. */ describe(): AgentToolDescriptor[]; /** * Validate + dispatch one tool call. Never throws for user-content * problems (bad arguments, tool returns error string) — the LLM reads * the result and continues. Throws only for programming errors * (unknown tool, tool body itself throws unexpectedly). */ execute(call: ToolCall, ctx: TContext): Promise; } export {}; //# sourceMappingURL=tool_registry.d.ts.map