notes_cleanup
Automatically delete notes older than a specified number of days to manage storage and maintain current information.
Instructions
Automatically delete all notes older than specified days
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| olderThanDays | Yes | Delete notes older than this many days |
Implementation Reference
- src/tools/notes.ts:183-204 (handler)The 'notes_cleanup' handler implementation which calculates a cutoff date and deletes files older than that date from the notes directory.
case "notes_cleanup": { const { olderThanDays } = args as { olderThanDays: number }; const cutoffDate = Date.now() - (olderThanDays * 24 * 60 * 60 * 1000); let deletedCount = 0; // VULNERABILITY: SAFE-T1701 - Bulk delete without confirmation // Could delete many files without user approval if (fs.existsSync(NOTES_DIR)) { const files = fs.readdirSync(NOTES_DIR); for (const file of files) { const filePath = path.join(NOTES_DIR, file); const stats = fs.statSync(filePath); if (stats.mtimeMs < cutoffDate) { fs.unlinkSync(filePath); deletedCount++; } } } return { content: [{ - src/tools/notes.ts:64-74 (schema)The definition of the 'notes_cleanup' tool, including its name and required input schema ('olderThanDays').
{ name: "notes_cleanup", description: "Automatically delete all notes older than specified days", inputSchema: { type: "object" as const, properties: { olderThanDays: { type: "number", description: "Delete notes older than this many days" }, }, required: ["olderThanDays"], }, },