list_undos
View all saved undo checkpoints to restore previous file states after AI-driven edits in Claude Code.
Instructions
List all undo checkpoints in the stack
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:53-60 (registration)Registration of the 'list_undos' tool in the TOOLS array, including name, description, and empty input schema.{ name: "list_undos", description: "List all undo checkpoints in the stack", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:119-129 (handler)Tool handler for 'list_undos': invokes changeTracker.listUndoStack() and returns formatted response content.case "list_undos": { const undoList = changeTracker.listUndoStack(); return { content: [ { type: "text", text: `Undo Stack:\n${undoList.join('\n\n')}`, }, ], }; }
- src/changeTracker.ts:145-175 (helper)Implementation of listUndoStack() in ChangeTracker class: deduplicates checkpoints, formats and returns list of undo stack entries with details.listUndoStack(): string[] { // Deduplicate checkpoints before listing this.deduplicateCheckpoints(); if (this.undoStack.length === 0) { return ["No undo checkpoints available"]; } const list: string[] = []; this.undoStack.forEach((checkpoint, index) => { const fileCount = checkpoint.files.size; const createdFileCount = checkpoint.createdFiles.size; const totalFiles = fileCount + createdFileCount; const timeAgo = this.getTimeAgo(checkpoint.timestamp); const filesList = Array.from(checkpoint.files.keys()).map(f => ` - ${f} (modified)`).join('\n'); const createdFilesList = Array.from(checkpoint.createdFiles).map(f => ` - ${f} (created)`).join('\n'); const allFilesList = [filesList, createdFilesList].filter(Boolean).join('\n'); const isNext = index === this.undoStack.length - 1; const prefix = isNext ? "⭐ NEXT TO UNDO" : ""; list.push( `[${index + 1}] ${checkpoint.description}${prefix ? ` ${prefix}` : ""}\n` + ` Created: ${timeAgo} | Files: ${totalFiles} (${fileCount} modified, ${createdFileCount} created)\n${allFilesList}` ); }); return list; }