Skip to main content
Glama

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
NameRequiredDescriptionDefault

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: {},
      },
    },
  • 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')}`,
          },
        ],
      };
    }
  • 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;
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/khalilbalaree/undo-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server