/** * Cross-Tool Dependency Analyzer. * * Analyzes tool descriptions and schemas to identify dependencies * between tools, enabling better testing strategies and documentation. * * Detection strategies: * 1. Description analysis - mentions of other tool names * 2. Parameter name matching - params that match output field names * 3. Resource reference patterns - common ID/token patterns * 4. Workflow step order - sequence implied by tool naming */ import type { MCPTool } from '../transport/types.js'; /** * A dependency edge between two tools. */ export interface DependencyEdge { /** Source tool that provides data */ from: string; /** Target tool that consumes data */ to: string; /** Type of dependency relationship */ type: DependencyType; /** Confidence level of this dependency detection (0-1) */ confidence: number; /** Description of the relationship */ description: string; /** Which field/parameter creates the dependency */ field?: string; } /** * Types of dependencies between tools. */ export type DependencyType = 'mention' | 'output_input' | 'resource_ref' | 'sequence' | 'shared_resource'; /** * Full dependency graph for a set of tools. */ export interface DependencyGraph { /** All dependency edges */ edges: DependencyEdge[]; /** Tools grouped by layer (no dependencies -> most dependencies) */ layers: string[][]; /** Tools with no dependencies (entry points) */ entryPoints: string[]; /** Tools with no dependents (terminal operations) */ terminalPoints: string[]; /** Detected cycles (if any) */ cycles: string[][]; } /** * Statistics about the dependency graph. */ export interface DependencyStats { /** Total number of edges */ totalEdges: number; /** Edges by type */ byType: Record; /** Average dependencies per tool */ avgDependencies: number; /** Maximum dependency chain length */ maxChainLength: number; /** Tools with most dependencies */ mostDependent: Array<{ tool: string; count: number; }>; /** Tools most depended upon */ mostDependedUpon: Array<{ tool: string; count: number; }>; } /** * Analyze dependencies between tools. */ export declare function analyzeDependencies(tools: MCPTool[]): DependencyGraph; /** * Calculate statistics about the dependency graph. */ export declare function calculateDependencyStats(graph: DependencyGraph): DependencyStats; /** * Generate a Mermaid diagram for the dependency graph. */ export declare function generateDependencyMermaid(graph: DependencyGraph): string; /** * Generate markdown documentation for dependencies. */ export declare function generateDependencyMarkdown(graph: DependencyGraph, stats: DependencyStats): string; //# sourceMappingURL=dependency-analyzer.d.ts.map