Skip to main content
Glama

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' } } ); }

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