/** * ToolRegistry — Single source of truth for MCP tool definitions. * * Each tool declares its name, MCP description, and a set of actions * (action name, description, parameters, handler). The registry generates * MCP Tool[] schemas for ListToolsRequestSchema and handles dispatch for * CallToolRequestSchema with structured errors. * * In Specs 04/07, `getCLISubcommands()` will extend the same definitions * to CLI subcommand wiring so tool surfaces are never written twice. */ export interface ToolParameter { name: string; type: 'string' | 'number' | 'boolean' | 'object' | 'array'; required: boolean; description: string; default?: unknown; enum?: string[]; } export interface ActionDefinition { name: string; description: string; parameters: ToolParameter[]; handler: (args: Record, signal?: AbortSignal) => Promise; } export interface ToolDefinition { name: string; description: string; actions: ActionDefinition[]; } export interface StructuredError { success: false; error: string; validActions?: Array<{ action: string; description: string; parameters: ToolParameter[]; }>; } export interface MCPToolSchema { name: string; description: string; inputSchema: { type: 'object'; properties: Record; required: string[]; }; } export declare class ToolRegistry { private tools; register(tool: ToolDefinition): void; getTool(name: string): ToolDefinition | undefined; getAllTools(): ToolDefinition[]; /** * Build a combined input schema for a tool: the `action` enum parameter * plus all action-specific parameters. The action enum lists every action * name so agents see the full surface in the schema. */ buildToolInputSchema(tool: ToolDefinition): { properties: Record; required: string[]; }; getMCPToolSchemas(): MCPToolSchema[]; /** * Dispatch a tool call. Returns the handler result on success, or a * StructuredError when the tool name or action is invalid. */ dispatch(toolName: string, action: string | undefined, args: Record, signal?: AbortSignal): Promise; /** * Placeholder: generates CLI subcommand definitions from the same * tool definitions. Used in Specs 04/07 for `code-audit changed` etc. */ getCLISubcommands(): Array<{ name: string; description: string; actions: string[]; }>; } //# sourceMappingURL=tool-registry.d.ts.map