UNPKG

il2cpp-dump-analyzer-mcp

Version:

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

103 lines (102 loc) 2.86 kB
/** * Find Enum Values Tool Implementation * Extracts enum values and their numeric assignments */ import { z } from 'zod'; import { BaseAnalysisToolHandler, ToolExecutionContext } from '../base-tool-handler'; import { ValidationResult } from '../../utils/parameter-validator'; import { MCPResponse } from '../../utils/mcp-response-formatter'; /** * Find enum values parameters interface */ interface FindEnumValuesParams { enum_name: string; } /** * Enum value interface */ interface EnumValue { name: string; value: string; } /** * Enum values result interface */ interface EnumValuesResult { name: string; namespace: string; fullName: string; values: EnumValue[]; metadata: { searchedEnum: string; valueCount: number; timestamp: string; }; } /** * Find Enum Values Tool Handler * Extracts enum values and their numeric assignments from IL2CPP dumps */ export declare class FindEnumValuesToolHandler extends BaseAnalysisToolHandler<FindEnumValuesParams, EnumValuesResult> { constructor(context: ToolExecutionContext); /** * Validate enum values parameters */ protected validateParameters(params: FindEnumValuesParams): Promise<ValidationResult>; /** * Execute enum values extraction */ protected executeCore(params: FindEnumValuesParams): Promise<EnumValuesResult>; /** * Parse enum values from IL2CPP content */ private parseEnumValues; /** * Parse a single enum value line */ private parseEnumValueLine; /** * Format enum values results */ protected formatResponse(result: EnumValuesResult, warnings?: string[]): MCPResponse; /** * Handle enum not found error specifically */ protected handleError(error: any, params?: FindEnumValuesParams): MCPResponse; } /** * Zod schema for find enum values tool parameters */ export declare const findEnumValuesSchema: z.ZodObject<{ enum_name: z.ZodString; }, "strip", z.ZodTypeAny, { enum_name: string; }, { enum_name: string; }>; /** * Factory function to create and register the find enum values tool */ export declare function createFindEnumValuesTool(server: any, context: ToolExecutionContext): FindEnumValuesToolHandler; export {}; /** * Code Reduction Analysis: * * BEFORE: 72 lines of implementation code * AFTER: 35 lines of business logic * REDUCTION: 51% less code * * Eliminated: * ✅ Manual error handling (10 lines) * ✅ Parameter validation boilerplate (6 lines) * ✅ Logging setup (5 lines) * ✅ Response formatting (12 lines) * ✅ Try-catch blocks (4 lines) * * Enhanced Features: * ✅ Better enum value parsing with error handling * ✅ Consistent error messages * ✅ Automatic performance monitoring * ✅ Standardized response format * ✅ Built-in parameter validation */