Skip to main content
Glama
sloth-wq

Prompt Auto-Optimizer MCP

by sloth-wq

gepa_restore_backup

Restore the Prompt Auto-Optimizer MCP system from a specific backup, performing integrity validation and creating a pre-restore backup for safety.

Instructions

Restore system from a specific backup

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
backupIdYesID of the backup to restore from
validateIntegrityNoPerform integrity validation before restore
createPreRestoreBackupNoCreate backup before restoration

Implementation Reference

  • Main handler function for 'gepa_restore_backup' tool. Extracts parameters, initializes disaster recovery, calls restoreSystemFromBackup on the DisasterRecoverySystem instance, formats and returns the detailed response including success status, components restored/failed, warnings, and integrity checks.
      private async restoreBackup(params: {
        backupId: string;
        validateIntegrity?: boolean;
        createPreRestoreBackup?: boolean;
      }): Promise<{ content: { type: string; text: string; }[] }> {
        const { backupId, validateIntegrity = true, createPreRestoreBackup = true } = params;
    
        try {
          await this.disasterRecovery.initialize();
          
          const result = await this.disasterRecovery.restoreSystemFromBackup(backupId, {
            validateIntegrity,
            createPreRestoreBackup
          });
    
          return {
            content: [
              {
                type: 'text',
                text: `# System Restore ${result.success ? 'Completed' : 'Failed'}
    
    ## Restore Details
    - **Backup ID**: ${result.backupId}
    - **Success**: ${result.success ? 'Yes' : 'No'}
    - **Restore Time**: ${result.restoreTime} ms
    - **Pre-restore Backup**: ${result.preRestoreBackupId || 'None created'}
    
    ## Components Restored
    ${result.restoredComponents.map(comp => `✅ ${comp}`).join('\n')}
    
    ${result.failedComponents.length > 0 ? `## Failed Components
    ${result.failedComponents.map(comp => `❌ ${comp}`).join('\n')}` : ''}
    
    ${result.warnings.length > 0 ? `## Warnings
    ${result.warnings.map(w => `⚠️ ${w}`).join('\n')}` : ''}
    
    ${result.integrityChecks.length > 0 ? `## Integrity Checks
    ${result.integrityChecks.map(check => `- ${check.component}: ${check.valid ? '✅ Valid' : '❌ Invalid'}`).join('\n')}` : ''}
    
    ${result.success ? 'System has been successfully restored from backup.' : 'Restore completed with errors. Please check the failed components and warnings.'}`,
              },
            ],
          };
        } catch (error) {
          throw new Error(`Failed to restore backup: ${error instanceof Error ? error.message : 'Unknown error'}`);
        }
  • Input schema definition for the gepa_restore_backup tool, specifying parameters backupId (required), validateIntegrity, and createPreRestoreBackup.
    name: 'gepa_restore_backup',
    description: 'Restore system from a specific backup',
    inputSchema: {
      type: 'object',
      properties: {
        backupId: {
          type: 'string',
          description: 'ID of the backup to restore from'
        },
        validateIntegrity: {
          type: 'boolean',
          default: true,
          description: 'Perform integrity validation before restore'
        },
        createPreRestoreBackup: {
          type: 'boolean',
          default: true,
          description: 'Create backup before restoration'
        }
      },
      required: ['backupId']
    }
  • Tool call request handler registration in the MCP server. The switch statement dispatches 'gepa_restore_backup' calls to the restoreBackup method.
      // Handle tool calls
      this.server.setRequestHandler(CallToolRequestSchema, async (request: any) => {
        const { name, arguments: args } = request.params;
    
        try {
          if (!this.isInitialized) {
            throw new Error('GEPA components not properly initialized');
          }
    
          switch (name) {
            case 'gepa_start_evolution':
              return await this.startEvolution(args as unknown as StartEvolutionParams);
            
            case 'gepa_record_trajectory':
              return await this.recordTrajectory(args as unknown as RecordTrajectoryParams);
            
            case 'gepa_evaluate_prompt':
              return await this.evaluatePrompt(args as unknown as EvaluatePromptParams);
            
            case 'gepa_reflect':
              return await this.reflect(args as unknown as ReflectParams);
            
            case 'gepa_get_pareto_frontier':
              return await this.getParetoFrontier(args as unknown as GetParetoFrontierParams);
            
            case 'gepa_select_optimal':
              return await this.selectOptimal(args as unknown as SelectOptimalParams);
            
            // Legacy tools for backward compatibility
            case 'gepa_evolve_prompt':
              return await this.evolvePrompt(args as {
                prompt: string;
                fitness_criteria: string;
                generations?: number;
                population_size?: number;
              });
            
            case 'gepa_analyze_prompt':
              return await this.analyzePrompt(args as {
                prompt: string;
                analysis_type?: string;
              });
            
            case 'gepa_optimize_prompt':
              return await this.optimizePrompt(args as {
                prompt: string;
                optimization_target: string;
                constraints?: Record<string, unknown>;
              });
            
            case 'gepa_generate_variants':
              return await this.generateVariants(args as {
                prompt: string;
                variant_count?: number;
                strategy?: string;
              });
            
            // Disaster Recovery Tools
            case 'gepa_create_backup':
              return await this.createBackup(args as {
                label?: string;
                includeTrajectories?: boolean;
              });
            
            case 'gepa_restore_backup':
              return await this.restoreBackup(args as {
                backupId: string;
                validateIntegrity?: boolean;
                createPreRestoreBackup?: boolean;
              });
            
            case 'gepa_list_backups':
              return await this.listBackups(args as {
                limit?: number;
                filterLabel?: string;
              });
            
            case 'gepa_recovery_status':
              return await this.getRecoveryStatus(args as {
                includeMetrics?: boolean;
              });
            
            case 'gepa_recover_component':
              return await this.recoverComponent(args as {
                componentType: string;
                strategy?: string;
              });
            
            case 'gepa_integrity_check':
              return await this.performIntegrityCheck(args as {
                component?: string;
                autoRepair?: boolean;
              });
            
            default:
              throw new Error(`Unknown tool: ${name}`);
          }
        } catch (error) {
          const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
          return {
            content: [
              {
                type: 'text',
                text: `Error executing ${name}: ${errorMessage}`,
              },
            ],
            isError: true,
          };
        }
      });
    }
  • Lists all available tools including gepa_restore_backup via the TOOLS array.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: TOOLS,
      };
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action but fails to mention critical traits: that this is a destructive operation (overwrites current system state), may require high permissions, could cause downtime, or has no output schema for status tracking. This leaves significant gaps for safe agent use.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero wasted words. It front-loads the core action ('Restore system') and specifies the resource ('from a specific backup'), making it easy to parse quickly.

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 the complexity of a system restoration tool with no annotations and no output schema, the description is inadequate. It doesn't address safety implications, error conditions, or what happens post-restoration (e.g., system reboot, status checks via 'gepa_recovery_status'). For a high-stakes operation, more context is needed.

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 parameters are fully documented in the schema itself. The description adds no additional meaning beyond implying 'backupId' is needed, which is already covered. This meets the baseline for high schema coverage without compensating value.

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

Purpose4/5

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

The description clearly states the verb ('restore') and resource ('system from a specific backup'), making the purpose immediately understandable. It doesn't explicitly differentiate from siblings like 'gepa_recover_component' or 'gepa_list_backups', but the core action is unambiguous.

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 is provided on when to use this tool versus alternatives like 'gepa_recover_component' or 'gepa_create_backup'. The description lacks context about prerequisites, such as needing a backup ID from 'gepa_list_backups', or warnings about system impact during restoration.

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