/** * MCP Tools Registry - Manages all MCP tool integrations * * Handles registration, discovery, and execution of MCP tools for the AI integration system. * Provides a unified interface for all MCP tool interactions. */ import { EventEmitter } from 'eventemitter3'; import { MCPToolsConfig, MCPTool, Task, OperationResult } from '../types'; /** * Raised when a requested tool ID has no entry in the registry. */ export declare class ToolNotFoundError extends Error { constructor(toolId: string); } /** * Raised when a tool handler exists but throws during execution. */ export declare class ToolExecutionError extends Error { constructor(toolId: string, operation: string, cause: Error); } export declare class MCPToolsRegistry extends EventEmitter { private config; private tools; private toolHandlers; private readonly AVAILABLE_TOOLS; constructor(config: MCPToolsConfig); initialize(): Promise; private loadToolConfigurations; private mergeToolConfigurations; private initializeToolHandlers; private discoverTools; private registerTool; private setupAutoDiscovery; private discoverNewTools; private discoverServerTools; /** * Execute MCP tool operation. * * Throws `ToolNotFoundError` when the tool ID is not registered so callers * can distinguish "tool does not exist" from ordinary execution failures. * All other errors are caught, wrapped, and returned as a failed * `OperationResult` to keep the public API non-throwing for runtime errors. */ executeTool(toolId: string, operation: string, params: any): Promise; /** * Select optimal tools for a task */ selectToolsForTask(task: Task): Promise; private calculateToolScore; private isToolAlignedWithTask; /** * Get available tools by category */ getToolsByCategory(category: string): MCPTool[]; /** * Get tools by capabilities */ getToolsByCapabilities(capabilities: string[]): MCPTool[]; /** * Get comprehensive metrics */ getMetrics(): Promise; /** * Register a callable handler function for a specific tool ID. * * The handler receives `(operation: string, params: any)` and must return a * promise resolving to the operation result. Calling this after initialization * will override the default handler that was assigned during * `initializeToolHandlers()`. * * @param toolId - The tool identifier as declared in AVAILABLE_TOOLS. * @param handler - An object or function with an `execute` method, or any * object that conforms to `{ execute(op, params): Promise }`. */ registerToolHandler(toolId: string, handler: { execute(operation: string, params: any): Promise; }): void; shutdown(): Promise; } //# sourceMappingURL=MCPToolsRegistry.d.ts.map