UNPKG

il2cpp-dump-analyzer-mcp

Version:

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

152 lines (151 loc) 4.77 kB
/** * @fileoverview Analyze Type Hierarchies MCP Tool * * Provides comprehensive analysis of IL2CPP type inheritance hierarchies including: * - Inheritance hierarchy analysis and interface implementations * - Multiple inheritance pattern detection * - Orphaned type identification * - Namespace-based filtering and depth-limited analysis * * This tool implements the type hierarchy 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 hierarchy analysis parameters interface */ interface AnalyzeTypeHierarchiesParams { target_type?: string; include_interfaces?: boolean; max_depth?: number; namespace_filter?: string; } /** * Type hierarchy node representation */ interface TypeHierarchyNode { typeName: string; namespace: string; typeDefIndex: number; baseType?: string; derivedTypes: TypeHierarchyNode[]; depth: number; interfaces: string[]; } /** * Inheritance hierarchy structure */ interface InheritanceHierarchy { rootType: TypeHierarchyNode; totalNodes: number; maxDepth: number; hasInterfaces: boolean; } /** * Multiple inheritance pattern detection */ interface MultipleInheritancePattern { typeName: string; namespace: string; baseClass: string; interfaces: string[]; complexityScore: number; } /** * Type hierarchy analysis result */ interface TypeHierarchyAnalysisResult { hierarchies: InheritanceHierarchy[]; multipleInheritancePatterns: MultipleInheritancePattern[]; orphanedTypes: string[]; maxDepth: number; totalHierarchies: number; analysisMetadata: { targetType?: string; includeInterfaces: boolean; maxDepthLimit: number; namespaceFilter?: string; timestamp: string; totalTypesAnalyzed: number; }; } /** * Analyze Type Hierarchies MCP Tool Implementation * * Analyzes IL2CPP type inheritance hierarchies and relationships using vector store search. * Provides comprehensive hierarchy analysis with interface support and filtering capabilities. */ export declare class AnalyzeTypeHierarchiesTool extends BaseAnalysisToolHandler<AnalyzeTypeHierarchiesParams, TypeHierarchyAnalysisResult> { constructor(context: ToolExecutionContext); /** * Validate input parameters using Zod schema */ protected validateParameters(params: any): Promise<ValidationResult>; /** * Execute type hierarchy analysis */ protected executeCore(params: AnalyzeTypeHierarchiesParams): Promise<TypeHierarchyAnalysisResult>; /** * Build inheritance hierarchies from class documents */ private buildInheritanceHierarchies; /** * Build hierarchy tree from a root type */ private buildHierarchyFromRoot; /** * Create a hierarchy node recursively */ private createHierarchyNode; /** * Detect multiple inheritance patterns (class + interfaces) */ private detectMultipleInheritancePatterns; /** * Identify orphaned types (no base class, no derived types) */ private identifyOrphanedTypes; /** * Count total nodes in hierarchy tree */ private countNodes; /** * Calculate maximum depth of hierarchy tree */ private calculateMaxDepth; /** * Check if hierarchy has interface implementations */ private hasInterfaceImplementations; /** * Format hierarchy analysis results */ protected formatResponse(result: TypeHierarchyAnalysisResult, warnings?: string[]): MCPResponse; } /** * Zod schema for analyze type hierarchies tool parameters */ export declare const analyzeTypeHierarchiesSchema: z.ZodObject<{ target_type: z.ZodOptional<z.ZodString>; include_interfaces: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; max_depth: z.ZodDefault<z.ZodOptional<z.ZodNumber>>; namespace_filter: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { include_interfaces: boolean; max_depth: number; target_type?: string | undefined; namespace_filter?: string | undefined; }, { target_type?: string | undefined; include_interfaces?: boolean | undefined; max_depth?: number | undefined; namespace_filter?: string | undefined; }>; /** * Factory function to create and register the analyze type hierarchies tool */ export declare function createAnalyzeTypeHierarchiesTool(server: any, context: ToolExecutionContext): AnalyzeTypeHierarchiesTool; export {};