import type { Tool } from '../../../shared/models/tool.model.js'; /** * Manages tool caching for MCP connections at both composite key and server name levels. * * This class encapsulates all tool cache operations, providing both composite key-level * and server name-level caching for efficient tool lookup while maintaining data * consistency across multiple instances of the same server. */ export declare class ToolCache { private toolCache; private serverNameToolCache; private nameToCompositeKeyMap; /** * Sets the name-to-composite-key mapping for server name resolution. * * @param serverName - The server name * @param compositeKey - The corresponding composite key */ setNameMapping(serverName: string, compositeKey: string): void; /** * Removes the name-to-composite-key mapping for a server. * * @param serverName - The server name to remove */ removeNameMapping(serverName: string): void; /** * Removes name mapping by composite key. * * @param compositeKey - The composite key to remove */ removeNameMappingById(compositeKey: string): void; /** * Gets the composite key for a given server name. * * @param name - The server name * @returns The composite key or undefined if not found */ getCompositeKeyByName(name: string): string | undefined; /** * Gets the server name for a given composite key. * * @param compositeKey - The composite key * @returns The server name or 'unknown' if not found */ getServerNameById(compositeKey: string): string; /** * Sets tools for a specific server instance and updates both caches. * * @param serverName - The server name * @param serverIndex - The instance index * @param tools - The tools to cache */ setTools(serverName: string, serverIndex: number, tools: Tool[]): void; /** * Gets tools for a specific server instance. * * @param serverName - The server name * @param serverIndex - The instance index * @returns Array of tools, empty if none */ getTools(serverName: string, serverIndex: number): Tool[]; /** * Gets tools by server name from the server name-level cache. * * @param serverName - The server name * @returns Array of tools, empty if none */ getToolsByServerName(serverName: string): Tool[]; /** * Gets a specific tool by name from the server name-level cache. * * @param serverName - The server name * @param toolName - The tool name to find * @returns The tool object or undefined if not found */ getTool(serverName: string, toolName: string): Tool | undefined; /** * Gets all tools from all connected server instances. * * @returns Array of all tools from all servers */ getAllTools(): Tool[]; /** * Gets all tools from the server name-level cache. * * @returns Array of all tools aggregated by server name */ getAllToolsByServerName(): Tool[]; /** * Gets all tool cache entries. * * @returns Array of [compositeKey, tools] tuples */ getToolCacheEntries(): [string, Tool[]][]; /** * Returns an iterator over the tool cache entries for backward compatibility. * This mimics the Map.entries() method signature. * * @returns Iterator of [compositeKey, tools] tuples * @deprecated Use getToolCacheEntries() instead */ entries(): IterableIterator<[string, Tool[]]>; /** * Clears tools for a specific server and updates both caches. * * @param serverName - The server name * @param serverIndex - The instance index */ clearTools(serverName: string, serverIndex: number): void; /** * Updates the server name-level cache for a specific server. * This aggregates tools from all instances of the same server name. * * @param serverName - The server name to update */ private updateServerNameCache; /** * Backward compatibility: direct access to the underlying toolCache Map. * This is maintained for backward compatibility with code that accesses * mcpConnectionManager.toolCache directly. */ get internalToolCache(): Map; } //# sourceMappingURL=tool-cache.d.ts.map