Skip to main content
Glama
coderdeep11

Claude Infinite Context

by coderdeep11

rollback

Revert to a previous checkpoint version to correct errors from merges or restore earlier project states.

Instructions

Revert to a previous checkpoint version. Useful if a merge produced incorrect results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stepsNoNumber of versions to roll back (default: 1)

Implementation Reference

  • Core handler function that performs the rollback by retrieving checkpoint history from Redis and restoring a previous project state.
    async rollback(steps: number = 1): Promise<string> {
      const sessionId = this.ensureInitialized();
    
      try {
        logger.info('Rolling back checkpoint', { sessionId, steps });
    
        const history = await this.redis.getCheckpointHistory(sessionId);
    
        if (history.length === 0) {
          return 'No checkpoint history available to rollback.';
        }
    
        if (steps > history.length) {
          return `Only ${history.length} checkpoints available. Cannot rollback ${steps} steps.`;
        }
    
        // Get the target checkpoint (index is steps because history[0] is current)
        const targetCheckpoint = history[steps];
    
        // Restore the state
        await this.redis.updateStateWithLock(sessionId, async () => {
          return targetCheckpoint.state;
        });
    
        logger.info('Rollback completed', {
          targetVersion: targetCheckpoint.version,
          targetTimestamp: targetCheckpoint.timestamp,
        });
    
        return `Rolled back to version ${targetCheckpoint.version} (${new Date(
          targetCheckpoint.timestamp
        ).toLocaleString()})`;
      } catch (error) {
        logger.error('Rollback failed', { error, sessionId });
        throw new Error(`Rollback failed: ${error}`);
      }
    }
  • Zod schema for validating the rollback tool input (number of steps to rollback).
    export const RollbackInputSchema = z.object({
      steps: z.number().int().positive().default(1),
    });
    
    export type CheckpointInput = z.infer<typeof CheckpointInputSchema>;
  • src/index.ts:86-99 (registration)
    Tool registration in the listTools handler, defining name, description, and input schema for MCP discovery.
      name: 'rollback',
      description:
        'Revert to a previous checkpoint version. Useful if a merge produced incorrect results.',
      inputSchema: {
        type: 'object',
        properties: {
          steps: {
            type: 'number',
            description: 'Number of versions to roll back (default: 1)',
            default: 1,
          },
        },
      },
    },
  • MCP tool call dispatcher case that parses input schema and delegates to ProjectBrain.rollback.
    case 'rollback': {
      const input = RollbackInputSchema.parse(args || {});
      const result = await this.brain.rollback(input.steps);
      return {
        content: [{ type: 'text', text: result }],
      };
    }
Behavior2/5

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

With no annotations, the description carries full burden. It mentions the tool is 'useful if a merge produced incorrect results,' implying it's a corrective action, but fails to disclose critical behavioral traits such as whether the rollback is destructive, irreversible, requires specific permissions, or has side effects on related data. This is a significant gap for a mutation tool.

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

Conciseness4/5

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

The description is two sentences, front-loaded with the core purpose and followed by a usage hint. It's efficient with minimal waste, though the second sentence could be more integrated for a perfect 5.

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

Completeness2/5

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

Given the tool's complexity (a mutation operation with potential data impact), no annotations, and no output schema, the description is incomplete. It lacks details on behavior, outcomes, error conditions, or what 'revert' entails, leaving the agent with insufficient context for safe and effective use.

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

Parameters3/5

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

Schema description coverage is 100%, with the parameter 'steps' clearly documented in the schema. The description adds no additional parameter semantics beyond what the schema provides, such as explaining what 'versions' refer to or constraints on 'steps.' Baseline 3 is appropriate as the schema handles the heavy lifting.

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

Purpose4/5

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

The description clearly states the action ('revert') and target ('previous checkpoint version'), distinguishing it from siblings like 'checkpoint' (create) and 'resume' (continue). However, it doesn't explicitly specify what resource is being reverted (e.g., data, state, or process), leaving some ambiguity compared to a perfect 5.

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

Usage Guidelines3/5

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

The description provides implied usage context ('if a merge produced incorrect results'), suggesting when to use it. However, it lacks explicit guidance on when not to use it or alternatives (e.g., vs. 'resume' or manual correction), and doesn't mention prerequisites like needing an existing checkpoint.

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/coderdeep11/claude-memory-mcp'

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