Skip to main content
Glama

undo

Reverse the most recent change in your Strudel music pattern to correct mistakes or experiment with different compositions.

Instructions

Undo last action

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler logic for the 'undo' tool. It checks if initialized, pops the previous pattern from undoStack, writes it to the controller, pushes current to redoStack, and returns success or 'Nothing to undo'.
    case 'undo': if (!this.isInitialized) { return 'Browser not initialized. Run init first.'; } if (this.undoStack.length > 0) { const currentUndo = await this.controller.getCurrentPattern(); this.redoStack.push(currentUndo); // Enforce bounds to prevent memory leaks if (this.redoStack.length > this.MAX_HISTORY) { this.redoStack.shift(); } const previous = this.undoStack.pop()!; await this.controller.writePattern(previous); return 'Undone'; } return 'Nothing to undo';
  • Schema definition for the 'undo' tool, including name, description, and empty input schema (no parameters required).
    name: 'undo', description: 'Undo last action', inputSchema: { type: 'object', properties: {} }
  • Registration of the tool list handler which returns all tools including 'undo' via getTools().
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: this.getTools() }));
  • Declaration of undoStack and redoStack used by the undo/redo functionality.
    private undoStack: string[] = []; private redoStack: string[] = [];

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/strudel-mcp-server'

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