Skip to main content
Glama

undo_change

Restore files to their previous state before an AI modification using shadow restore points. Preserves git history while allowing selective rollback of changes.

Instructions

Restore files to their state before a specific AI change. Uses the shadow restore point system. Does NOT affect git history. Call list_restore_points first to find the point ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
point_idYesThe restore point ID (format: rp-timestamp-hash). Get from list_restore_points.

Implementation Reference

  • The tool `undo_change` is registered in `src/index.ts` using the MCP server, and it calls the `restorePoint` helper function from `./git/shadow.js` to execute the restoration.
    server.tool(
      "undo_change",
      "Restore files to their state before a specific AI change. Uses the shadow restore point system. " +
      "Does NOT affect git history. Call list_restore_points first to find the point ID.",
      {
        point_id: z.string().describe("The restore point ID (format: rp-timestamp-hash). Get from list_restore_points."),
      },
      withRequestActivity(async ({ point_id }) => {
        const restored = await restorePoint(ROOT_DIR, point_id);
        invalidateSearchCache();
        invalidateIdentifierSearchCache();
        return {
          content: [{
            type: "text" as const,
            text: restored.length > 0
              ? `Restored ${restored.length} file(s):\n${restored.join("\n")}`
              : "No files were restored. The backup may be empty.",
          }],
        };
      }),
    );

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/ForLoopCodes/contextplus'

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