/**
 * NeuroLink MCP Tool Registry System
 * Central registry for managing MCP servers and tools with execution capabilities
 * Supports tool discovery, registration, and orchestrated execution
 */
import type { NeuroLinkMCPServer, NeuroLinkMCPTool, NeuroLinkExecutionContext, ToolResult } from './factory.js';
import { ContextManager } from './context-manager.js';
/**
 * Tool registration information
 */
export interface ToolRegistration {
    tool: NeuroLinkMCPTool;
    serverId: string;
    serverTitle: string;
    serverCategory?: string;
    qualifiedName: string;
    simpleName: string;
    registeredAt: number;
}
/**
 * Tool execution options
 */
export interface ToolExecutionOptions {
    validateInput?: boolean;
    validatePermissions?: boolean;
    trackMetrics?: boolean;
    timeoutMs?: number;
}
/**
 * Tool search criteria
 */
export interface ToolSearchCriteria {
    name?: string;
    category?: string;
    serverId?: string;
    serverCategory?: string;
    permissions?: string[];
    implemented?: boolean;
}
/**
 * Registry statistics
 */
export interface RegistryStats {
    totalServers: number;
    totalTools: number;
    toolsByCategory: Record<string, number>;
    serversByCategory: Record<string, number>;
    executionCount: number;
    averageExecutionTime: number;
    errorRate: number;
}
/**
 * Central MCP Tool Registry
 * Manages all MCP servers and their tools with advanced execution capabilities
 */
export declare class MCPToolRegistry {
    private servers;
    private tools;
    private contextManager;
    private executionCount;
    private totalExecutionTime;
    private errorCount;
    constructor(contextManager?: ContextManager);
    /**
     * Register an MCP server and all its tools
     *
     * @param server MCP server to register
     * @throws Error if server ID already exists
     */
    registerServer(server: NeuroLinkMCPServer): Promise<void>;
    /**
     * Register a single tool from a server
     *
     * @param server Source server
     * @param toolName Tool name
     * @param tool Tool implementation
     */
    private registerToolFromServer;
    /**
     * Execute a tool with comprehensive error handling and context tracking
     *
     * @param toolName Tool name (simple or qualified)
     * @param params Tool parameters
     * @param context Execution context
     * @param options Execution options
     * @returns Tool execution result
     */
    executeTool(toolName: string, params: any, context: NeuroLinkExecutionContext, options?: ToolExecutionOptions): Promise<ToolResult>;
    /**
     * List all available tools with optional filtering
     *
     * @param criteria Search criteria for filtering tools
     * @returns Array of tool information
     */
    listTools(criteria?: ToolSearchCriteria): {
        name: string;
        qualifiedName: string;
        description: string;
        server: string;
        serverTitle: string;
        category?: string;
        serverCategory?: string;
        permissions?: string[];
        isImplemented?: boolean;
    }[];
    /**
     * Get detailed information about a specific tool
     *
     * @param toolName Tool name (simple or qualified)
     * @returns Detailed tool information or undefined if not found
     */
    getToolInfo(toolName: string): {
        tool: NeuroLinkMCPTool;
        server: NeuroLinkMCPServer;
        registration: ToolRegistration;
    } | undefined;
    /**
     * Get registry statistics
     *
     * @returns Comprehensive registry statistics
     */
    getStats(): RegistryStats;
    /**
     * Unregister a server and all its tools
     *
     * @param serverId Server ID to unregister
     * @returns Whether server was found and removed
     */
    unregisterServer(serverId: string): boolean;
    /**
     * Clear all servers and tools
     */
    clear(): void;
    /**
     * Create timeout promise wrapper
     *
     * @param promise Promise to wrap
     * @param timeoutMs Timeout in milliseconds
     * @param timeoutMessage Error message for timeout
     * @returns Promise that rejects on timeout
     */
    private createTimeoutPromise;
    /**
     * Update execution metrics
     *
     * @param executionTime Execution time in milliseconds
     * @param success Whether execution was successful
     */
    private updateExecutionMetrics;
}
/**
 * Default registry instance
 * Can be used across the application for consistent tool management
 */
export declare const defaultToolRegistry: MCPToolRegistry;
/**
 * Utility function to register server with default registry
 *
 * @param server MCP server to register
 */
export declare function registerServer(server: NeuroLinkMCPServer): Promise<void>;
/**
 * Utility function to execute tool with default registry
 *
 * @param toolName Tool name to execute
 * @param params Tool parameters
 * @param context Execution context
 * @param options Execution options
 * @returns Tool execution result
 */
export declare function executeTool(toolName: string, params: any, context: NeuroLinkExecutionContext, options?: ToolExecutionOptions): Promise<ToolResult>;
/**
 * Utility function to list tools with default registry
 *
 * @param criteria Search criteria
 * @returns Array of tool information
 */
export declare function listTools(criteria?: ToolSearchCriteria): {
    name: string;
    qualifiedName: string;
    description: string;
    server: string;
    serverTitle: string;
    category?: string;
    serverCategory?: string;
    permissions?: string[];
    isImplemented?: boolean;
}[];
