Skip to main content
Glama
sloth-wq

Prompt Auto-Optimizer MCP

by sloth-wq

gepa_create_backup

Create system backups for prompt optimization data, preserving evolution states and trajectory information to safeguard iterative improvements.

Instructions

Create system backup including evolution state and trajectories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelNoOptional label for the backup
includeTrajectoriesNoInclude trajectory data in backup

Implementation Reference

  • Main handler for the 'gepa_create_backup' tool. Delegates to DisasterRecoverySystem.createSystemBackup and formats response with backup details.
      private async createBackup(params: {
        label?: string;
        includeTrajectories?: boolean;
      }): Promise<{ content: { type: string; text: string; }[] }> {
        const { label, includeTrajectories = true } = params;
    
        try {
          await this.disasterRecovery.initialize();
          
          const backup = await this.disasterRecovery.createSystemBackup(label);
          
          if (includeTrajectories) {
            // Get recent trajectories and create additional backup
            const trajectories = await this.trajectoryStore.query({});
            if (trajectories.length > 0) {
              // This would create a trajectory-specific backup
              // For now, we'll note it in the response
            }
          }
    
          return {
            content: [
              {
                type: 'text',
                text: `# System Backup Created
    
    ## Backup Details
    - **ID**: ${backup.id}
    - **Label**: ${backup.label || 'Unlabeled'}
    - **Timestamp**: ${backup.timestamp.toISOString()}
    - **Type**: ${backup.type}
    - **Size**: ${(backup.size / 1024 / 1024).toFixed(2)} MB
    - **Components**: ${backup.components.length}
    - **Compressed**: ${backup.compressed ? 'Yes' : 'No'}
    
    ## Components Backed Up
    ${backup.components.map(comp => `- **${comp.name}** (${comp.type}): ${(comp.size / 1024).toFixed(2)} KB`).join('\n')}
    
    ## Metadata
    - Generation: ${backup.metadata.evolutionGeneration}
    - Population Size: ${backup.metadata.activePopulationSize}
    - Pareto Frontier Size: ${backup.metadata.paretoFrontierSize}
    - Total Trajectories: ${backup.metadata.totalTrajectories}
    
    The backup is ready for restoration if needed.`,
              },
            ],
          };
        } catch (error) {
          throw new Error(`Failed to create backup: ${error instanceof Error ? error.message : 'Unknown error'}`);
        }
      }
  • Tool registration in the MCP TOOLS array, including name, description, and input schema.
    {
      name: 'gepa_create_backup',
      description: 'Create system backup including evolution state and trajectories',
      inputSchema: {
        type: 'object',
        properties: {
          label: {
            type: 'string',
            description: 'Optional label for the backup'
          },
          includeTrajectories: {
            type: 'boolean',
            default: true,
            description: 'Include trajectory data in backup'
          }
        }
      }
    },
  • Input schema definition for the gepa_create_backup tool.
    inputSchema: {
      type: 'object',
      properties: {
        label: {
          type: 'string',
          description: 'Optional label for the backup'
        },
        includeTrajectories: {
          type: 'boolean',
          default: true,
          description: 'Include trajectory data in backup'
        }
      }
    }
  • Core implementation of backup creation: serializes evolution state to JSON, compresses with gzip, computes SHA256 checksums, writes component files (evolution-state, configuration, metrics), creates metadata, and saves backup entry.
    async createEvolutionStateBackup(
      evolutionState: {
        config: EvolutionConfig;
        population: PromptCandidate[];
        generation: number;
        paretoFrontier: any;
        metrics: any;
      },
      label?: string
    ): Promise<BackupEntry> {
      return this.resilience.executeWithFullProtection(
        async () => {
          const backupId = this.generateBackupId();
          const timestamp = new Date();
          
          // Determine backup type
          const backupType = this.determineBackupType();
          
          // Create backup components
          const components: BackupComponent[] = [];
          
          // Evolution state component
          const evolutionComponent = await this.createEvolutionStateComponent(
            backupId, 
            evolutionState
          );
          components.push(evolutionComponent);
          
          // Configuration component
          const configComponent = await this.createConfigurationComponent(
            backupId,
            evolutionState.config
          );
          components.push(configComponent);
          
          // Metrics component
          const metricsComponent = await this.createMetricsComponent(
            backupId,
            evolutionState.metrics
          );
          components.push(metricsComponent);
          
          // Calculate total size and checksum
          const totalSize = components.reduce((sum, comp) => sum + comp.size, 0);
          const totalChecksum = this.calculateCombinedChecksum(components);
          
          // Create metadata
          const metadata: BackupMetadata = {
            systemVersion: process.env.npm_package_version || '1.0.0',
            evolutionGeneration: evolutionState.generation,
            activePopulationSize: evolutionState.population.length,
            paretoFrontierSize: evolutionState.paretoFrontier?.size || 0,
            totalTrajectories: 0, // Will be updated when trajectory data is added
            configurationHash: this.hashObject(evolutionState.config),
            backupReason: label || 'evolution-state-snapshot',
            performanceMetrics: evolutionState.metrics?.performance || {},
            warnings: []
          };
          
          // Create backup entry
          const backupEntry: BackupEntry = {
            id: backupId,
            timestamp,
            label: label || `backup-${Date.now()}`,
            type: backupType,
            size: totalSize,
            checksum: totalChecksum,
            compressed: this.config.compressionEnabled,
            encrypted: this.config.encryptionEnabled,
            components,
            metadata,
            restoreTimeEstimate: this.estimateRestoreTime(totalSize)
          };
          
          // Save backup entry
          await this.saveBackupEntry(backupEntry);
          
          // Update registry
          this.backupRegistry.set(backupId, backupEntry);
          this.lastBackupTime = timestamp;
          
          // Cleanup old backups if needed
          await this.cleanupOldBackups();
          
          this.emit('backupCreated', backupEntry);
          return backupEntry;
        },
        {
          serviceName: 'state-backup',
          context: {
            name: 'create-evolution-backup',
            priority: 'high'
          }
        }
      );
    }
  • Orchestrator layer that prepares mock evolution state and invokes StateBackupManager to perform the actual backup.
    async createSystemBackup(label?: string): Promise<BackupEntry> {
      return this.resilience.executeWithFullProtection(
        async () => {
          const backupLabel = label || `system-backup-${Date.now()}`;
          
          // Create evolution state backup
          const mockEvolutionState = {
            config: {
              taskDescription: 'System backup',
              populationSize: 10,
              maxGenerations: 50,
              mutationRate: 0.1
            } as EvolutionConfig,
            population: [] as PromptCandidate[],
            generation: 0,
            paretoFrontier: null,
            metrics: {}
          };
          
          const backup = await this.stateBackupManager.createEvolutionStateBackup(
            mockEvolutionState,
            backupLabel
          );
          
          this.addAlert({
            severity: 'info',
            source: 'orchestrator',
            title: 'System Backup Created',
            description: `System backup created: ${backup.id}`,
            actions: ['view_backup', 'restore_backup']
          });
          
          return backup;
        },
        {
          serviceName: 'recovery-orchestrator',
          context: {
            name: 'create-system-backup',
            priority: 'high'
          }
        }
      );
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states the tool creates a backup and what it includes, but lacks critical behavioral details: whether this is a destructive operation (e.g., overwrites existing backups), requires specific permissions, has rate limits, or what the output looks like (e.g., backup ID, status). For a mutation tool with zero annotation coverage, this is inadequate.

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 waste. It front-loads the core action and includes key details (what gets backed up) without unnecessary elaboration. Every word earns its place.

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 this is a mutation tool (creates backups) with no annotations and no output schema, the description is incomplete. It doesn't explain the return value (e.g., backup identifier, success status), error conditions, or behavioral constraints. For a tool that modifies system state, more context is needed to ensure safe and correct 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 already documents both parameters ('label' and 'includeTrajectories') with descriptions and defaults. The description adds no additional parameter semantics beyond implying trajectories are included by default, which is already in the schema. 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.

Purpose4/5

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

The description clearly states the action ('Create') and resource ('system backup'), specifying what gets included ('evolution state and trajectories'). It distinguishes from sibling tools like 'gepa_list_backups' (list vs. create) and 'gepa_restore_backup' (create vs. restore), though it doesn't explicitly name these alternatives. The purpose is specific but could be more differentiated.

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. It doesn't mention prerequisites, timing (e.g., before system changes), or exclusions (e.g., not for incremental backups). The context is implied as backup creation, but explicit usage scenarios are missing.

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