memory_backup
Backup memory data from the meMCP server to preserve LLM knowledge and session context for future retrieval and continuity.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "memory_backup"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/modules/MemoryManagement.js:49-71 (registration)Direct registration of the 'memory_backup' tool using server.registerTool, defining schema and handler.
registerBackupTool(server) { 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); } ); } - JSON schema for input parameters of memory_backup tool.
{ 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, }, }, }, - Primary handler function invoked by the tool registration. Processes args, calls createBackup helper, and returns MCP-formatted 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, }; } } - Helper method that performs the backup operation by fetching stats and returning metadata (stubbed 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}`); } - src/tools/MemoryTools.js:23-29 (registration)Higher-level registration in MemoryTools that invokes MemoryManagement.registerTools(server), enabling the memory_backup tool.
async registerTools(server) { // Register tools from modular components this.operations.registerTools(server); this.queryHandler.registerTools(server); this.streamingTools.registerTools(server); this.management.registerTools(server); }