memory_backup
Create backups of session-specific memory data in the MCP server to ensure continuous learning and knowledge retention for LLMs across interactions.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the memory_backup tool. It processes arguments, generates a backup name if needed, calls createBackup, and returns a formatted success or error response.async handleBackup(args) { try { const { backupName, includeIndexes = true } = args; const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); const finalBackupName = backupName || `backup-${timestamp}`; const backupResult = await this.createBackup(finalBackupName, includeIndexes); return { content: [ { type: 'text', text: `💾 **Backup Created Successfully**\n\n**Name:** ${backupResult.name}\n**Facts:** ${backupResult.factCount}\n**Size:** ${backupResult.size}\n**Location:** ${backupResult.path}\n**Includes Indexes:** ${includeIndexes ? 'Yes' : 'No'}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error creating backup: ${error.message}`, }, ], isError: true, }; } }
- JSON schema defining the input parameters for the memory_backup tool: optional backupName and includeIndexes with default.type: 'object', properties: { backupName: { type: 'string', description: 'Name for the backup (optional - will generate if not provided)', }, includeIndexes: { type: 'boolean', description: 'Include search indexes in backup', default: true, }, }, },
- src/tools/modules/MemoryManagement.js:50-70 (registration)Registers the memory_backup tool using server.registerTool, specifying name, description, input schema, and handler function.server.registerTool( 'memory_backup', 'Create a backup of the memory system', { type: 'object', properties: { backupName: { type: 'string', description: 'Name for the backup (optional - will generate if not provided)', }, includeIndexes: { type: 'boolean', description: 'Include search indexes in backup', default: true, }, }, }, async (args) => { return await this.handleBackup(args); } );
- Helper method called by the handler to create the backup. Currently retrieves stats and returns metadata (appears to be a stub implementation).async createBackup(backupName, includeIndexes = true) { try { const stats = await this.factStore.getStats(); return { name: backupName, factCount: stats.totalFacts, size: 'N/A', path: `backups/${backupName}`, timestamp: new Date().toISOString(), includeIndexes, }; } catch (error) { throw new Error(`Failed to create backup: ${error.message}`); }