il2cpp-dump-analyzer-mcp
Version:
Agentic RAG system for analyzing IL2CPP dump.cs files from Unity games
149 lines (148 loc) • 4.71 kB
TypeScript
/**
* Find Cross References Tool Implementation
* Analyzes cross-references and usage patterns in IL2CPP code
*/
import { z } from 'zod';
import { BaseAnalysisToolHandler, ToolExecutionContext } from '../base-tool-handler';
import { ValidationResult } from '../../utils/parameter-validator';
/**
* Find cross references parameters interface
*/
interface FindCrossReferencesParams {
target_name: string;
target_type: 'class' | 'interface' | 'enum' | 'method' | 'property' | 'field';
reference_type?: 'usage' | 'inheritance' | 'implementation' | 'composition' | 'all';
max_results?: number;
include_nested?: boolean;
include_system_types?: boolean;
}
/**
* Cross reference interface
*/
interface CrossReference {
referencingEntity: {
name: string;
fullName: string;
namespace: string;
type: string;
location: string;
};
referenceType: string;
context: string;
lineNumber?: number;
confidence: number;
}
/**
* Cross references result interface
*/
interface CrossReferencesResult {
target: {
name: string;
fullName: string;
type: string;
found: boolean;
};
references: CrossReference[];
summary: {
totalReferences: number;
referencesByType: Record<string, number>;
topReferencingNamespaces: Array<{
namespace: string;
count: number;
}>;
analysisMetadata: {
searchedTarget: string;
searchedType: string;
referenceType: string;
maxResults: number;
includeNested: boolean;
includeSystemTypes: boolean;
timestamp: string;
};
};
}
/**
* Find Cross References Tool Handler
* Analyzes cross-references and usage patterns in IL2CPP code
*/
export declare class FindCrossReferencesToolHandler extends BaseAnalysisToolHandler<FindCrossReferencesParams, CrossReferencesResult> {
constructor(context: ToolExecutionContext);
/**
* Validate cross references parameters
*/
protected validateParameters(params: FindCrossReferencesParams): Promise<ValidationResult>;
/**
* Execute cross references analysis
*/
protected executeCore(params: FindCrossReferencesParams): Promise<CrossReferencesResult>;
/**
* Find the target entity
*/
private findTargetEntity;
/**
* Search for references to the target entity
*/
private searchForReferences;
/**
* Generate search queries for finding references
*/
private generateSearchQueries;
/**
* Create a cross reference from a search result
*/
private createCrossReference;
/**
* Determine the type of reference
*/
private determineReferenceType;
/**
* Extract context around the reference
*/
private extractContext;
/**
* Calculate confidence score for the reference
*/
private calculateConfidence;
/**
* Check if a namespace is a system type
*/
private isSystemType;
/**
* Calculate summary statistics
*/
private calculateSummary;
/**
* Create result for when target is not found
*/
private createNotFoundResult;
}
/**
* Zod schema for find cross references tool parameters
*/
export declare const findCrossReferencesSchema: z.ZodObject<{
target_name: z.ZodString;
target_type: z.ZodEnum<["class", "interface", "enum", "method", "property", "field"]>;
reference_type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["usage", "inheritance", "implementation", "composition", "all"]>>>;
max_results: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
include_nested: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
include_system_types: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, "strip", z.ZodTypeAny, {
max_results: number;
include_system_types: boolean;
reference_type: "usage" | "inheritance" | "implementation" | "composition" | "all";
include_nested: boolean;
target_name: string;
target_type: "method" | "class" | "enum" | "interface" | "field" | "property";
}, {
target_name: string;
target_type: "method" | "class" | "enum" | "interface" | "field" | "property";
max_results?: number | undefined;
include_system_types?: boolean | undefined;
reference_type?: "usage" | "inheritance" | "implementation" | "composition" | "all" | undefined;
include_nested?: boolean | undefined;
}>;
/**
* Factory function to create and register the find cross references tool
*/
export declare function createFindCrossReferencesTool(server: any, context: ToolExecutionContext): FindCrossReferencesToolHandler;
export {};