UNPKG

mcp-adr-analysis-server

Version:

MCP server for analyzing Architectural Decision Records and project architecture

134 lines 4.1 kB
/** * Tool Catalog - Dynamic Tool Discovery System * * This module provides a centralized registry of all MCP tools with metadata * for dynamic discovery, categorization, and token-efficient listing. * * @see ADR-014: CE-MCP Architecture (Phase 3) * @see docs/IMPLEMENTATION-PLAN.md */ import { Tool } from '@modelcontextprotocol/sdk/types.js'; /** * Tool category for organization and filtering */ export type ToolCategory = 'analysis' | 'adr' | 'content-security' | 'research' | 'deployment' | 'memory' | 'file-system' | 'rules' | 'workflow' | 'utility'; /** * Tool complexity level for filtering */ export type ToolComplexity = 'simple' | 'moderate' | 'complex'; /** * Extended tool metadata for catalog */ export interface ToolMetadata { /** Tool name (unique identifier) */ name: string; /** Short description (max 100 chars) for listing */ shortDescription: string; /** Full description for detailed view */ fullDescription: string; /** Tool category for filtering */ category: ToolCategory; /** Complexity level */ complexity: ToolComplexity; /** Estimated token cost range */ tokenCost: { min: number; max: number; }; /** Whether CE-MCP directive is available */ hasCEMCPDirective: boolean; /** Related tools (by name) */ relatedTools: string[]; /** Keywords for search */ keywords: string[]; /** Whether tool requires AI execution */ requiresAI: boolean; /** Input schema (full MCP Tool inputSchema) */ inputSchema: Tool['inputSchema']; } /** * Catalog entry with computed properties */ export interface CatalogEntry extends ToolMetadata { /** Computed: is this a high-token-cost tool? */ isHighTokenCost: boolean; /** Computed: search score (populated during search) */ searchScore?: number; } /** * Search options for tool discovery */ export interface ToolSearchOptions { /** Filter by category */ category?: ToolCategory; /** Search query (matches name, description, keywords) */ query?: string; /** Filter by complexity */ complexity?: ToolComplexity; /** Only tools with CE-MCP directives */ cemcpOnly?: boolean; /** Maximum results */ limit?: number; /** Include full input schema in results */ includeSchema?: boolean; } /** * Search result with relevance scoring */ export interface ToolSearchResult { tools: CatalogEntry[]; totalCount: number; categories: Record<ToolCategory, number>; query?: string; } /** * Tool Catalog Registry * * Central registry of all tools with metadata for dynamic discovery. * Tools are organized by category and include search-friendly metadata. */ export declare const TOOL_CATALOG: Map<string, ToolMetadata>; /** * Get catalog entry with computed properties */ export declare function getCatalogEntry(toolName: string): CatalogEntry | undefined; /** * Search tools in the catalog */ export declare function searchTools(options?: ToolSearchOptions): ToolSearchResult; /** * Get all tools in a category */ export declare function getToolsByCategory(category: ToolCategory): CatalogEntry[]; /** * Get tools with CE-MCP directives */ export declare function getCEMCPTools(): CatalogEntry[]; /** * Get high token cost tools (candidates for CE-MCP migration) */ export declare function getHighTokenCostTools(): CatalogEntry[]; /** * Get catalog summary (for token-efficient listing) */ export declare function getCatalogSummary(): { totalTools: number; byCategory: Record<ToolCategory, number>; cemcpEnabled: number; highTokenCost: number; }; /** * Convert catalog entry to MCP Tool format (for ListTools) */ export declare function toMCPTool(entry: CatalogEntry | ToolMetadata): Tool; /** * Get lightweight tool listing (metadata only, no schemas) * Token savings: ~15K → ~5K for full listing */ export declare function getLightweightToolList(): Array<{ name: string; description: string; category: ToolCategory; hasCEMCPDirective: boolean; }>; //# sourceMappingURL=tool-catalog.d.ts.map