Skip to main content
Glama
sloth-wq

Prompt Auto-Optimizer MCP

by sloth-wq

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
NameRequiredDescriptionDefault
componentNoComponent to check integrity forall
autoRepairNoAttempt automatic repair of detected issues

Implementation Reference

  • 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'}`);
        }
      }
  • 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'
          }
        }
      }
    }
  • 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;
      });
  • 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'
          }
        }
      );
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but only states the action without behavioral details. It doesn't disclose if this is read-only or destructive, what permissions are needed, how long it takes, if it's idempotent, or what happens on failure. The mention of 'comprehensive' is vague and adds minimal context beyond the basic purpose.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It's front-loaded with the core action, though it could be more structured by including key details upfront. It earns its place but lacks depth that might require more elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a mutation-like tool (integrity check with repair option), the description is incomplete. It doesn't explain return values, error handling, or the system context (e.g., GEPA evolution system). For a tool with potential side effects (autoRepair), more detail is needed to guide safe usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (component and autoRepair). The description adds no additional meaning beyond what's in the schema, such as explaining the impact of 'autoRepair' or what 'comprehensive' entails. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Perform comprehensive data integrity check' states a clear verb ('perform') and resource ('data integrity check'), but it's vague about scope and doesn't differentiate from siblings like 'gepa_recover_component' or 'gepa_recovery_status'. It lacks specificity about what 'comprehensive' entails or what system it applies to.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives is provided. It doesn't mention prerequisites, timing (e.g., after errors or periodically), or how it relates to siblings like 'gepa_recover_component' for repairs or 'gepa_recovery_status' for monitoring. Usage is implied but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sloth-wq/prompt-auto-optimizer-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server