import { MobileError } from "../errors.js"; import { type ToolResult } from "./tool-result.js"; export type ToolHandler, TCtx = unknown> = (args: TArgs, ctx: TCtx) => Promise; /** * Wrap a tool handler so unknown thrown errors become a structured error result. * * MobileError is re-thrown unchanged — the MCP layer + existing tests rely on * typed errors propagating with their code intact. Only non-MobileError throws * (TypeError, ReferenceError, ad-hoc `throw new Error(...)`, etc.) are converted * to `errorResult` with the fallback code, ensuring the MCP boundary never sees * an uncaught exception. */ export declare function runToolSafely(handler: ToolHandler, fallbackCode?: string): ToolHandler; export declare const toMobileError: (err: unknown, code?: string) => MobileError; //# sourceMappingURL=run-tool-safely.d.ts.map