import type { ToolAnnotations } from "@modelcontextprotocol/sdk/types.js"; import type { DB } from "../db/index.js"; import type { z } from "zod"; import type { McpServerCompat } from "../types.js"; /** * Options for registering a database-backed tool. * * @template TInput - Zod schema for input validation * @template TOutput - Zod schema for output validation */ export interface RegisterDbToolOptions { /** Tool name (snake_case) */ name: string; /** Human-readable title for the tool */ title: string; /** Description of what the tool does */ description: string; /** Zod schema for validating input parameters */ inputSchema: TInput; /** Zod schema for describing output format */ outputSchema: TOutput | z.ZodString; /** Whether to output raw plaintext instead of JSON */ plaintextOutput?: boolean; /** Tool behavior annotations (readOnlyHint, destructiveHint, etc.) */ annotations?: ToolAnnotations; /** Handler function that processes the request */ handler: (db: DB, params: z.infer) => Promise>; } /** * Register a tool that wraps a database operation. * * This utility standardizes tool registration by: * - Automatically serializing handler output to JSON * - Enforcing input/output schema type safety * - Providing consistent error handling patterns * * @example * ```ts * registerDbTool(server, db, { * name: "search_facts", * title: "Search Facts", * description: "Search for facts by tags or content", * inputSchema: factSearchInput, * outputSchema: factSearchOutput, * annotations: { readOnlyHint: true }, * handler: searchFacts, * }); * ``` */ export declare const registerDbTool: (server: McpServerCompat, db: DB, options: RegisterDbToolOptions) => import("@modelcontextprotocol/sdk/server/mcp.js").RegisteredTool; //# sourceMappingURL=utils.d.ts.map