Skip to main content
Glama

redo

Restore the last undone modification to your Strudel music pattern during live coding.

Instructions

Redo action

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute() handler for the 'redo' tool: pops from redoStack, pushes current pattern to undoStack, calls writePattern to restore the saved state, and returns 'Redone'.
    case 'redo': {
      if (!ctx.isInitialized()) return 'Browser not initialized. Run init first.';
      if (redoStack.length === 0) return 'Nothing to redo';
    
      const current = await ctx.controller.getCurrentPattern();
      undoStack.push(current);
      if (undoStack.length > maxHistory) undoStack.shift();
    
      const next = redoStack.pop()!;
      await ctx.controller.writePattern(next);
      return 'Redone';
    }
  • Schema definition of the 'redo' tool: name 'redo', description 'Redo action', no input properties.
    {
      name: 'redo',
      description: 'Redo action',
      inputSchema: { type: 'object', properties: {} },
  • HistoryState type definition: contains redoStack (string[]) along with undoStack, historyStack, and maxHistory.
    export interface HistoryState {
      undoStack: string[];
      redoStack: string[];
      historyStack: HistoryEntry[];
      readonly maxHistory: number;
    }
  • Registration: historyModule tools (including 'redo') are spread into the tool list at line 126, and dispatch to historyModule.execute at line 369-371.
    if (historyModule.toolNames.has(name)) {
      return await historyModule.execute(name, args, ctx);
    }
  • redoStack is cleared (set to []) whenever a write/append/insert/replace/clear action occurs, ensuring a clean redo history after new edits (line 329). The redoStack is initialized at line 58 and passed via ctx.history at line 351.
    // Save current state for undo and history (#41) (only if initialized)
    if (['write', 'append', 'insert', 'replace', 'clear'].includes(name) && this.isInitialized) {
      try {
        const current = await this.controller.getCurrentPattern();
        this.undoStack.push(current);
    
        // Add to history stack with metadata (#41)
        this.historyIdCounter++;
        this.historyStack.push({
          id: this.historyIdCounter,
          pattern: current,
          timestamp: new Date(),
          action: name
        });
    
        // Enforce bounds to prevent memory leaks
        if (this.undoStack.length > this.MAX_HISTORY) {
          this.undoStack.shift();
        }
        if (this.historyStack.length > this.MAX_HISTORY) {
          this.historyStack.shift();
        }
        this.redoStack = [];
Behavior2/5

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

No annotations provided. Description fails to disclose any behavioral traits, such as side effects, redo stack depth, or whether it applies to all undoable actions.

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?

Extremely concise at two words, but earns its place by stating the core function. Could be slightly improved with more detail without becoming verbose.

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

Completeness3/5

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

For a simple redo with no parameters, the description is minimally acceptable. However, it does not specify return value or behavior when no action to redo, leaving gaps.

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?

No parameters exist, so baseline is 4, but description adds no explanation that no input is needed. Schema coverage is trivial (100%), so a score of 3 is appropriate.

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?

Description 'Redo action' clearly indicates the tool redoes a previous action, distinguished from sibling 'undo'. However, it lacks specificity about which action is redone.

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

Usage Guidelines2/5

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

No guidance on when to use this tool vs alternatives like 'undo' or other operations. Agent must infer that it follows a previous undo.

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/williamzujkowski/live-coding-music-mcp'

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