@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
126 lines (125 loc) • 3.77 kB
TypeScript
/**
* Enhanced Tool Discovery Service
*
* Extends the base tool discovery service with additional features:
* - Tool annotation support
* - Multi-server coordination
* - Advanced filtering and search
* - Tool versioning and compatibility checking
*
* @module mcp/enhancedToolDiscovery
* @since 8.39.0
*/
import { EventEmitter } from "events";
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
import type { MCPServerInfo, ToolDiscoveryResult, UnifiedTool, CompatibilityCheckResult, EnhancedToolInfo, ToolSearchCriteria, ToolSearchResult, MCPToolAnnotations } from "../types/index.js";
import { MultiServerManager } from "./multiServerManager.js";
/**
* Enhanced Tool Discovery Service
*
* Provides advanced tool discovery features including annotation support,
* multi-server coordination, and powerful search capabilities.
*
* @example
* ```typescript
* const discovery = new EnhancedToolDiscovery();
*
* // Discover tools with annotation inference
* const result = await discovery.discoverToolsWithAnnotations(
* "github-server",
* client,
* );
*
* // Search for tools
* const searchResult = await discovery.searchTools({
* category: "file-system",
* annotations: { readOnlyHint: true },
* limit: 10,
* });
*
* // Get tools by safety level
* const safeTools = discovery.getToolsBySafetyLevel("safe");
* ```
*/
export declare class EnhancedToolDiscovery extends EventEmitter {
private toolRegistry;
private serverToolsMap;
private multiServerManager;
private discoveryInProgress;
constructor(multiServerManager?: MultiServerManager);
/**
* Discover tools with automatic annotation inference
*/
discoverToolsWithAnnotations(serverId: string, client: Client, timeout?: number): Promise<ToolDiscoveryResult>;
/**
* Create enhanced tool info with annotations
*/
private createEnhancedToolInfo;
/**
* Infer category from tool definition
*/
private inferCategory;
/**
* Search tools with advanced criteria
*/
searchTools(criteria: ToolSearchCriteria): ToolSearchResult;
/**
* Get tools by safety level
*/
getToolsBySafetyLevel(level: "safe" | "moderate" | "dangerous"): EnhancedToolInfo[];
/**
* Get tools requiring confirmation
*/
getToolsRequiringConfirmation(): EnhancedToolInfo[];
/**
* Get read-only tools
*/
getReadOnlyTools(): EnhancedToolInfo[];
/**
* Get unified tools from all servers
*/
getUnifiedTools(): UnifiedTool[];
/**
* Register a server with the multi-server manager
*/
registerServer(server: MCPServerInfo): void;
/**
* Update tool annotations
*/
updateToolAnnotations(serverId: string, toolName: string, annotations: Partial<MCPToolAnnotations>): boolean;
/**
* Check tool compatibility
*/
checkCompatibility(toolName: string, serverId: string, targetVersion?: string): CompatibilityCheckResult;
/**
* Get tool by key
*/
getTool(serverId: string, toolName: string): EnhancedToolInfo | undefined;
/**
* Get all tools
*/
getAllTools(): EnhancedToolInfo[];
/**
* Get tools for a server
*/
getServerTools(serverId: string): EnhancedToolInfo[];
/**
* Clear tools for a server
*/
clearServerTools(serverId: string): void;
/**
* Create tool key
*/
private createToolKey;
/**
* Get statistics
*/
getStatistics(): {
totalTools: number;
toolsByServer: Record<string, number>;
toolsByCategory: Record<string, number>;
toolsBySafetyLevel: Record<string, number>;
toolsWithAnnotations: number;
deprecatedTools: number;
};
}