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
| Name | Required | Description | Default |
|---|---|---|---|
| point_id | Yes | The restore point ID (format: rp-timestamp-hash). Get from list_restore_points. |
Implementation Reference
- src/index.ts:348-368 (handler)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.", }], }; }), );