il2cpp-dump-analyzer-mcp
Version:
Agentic RAG system for analyzing IL2CPP dump.cs files from Unity games
207 lines (206 loc) • 5.7 kB
TypeScript
/**
* @fileoverview MCP Response Synthesis and Aggregation Engine
* Provides intelligent aggregation and synthesis of MCP tool results with
* context-aware response formatting and quality assessment
*/
import { ToolExecutionContext } from '../mcp/base-tool-handler';
import { ResponseSynthesizerConfig, SynthesizedResponse, AggregatedResponse, WorkflowSynthesisResult, ResponseQualityAssessment, SynthesisStatistics, ToolExecutionResult, WorkflowExecution } from './types';
/**
* MCP Response Synthesis and Aggregation Engine
* Intelligently combines and synthesizes results from multiple MCP tools
*/
export declare class MCPResponseSynthesizer {
private context;
private config;
private cache;
private statistics;
constructor(context: ToolExecutionContext, config?: Partial<ResponseSynthesizerConfig>);
/**
* Synthesize a single tool result into a coherent response
*/
synthesizeSingleResult(toolResult: ToolExecutionResult, toolName: string, context?: string): Promise<SynthesizedResponse>;
/**
* Aggregate results from multiple tools into a unified response
*/
aggregateMultipleResults(toolResults: ToolExecutionResult[], toolNames: string[], originalRequest: string): Promise<AggregatedResponse>;
/**
* Synthesize complete workflow execution results
*/
synthesizeWorkflowResults(workflowExecution: WorkflowExecution, originalRequest: string): Promise<WorkflowSynthesisResult>;
/**
* Assess the quality of a tool result
*/
assessResultQuality(toolResult: ToolExecutionResult, context: string): ResponseQualityAssessment;
/**
* Get cache statistics
*/
getCacheStats(): SynthesisStatistics['cacheStats'];
/**
* Get synthesis statistics
*/
getStatistics(): SynthesisStatistics;
/**
* Clear cache and reset statistics
*/
reset(): void;
/**
* Initialize synthesis statistics
*/
private initializeStatistics;
/**
* Validate tool result structure
*/
private validateToolResult;
/**
* Generate cache key for results
*/
private generateCacheKey;
/**
* Get cached response if available and valid
*/
private getCachedResponse;
/**
* Cache a synthesized response
*/
private cacheResponse;
/**
* Evict oldest cache entry
*/
private evictOldestCacheEntry;
/**
* Extract semantic tags from response for correlation
*/
private extractSemanticTags;
/**
* Calculate cache memory usage
*/
private calculateCacheMemoryUsage;
/**
* Hash object for cache key generation
*/
private hashObject;
/**
* Create error response for single tool synthesis
*/
private createErrorResponse;
/**
* Create failure response for failed tool execution
*/
private createFailureResponse;
/**
* Synthesize content from tool results
*/
private synthesizeContent;
/**
* Create summary section for multiple results
*/
private createSummarySection;
/**
* Create section for individual tool result
*/
private createToolResultSection;
/**
* Format individual result item
*/
private formatResultItem;
/**
* Format search result item
*/
private formatSearchResult;
/**
* Format generation result item
*/
private formatGenerationResult;
/**
* Format analysis result item
*/
private formatAnalysisResult;
/**
* Create correlations section
*/
private createCorrelationsSection;
/**
* Format tool name for display
*/
private formatToolName;
/**
* Find correlations between tool results
*/
private findResultCorrelations;
/**
* Find correlation between two tool results
*/
private findEntityCorrelation;
/**
* Extract entity names from tool result
*/
private extractEntityNames;
/**
* Calculate relevance score for tool result
*/
private calculateRelevanceScore;
/**
* Calculate completeness score for tool result
*/
private calculateCompletenessScore;
/**
* Calculate coherence score for tool result
*/
private calculateCoherenceScore;
/**
* Calculate information density
*/
private calculateInformationDensity;
/**
* Calculate structural integrity
*/
private calculateStructuralIntegrity;
/**
* Calculate semantic consistency
*/
private calculateSemanticConsistency;
/**
* Calculate factual accuracy (basic heuristics)
*/
private calculateFactualAccuracy;
/**
* Assess quality of aggregated results
*/
private assessAggregatedQuality;
/**
* Synthesize workflow content with execution context
*/
private synthesizeWorkflowContent;
/**
* Create workflow summary section
*/
private createWorkflowSummary;
/**
* Create execution details section
*/
private createExecutionDetailsSection;
/**
* Create partial failure section
*/
private createPartialFailureSection;
/**
* Assess workflow quality
*/
private assessWorkflowQuality;
/**
* Determine synthesis strategy based on results and correlations
*/
private determineSynthesisStrategy;
/**
* Create error response for aggregation
*/
private createAggregationErrorResponse;
/**
* Create error response for workflow synthesis
*/
private createWorkflowErrorResponse;
/**
* Update synthesis statistics
*/
private updateStatistics;
}