UNPKG

mcp-adr-analysis-server

Version:

MCP server for analyzing Architectural Decision Records and project architecture

98 lines 2.79 kB
/** * Tool Dispatcher - Dynamic Tool Discovery and Routing * * This module provides dynamic tool discovery via the search_tools meta-tool * and enables catalog-based tool listing for token-efficient responses. * * @see ADR-014: CE-MCP Architecture (Phase 3) * @see docs/IMPLEMENTATION-PLAN.md */ import { Tool } from '@modelcontextprotocol/sdk/types.js'; import { ToolCategory } from './tool-catalog.js'; /** * Arguments for search_tools meta-tool */ export interface SearchToolsArgs { /** Optional category filter */ category?: ToolCategory; /** Optional search query */ query?: string; /** Optional complexity filter */ complexity?: 'simple' | 'moderate' | 'complex'; /** Only return tools with CE-MCP directives */ cemcpOnly?: boolean; /** Include full input schemas (increases token count) */ includeSchema?: boolean; /** Maximum results to return */ limit?: number; } /** * Result from search_tools */ export interface SearchToolsResult { success: boolean; tools: Array<{ name: string; description: string; category: ToolCategory; complexity: string; hasCEMCPDirective: boolean; tokenCost?: { min: number; max: number; }; inputSchema?: Tool['inputSchema']; }>; summary: { totalFound: number; totalInCatalog: number; byCategory: Record<string, number>; }; query?: string; } /** * Execute search_tools meta-tool * * This tool enables dynamic discovery of available tools without loading * all tool schemas upfront, significantly reducing token usage. */ export declare function executeSearchTools(args: SearchToolsArgs): SearchToolsResult; /** * Get the search_tools tool definition for MCP */ export declare function getSearchToolsDefinition(): Tool; /** * Get lightweight tool listing for MCP ListTools * * Returns tools with minimal metadata for token-efficient listing. * Clients can use search_tools to get full schemas when needed. */ export declare function getToolListForMCP(options: { mode?: 'full' | 'lightweight' | 'summary'; }): { tools: Tool[]; }; /** * Get tool categories with counts */ export declare function getToolCategories(): Record<ToolCategory, { count: number; description: string; }>; /** * Get CE-MCP enabled tools summary */ export declare function getCEMCPSummary(): { enabled: string[]; highTokenCost: string[]; totalTokenSavings: string; }; /** * Check if a tool exists in the catalog */ export declare function toolExists(toolName: string): boolean; /** * Get tool metadata by name */ export declare function getToolMetadata(toolName: string): Tool | undefined; //# sourceMappingURL=tool-dispatcher.d.ts.map