gepa_integrity_check
Verify and repair data integrity for the Prompt Auto-Optimizer MCP's evolutionary algorithm components, including evolution states, trajectories, and configuration data.
Instructions
Perform comprehensive data integrity check
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| component | No | Component to check integrity for | all |
| autoRepair | No | Attempt automatic repair of detected issues |
Implementation Reference
- src/mcp/server.ts:1739-1792 (handler)The MCP tool handler for 'gepa_integrity_check'. Initializes disaster recovery, calls performIntegrityCheck on it, filters results by component, and returns formatted text response with status, summary, and recommendations.private async performIntegrityCheck(params: { component?: string; autoRepair?: boolean; }): Promise<{ content: { type: string; text: string; }[] }> { const { component = 'all', autoRepair = false } = params; try { await this.disasterRecovery.initialize(); const results = await this.disasterRecovery.performIntegrityCheck() as unknown as IntegrityCheckResult[]; const filteredResults = component === 'all' ? results : results.filter(r => r.component === component); const overallValid = filteredResults.every(r => r.valid); const corruptionCount = filteredResults.filter(r => !r.valid).length; return { content: [ { type: 'text', text: `# Data Integrity Check Results ## Overall Status: ${overallValid ? '✅ PASSED' : '❌ ISSUES DETECTED'} ### Summary - **Components Checked**: ${filteredResults.length} - **Valid Components**: ${filteredResults.filter(r => r.valid).length} - **Corrupted Components**: ${corruptionCount} - **Auto-Repair**: ${autoRepair ? 'Enabled' : 'Disabled'} ### Detailed Results ${filteredResults.map(result => `#### ${result.component} - **Overall Valid**: ${result.valid ? '✅ Yes' : '❌ No'} - **Checksum Valid**: ${result.checksumValid ? '✅' : '❌'} - **Size Match**: ${result.sizeMatch ? '✅' : '❌'} - **Dependencies Valid**: ${result.dependenciesValid ? '✅' : '❌'} ${result.errors.length > 0 ? `- **Errors**: ${result.errors.join(', ')}` : ''} `).join('\n')} ${corruptionCount > 0 ? `### Recommendations ${filteredResults.filter(r => !r.valid).map(result => `- **${result.component}**: Consider ${autoRepair ? 'manual review of auto-repair results' : 'running with autoRepair enabled or manual restoration'}` ).join('\n')}` : ''} ${overallValid ? 'All checked components passed integrity validation.' : `${corruptionCount} component(s) failed integrity checks. ${autoRepair ? 'Auto-repair was attempted.' : 'Consider running with autoRepair enabled.'}`}`, }, ], }; } catch (error) { throw new Error(`Failed to perform integrity check: ${error instanceof Error ? error.message : 'Unknown error'}`); } }
- src/mcp/server.ts:347-366 (registration)Tool registration in the TOOLS array, including name, description, and input schema definition.{ name: 'gepa_integrity_check', description: 'Perform comprehensive data integrity check', inputSchema: { type: 'object', properties: { component: { type: 'string', enum: ['all', 'evolution_state', 'trajectories', 'configuration', 'cache'], default: 'all', description: 'Component to check integrity for' }, autoRepair: { type: 'boolean', default: false, description: 'Attempt automatic repair of detected issues' } } } }
- src/mcp/server.ts:604-608 (registration)Dispatch handler in the switch statement that routes tool calls to the performIntegrityCheck method.case 'gepa_integrity_check': return await this.performIntegrityCheck(args as { component?: string; autoRepair?: boolean; });
- src/mcp/types.ts:67-74 (schema)TypeScript interface defining the structure of integrity check results used in the tool response.export interface IntegrityCheckResult { component: string; valid: boolean; checksumValid?: boolean; sizeMatch?: boolean; dependenciesValid?: boolean; errors: string[]; }
- Core helper function in DataIntegrityManager that orchestrates comprehensive integrity checks across evolution state, trajectories, configuration, cache, and cross-references, processing results and triggering repairs.async performComprehensiveCheck(): Promise<IntegrityCheckResult[]> { return this.resilience.executeWithFullProtection( async () => { const results: IntegrityCheckResult[] = []; // Check evolution state integrity const evolutionResult = await this.checkEvolutionStateIntegrity(); if (evolutionResult) results.push(evolutionResult); // Check trajectory data integrity const trajectoryResults = await this.checkTrajectoryDataIntegrity(); results.push(...trajectoryResults); // Check configuration integrity const configResult = await this.checkConfigurationIntegrity(); if (configResult) results.push(configResult); // Check cache integrity const cacheResults = await this.checkCacheIntegrity(); results.push(...cacheResults); // Check cross-references if enabled if (this.config.crossReferenceChecks) { const crossRefResults = await this.checkCrossReferences(); results.push(...crossRefResults); } // Process results and trigger repairs if needed await this.processIntegrityResults(results); this.emit('comprehensiveCheckCompleted', { resultCount: results.length, corruptionDetected: results.some(r => !r.overallValid) }); return results; }, { serviceName: 'data-integrity', context: { name: 'comprehensive-check', priority: 'high' } } ); }