/** * Tool Registry for managing MCP tool definitions and handlers */ import type { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { Tool } from "@modelcontextprotocol/sdk/types.js"; import { ToolDefinition, ToolHandler } from "./types/ToolTypes.js"; import type { IndexConfiguration } from "../portfolio/config/IndexConfig.js"; import type { BuildInfoService } from "../services/BuildInfoService.js"; import type { PersonaHandler } from './PersonaHandler.js'; import type { ElementCRUDHandler } from './ElementCRUDHandler.js'; import type { CollectionHandler } from './CollectionHandler.js'; import type { PortfolioHandler } from './PortfolioHandler.js'; import type { GitHubAuthHandler } from './GitHubAuthHandler.js'; import type { ConfigHandler } from './ConfigHandler.js'; import type { SyncHandler } from './SyncHandlerV2.js'; import type { EnhancedIndexHandler } from './EnhancedIndexHandler.js'; import type { MCPAQLHandler } from './mcp-aql/MCPAQLHandler.js'; export type { ToolDefinition, ToolHandler }; export declare class ToolRegistry { private tools; constructor(_server: Server); /** * Register a tool with its definition and handler */ register(tool: ToolDefinition, handler?: ToolHandler): void; /** * Register multiple tools at once */ registerMany(tools: Array<{ tool: ToolDefinition; handler?: ToolHandler; }>): void; registerPersonaTools(handler: PersonaHandler): void; registerElementTools(handler: ElementCRUDHandler): void; registerCollectionTools(handler: CollectionHandler): void; registerPortfolioTools(handler: PortfolioHandler): void; registerAuthTools(handler: GitHubAuthHandler): void; registerConfigTools(handler: { handleConfigOperation: ConfigHandler['handleConfigOperation']; handleSyncOperation: SyncHandler['handleSyncOperation']; }): void; registerEnhancedIndexTools(handler: EnhancedIndexHandler, config: IndexConfiguration): void; registerBuildInfoTools(buildInfoService: BuildInfoService): void; registerMCPAQLTools(handler: MCPAQLHandler): void; /** * Get all registered tools (for ListToolsRequest) */ getAllTools(): Tool[]; /** * Get a specific tool handler */ getHandler(name: string): ToolHandler | undefined; /** * Check if a tool exists */ has(name: string): boolean; /** * Get the count of registered tools */ getToolCount(): number; /** * Estimate the token count for all registered tools. * * This provides an approximate token count based on the JSON representation * of all tool definitions (name, description, inputSchema, annotations). * * Token estimation uses ~4 characters per token, which is appropriate for * JSON/structured content. This matches the ratio used by tokenizers like * cl100k_base for structured text. * * @returns Estimated total token count for all registered tools */ getToolTokenEstimate(): number; /** * Get detailed token statistics for registered tools. * Returns individual tool token estimates plus total. */ getToolTokenStats(): { tools: Array<{ name: string; tokens: number; }>; total: number; count: number; }; } //# sourceMappingURL=ToolRegistry.d.ts.map