gepa_list_backups
List available system backups for the Prompt Auto-Optimizer MCP server to manage and restore optimized prompt versions.
Instructions
List available system backups
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of backups to return | |
| filterLabel | No | Filter backups by label (optional) |
Implementation Reference
- src/mcp/server.ts:1538-1599 (handler)The primary handler function for the 'gepa_list_backups' MCP tool. It destructures parameters, initializes the disaster recovery system, simulates listing backups with filtering and limiting, and returns a formatted text response listing available backups.private async listBackups(params: { limit?: number; filterLabel?: string; }): Promise<{ content: { type: string; text: string; }[] }> { const { limit = 20, filterLabel } = params; try { await this.disasterRecovery.initialize(); // This would ideally be a method on the disaster recovery system // For now, we'll simulate the response const mockBackups = [ { id: 'backup_1733140800_abc123', timestamp: new Date(), label: 'manual-backup', type: 'full', size: 5242880, components: 3 }, { id: 'backup_1733137200_def456', timestamp: new Date(Date.now() - 3600000), label: 'auto-backup', type: 'incremental', size: 1048576, components: 2 } ]; let backups = mockBackups; if (filterLabel) { backups = backups.filter(b => b.label?.includes(filterLabel)); } backups = backups.slice(0, limit); return { content: [ { type: 'text', text: `# Available System Backups Found ${backups.length} backup(s): ${backups.map(backup => `## ${backup.label || 'Unlabeled'} (${backup.id}) - **Created**: ${backup.timestamp.toISOString()} - **Type**: ${backup.type} - **Size**: ${(backup.size / 1024 / 1024).toFixed(2)} MB - **Components**: ${backup.components} `).join('\n')} ${backups.length === 0 ? 'No backups found matching the criteria.' : `Use \`gepa_restore_backup\` with a backup ID to restore the system.`}`, }, ], }; } catch (error) { throw new Error(`Failed to list backups: ${error instanceof Error ? error.message : 'Unknown error'}`); } }
- src/mcp/server.ts:295-311 (registration)Tool registration entry in the MCP server's TOOLS array, defining the tool name, description, and input schema for 'gepa_list_backups'.name: 'gepa_list_backups', description: 'List available system backups', inputSchema: { type: 'object', properties: { limit: { type: 'number', default: 20, description: 'Maximum number of backups to return' }, filterLabel: { type: 'string', description: 'Filter backups by label (optional)' } } } },
- src/mcp/server.ts:297-310 (schema)Input schema defining parameters for the gepa_list_backups tool: optional 'limit' (number, default 20) and 'filterLabel' (string).inputSchema: { type: 'object', properties: { limit: { type: 'number', default: 20, description: 'Maximum number of backups to return' }, filterLabel: { type: 'string', description: 'Filter backups by label (optional)' } } }
- Supporting utility method in StateBackupManager that retrieves, filters (by type, date, label, component), sorts (newest first), and returns available backups from the internal registry. Intended for integration with the tool handler.getAvailableBackups(filter?: { type?: BackupEntry['type']; since?: Date; label?: string; component?: string; }): BackupEntry[] { let backups = Array.from(this.backupRegistry.values()); if (filter) { if (filter.type) { backups = backups.filter(b => b.type === filter.type); } if (filter.since) { backups = backups.filter(b => b.timestamp >= filter.since!); } if (filter.label) { backups = backups.filter(b => b.label?.includes(filter.label!)); } if (filter.component) { backups = backups.filter(b => b.components.some(c => c.name.includes(filter.component!)) ); } } return backups.sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime()); }