UNPKG

il2cpp-dump-analyzer-mcp

Version:

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

168 lines (167 loc) 5.59 kB
/** * @fileoverview Analyze Type Compatibility MCP Tool * * Provides comprehensive analysis of IL2CPP type compatibility including: * - Type assignability analysis and inheritance-based compatibility * - Interface implementation compatibility checking * - Generic type compatibility and constraint validation * - Conversion path analysis and implicit/explicit conversion detection * * This tool implements the type compatibility 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 compatibility analysis parameters interface */ interface AnalyzeTypeCompatibilityParams { from_type?: string; to_type?: string; include_conversion_paths?: boolean; include_implicit_conversions?: boolean; } /** * Assignability rule representation */ interface AssignabilityRule { fromType: string; toType: string; rule: string; conditions: string[]; } /** * Conversion path representation */ interface ConversionPath { fromType: string; toType: string; path: string[]; conversionType: 'implicit' | 'explicit'; } /** * Type compatibility result */ interface TypeCompatibilityResult { fromType: string; toType: string; isCompatible: boolean; compatibilityType: 'assignable' | 'convertible' | 'incompatible'; assignabilityRule?: AssignabilityRule; conversionPath?: ConversionPath; confidence: number; } /** * Compatibility matrix entry */ interface CompatibilityMatrixEntry { fromType: string; toType: string; compatibility: TypeCompatibilityResult; } /** * Type compatibility analysis result */ interface TypeCompatibilityAnalysisResult { fromType?: string; toType?: string; isCompatible?: boolean; compatibilityType?: 'assignable' | 'convertible' | 'incompatible'; assignabilityRule?: AssignabilityRule; conversionPath?: ConversionPath; confidence?: number; compatibilityMatrix?: CompatibilityMatrixEntry[]; analysisMetadata: { analysisType: 'specific' | 'matrix'; includeConversionPaths: boolean; includeImplicitConversions: boolean; timestamp: string; totalTypesAnalyzed: number; totalCompatibilityChecks: number; }; } /** * Analyze Type Compatibility MCP Tool Implementation * * Analyzes IL2CPP type compatibility and conversion relationships using vector store search. * Provides comprehensive compatibility analysis with assignability rules and conversion paths. */ export declare class AnalyzeTypeCompatibilityTool extends BaseAnalysisToolHandler<AnalyzeTypeCompatibilityParams, TypeCompatibilityAnalysisResult> { constructor(context: ToolExecutionContext); /** * Validate input parameters using Zod schema */ protected validateParameters(params: any): Promise<ValidationResult>; /** * Execute type compatibility analysis */ protected executeCore(params: AnalyzeTypeCompatibilityParams): Promise<TypeCompatibilityAnalysisResult>; /** * Analyze compatibility between two specific types */ private analyzeSpecificTypeCompatibility; /** * Analyze compatibility matrix for all types */ private analyzeTypeCompatibilityMatrix; /** * Analyze compatibility between two type documents */ private analyzeTypeCompatibility; /** * Check if fromType is assignable to toType via inheritance */ private isAssignableViaInheritance; /** * Check if fromType is assignable to toType via interface implementation */ private isAssignableViaInterface; /** * Check if types are compatible via generic type relationships */ private isGenericCompatible; /** * Find built-in conversion path between types */ private findBuiltInConversionPath; /** * Format type compatibility analysis results */ protected formatResponse(result: TypeCompatibilityAnalysisResult, warnings?: string[]): MCPResponse; } /** * Zod schema for analyze type compatibility tool parameters */ export declare const analyzeTypeCompatibilitySchema: z.ZodEffects<z.ZodObject<{ from_type: z.ZodOptional<z.ZodString>; to_type: z.ZodOptional<z.ZodString>; include_conversion_paths: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; include_implicit_conversions: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>; }, "strip", z.ZodTypeAny, { include_conversion_paths: boolean; include_implicit_conversions: boolean; from_type?: string | undefined; to_type?: string | undefined; }, { from_type?: string | undefined; to_type?: string | undefined; include_conversion_paths?: boolean | undefined; include_implicit_conversions?: boolean | undefined; }>, { include_conversion_paths: boolean; include_implicit_conversions: boolean; from_type?: string | undefined; to_type?: string | undefined; }, { from_type?: string | undefined; to_type?: string | undefined; include_conversion_paths?: boolean | undefined; include_implicit_conversions?: boolean | undefined; }>; /** * Factory function to create and register the analyze type compatibility tool */ export declare function createAnalyzeTypeCompatibilityTool(server: any, context: ToolExecutionContext): AnalyzeTypeCompatibilityTool; export {};