import { z } from "zod"; import type { ToolContext } from "./context.js"; import type { ToolDefinition } from "./registry.js"; import type { ToolResult } from "../utils/tool-result.js"; export interface DefineToolOptions { name: string; description: string; schema: S; handler: (args: z.output, ctx: ToolContext, depth?: number) => Promise; /** Error code used when handler throws non-MobileError. */ errorCode?: string; } /** * Build a `ToolDefinition` from a zod schema + typed handler. * * Responsibilities: * - Generate JSON Schema (`tool.inputSchema`) from zod — single source. * - Validate `args` at runtime; invalid input THROWS `ValidationError` * (a `MobileError` subclass) so existing tests that assert * `.rejects.toThrow(ValidationError)` keep working and so the typed * error vocabulary is consistent across hand-coded and zod-validated * tools. * - Wrap handler with `runToolSafely` so unknown thrown errors are * normalised; `MobileError` (including `ValidationError`) propagates. */ export declare function defineTool(opts: DefineToolOptions): ToolDefinition; /** Re-export `z` so callers don't need a separate import line. */ export { z }; //# sourceMappingURL=define-tool.d.ts.map