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.",
          }],
        };
      }),
    );
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. Discloses implementation ('shadow restore point system') and critical safety boundary ('Does NOT affect git history'). Could strengthen by clarifying if current uncommitted changes are preserved or overwritten, but mechanism disclosure is solid.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Four sentences with zero waste: purpose, mechanism, safety constraint, prerequisite. Front-loaded with core action, structured logically. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Comprehensive for a single-parameter tool. Covers purpose, mechanism, safety guardrails, and prerequisites. No output schema exists; description appropriately doesn't speculate on return values.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, establishing baseline 3. Description adds crucial workflow context for point_id ('Get from list_restore_points') that explains the parameter's semantic relationship to sibling tools and data flow.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Exceptionally clear: 'Restore files to their state before a specific AI change' provides specific verb (restore), resource (files), and scope constraint (AI change, not manual changes). Distinguishes mechanism via 'shadow restore point system' and explicitly contrasts with git-based recovery.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit workflow guidance: 'Call list_restore_points first to find the point ID' provides clear prerequisite. 'Does NOT affect git history' establishes sibling differentiation from version control tools like propose_commit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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