memory_cleanup
Remove outdated memories from the documcp server by specifying how many days to retain. Use dry run to preview deletions before executing cleanup.
Instructions
Clean up old memories
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| daysToKeep | No | Number of days of memories to keep | |
| dryRun | No | Preview what would be deleted without actually deleting |
Implementation Reference
- src/memory/index.ts:410-429 (registration)Registration of the 'memory_cleanup' tool including its name, description, and input schema definition.{ name: "memory_cleanup", description: "Clean up old memories", inputSchema: { type: "object", properties: { daysToKeep: { type: "number", description: "Number of days of memories to keep", default: 30, }, dryRun: { type: "boolean", description: "Preview what would be deleted without actually deleting", default: false, }, }, }, },
- src/memory/integration.ts:406-413 (handler)The handler implementation for 'memory_cleanup' tool. Calculates cutoff date based on daysToKeep and delegates to MemoryManager.cleanup() to remove old memories.export async function cleanupOldMemories( daysToKeep: number = 30, ): Promise<number> { const manager = await initializeMemory(); const cutoffDate = new Date(Date.now() - daysToKeep * 24 * 60 * 60 * 1000); return await manager.cleanup(cutoffDate); }