UNPKG

il2cpp-dump-analyzer-mcp

Version:

Agentic RAG system for analyzing IL2CPP dump.cs files from Unity games

169 lines (168 loc) 5.07 kB
/** * @fileoverview Analyze Type Dependencies MCP Tool * * Provides comprehensive analysis of IL2CPP type dependency graphs including: * - Type dependency graph creation and visualization * - Circular reference detection and analysis * - Dependency clustering and relationship mapping * - Dependency metrics and complexity analysis * * This tool implements the type dependency analysis functionality from TypeAnalyzer * as an MCP tool following established patterns and TFD methodology. */ import { z } from 'zod'; import { BaseAnalysisToolHandler, ToolExecutionContext } from '../base-tool-handler'; import { ValidationResult } from '../../utils/parameter-validator'; import { MCPResponse } from '../../utils/mcp-response-formatter'; /** * Type dependency analysis parameters interface */ interface AnalyzeTypeDependenciesParams { target_type?: string; include_circular_detection?: boolean; max_depth?: number; include_system_types?: boolean; } /** * Dependency node representation */ interface DependencyNode { typeName: string; namespace: string; typeDefIndex: number; dependencies: string[]; dependents: string[]; dependencyCount: number; dependentCount: number; centrality: number; } /** * Dependency edge representation */ interface DependencyEdge { fromType: string; toType: string; relationshipType: string; strength: number; } /** * Type cluster representation */ interface TypeCluster { clusterId: string; types: string[]; isCircular: boolean; clusterSize: number; internalEdges: number; externalEdges: number; } /** * Dependency metrics */ interface DependencyMetrics { totalNodes: number; totalEdges: number; averageDependencies: number; maxDependencies: number; circularDependencies: number; maxDepth: number; clusterCount: number; } /** * Type dependency analysis result */ interface TypeDependencyAnalysisResult { nodes: DependencyNode[]; edges: DependencyEdge[]; clusters: TypeCluster[]; metrics: DependencyMetrics; analysisMetadata: { targetType?: string; includeCircularDetection: boolean; maxDepthLimit: number; includeSystemTypes: boolean; timestamp: string; totalTypesAnalyzed: number; }; } /** * Analyze Type Dependencies MCP Tool Implementation * * Analyzes IL2CPP type dependency graphs and relationships using vector store search. * Provides comprehensive dependency analysis with circular detection and clustering. */ export declare class AnalyzeTypeDependenciesTool extends BaseAnalysisToolHandler<AnalyzeTypeDependenciesParams, TypeDependencyAnalysisResult> { constructor(context: ToolExecutionContext); /** * Validate input parameters using Zod schema */ protected validateParameters(params: any): Promise<ValidationResult>; /** * Execute type dependency analysis */ protected executeCore(params: AnalyzeTypeDependenciesParams): Promise<TypeDependencyAnalysisResult>; /** * Build dependency graph from type documents */ private buildDependencyGraph; /** * Create a dependency node from a type document */ private createDependencyNode; /** * Check if a type is a system type */ private isSystemType; /** * Get relationship type between types */ private getRelationshipType; /** * Create type clusters and detect circular dependencies */ private createTypeClusters; /** * Create a cluster object with metrics */ private createCluster; /** * Detect circular dependencies within a cluster using DFS */ private detectCircularDependency; /** * Calculate dependency metrics */ private calculateDependencyMetrics; /** * Calculate maximum dependency depth using BFS */ private calculateMaxDependencyDepth; /** * Format dependency analysis results */ protected formatResponse(result: TypeDependencyAnalysisResult, warnings?: string[]): MCPResponse; } /** * Zod schema for analyze type dependencies tool parameters */ export declare const analyzeTypeDependenciesSchema: z.ZodObject<{ target_type: z.ZodOptional<z.ZodString>; include_circular_detection: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; max_depth: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; include_system_types: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; }, "strip", z.ZodTypeAny, { include_system_types: boolean; max_depth: number; include_circular_detection: boolean; target_type?: string | undefined; }, { include_system_types?: boolean | undefined; target_type?: string | undefined; max_depth?: number | undefined; include_circular_detection?: boolean | undefined; }>; /** * Factory function to create and register the analyze type dependencies tool */ export declare function createAnalyzeTypeDependenciesTool(server: any, context: ToolExecutionContext): AnalyzeTypeDependenciesTool; export {};