Skip to main content
Glama

list_undos

Display all undo checkpoints in the stack, enabling quick identification and restoration of previous file states within Claude Code's checkpoint-based undo system.

Instructions

List all undo checkpoints in the stack

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "properties": {}, "type": "object" }

Implementation Reference

  • Handler for the 'list_undos' tool call. Retrieves the undo stack using changeTracker.listUndoStack() and formats it as a text response.
    case "list_undos": { const undoList = changeTracker.listUndoStack(); return { content: [ { type: "text", text: `Undo Stack:\n${undoList.join('\n\n')}`, }, ], }; }
  • Core implementation of listing the undo stack. Formats each checkpoint with details like files modified/created, timestamps, and highlights the next undoable checkpoint.
    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; }
  • src/index.ts:53-60 (registration)
    Tool registration in the TOOLS array, including name, description, and empty input schema. Used by ListToolsRequestSchema handler.
    { name: "list_undos", description: "List all undo checkpoints in the stack", inputSchema: { type: "object", properties: {}, }, },
  • Input schema definition for the 'list_undos' tool (empty object, no parameters required).
    { name: "list_undos", description: "List all undo checkpoints in the stack", inputSchema: { type: "object", properties: {}, }, },

Other Tools

Related 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