create_backup
Create a backup of the current memory state to preserve knowledge graph data for remote storage and collaboration.
Instructions
현재 메모리 상태의 백업을 생성합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| backupName | No | 백업 이름 (선택사항) |
Implementation Reference
- src/index.ts:711-758 (handler)The handler function that executes the create_backup tool logic: generates a timestamped backup of the memory graph, serializes it to JSON, and uploads it to GitHub as a new file in the backups directory.private async handleCreateBackup(args: any) { try { const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); const backupName = args.backupName || `backup-${timestamp}`; const backupPath = `backups/${backupName}.json`; const currentData = this.memoryManager.toJSON(); const backupContent = JSON.stringify({ ...currentData, backupInfo: { createdAt: new Date().toISOString(), name: backupName, originalPath: 'memory/graph.json' } }, null, 2); await this.githubClient.putFile( { path: backupPath, content: backupContent, }, `backup: Create backup '${backupName}'` ); return { content: [{ type: 'text', text: JSON.stringify({ success: true, message: `Backup created successfully`, backupName, backupPath, timestamp: new Date().toISOString() }, null, 2), }], }; } catch (error) { return { content: [{ type: 'text', text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : 'Unknown error' }, null, 2), }], }; } }
- src/index.ts:349-357 (schema)Input schema for the create_backup tool, defining an optional 'backupName' string parameter.inputSchema: { type: 'object', properties: { backupName: { type: 'string', description: '백업 이름 (선택사항)' } }, },
- src/index.ts:346-358 (registration)Registration of the create_backup tool in the server's tool list for ListToolsRequestSchema, including name, description, and input schema.{ name: 'create_backup', description: '현재 메모리 상태의 백업을 생성합니다', inputSchema: { type: 'object', properties: { backupName: { type: 'string', description: '백업 이름 (선택사항)' } }, }, },
- src/index.ts:410-411 (registration)Dispatch case in the CallToolRequestSchema handler that routes 'create_backup' calls to the handleCreateBackup method.case 'create_backup': return await this.handleCreateBackup(args);