import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import type { z } from 'zod'; type InferShape = z.infer>; /** * Register an MCP tool with a Zod input schema + a handler that returns any * JSON-serializable result. The helper: * - wraps the result in the MCP `content` format * - catches exceptions and returns `isError: true` responses * - JSON-stringifies objects (and leaves strings untouched) * - enforces a per-call timeout (see `OBSIDIAN_BRAIN_TOOL_TIMEOUT_MS`) so a * stuck background op (embedder, file lock, index lookup) surfaces as a * diagnosable error instead of a silent hang * * Use `z.record(z.string(), z.unknown())` for open-ended map params — single-arg * `z.record` breaks tools/list under Zod v4 ("_zod" error). * * v1.5.0 — `next_actions` envelope: handlers may opt in by returning * `{ data, context: { state, next_actions } }` (see `./hints.ts`). The shape * passes through JSON.stringify unchanged; clients parsing the JSON see * `context.next_actions` and can route the agent's next call without asking. * Non-opting handlers keep returning bare values — backwards compat preserved. */ export declare function registerTool(server: McpServer, name: string, description: string, schema: Shape, handler: (args: InferShape) => Promise): void; export {};