restore_history
Retrieve and restore a previously saved music pattern from history using its unique ID for reuse in Strudel.cc live coding sessions.
Instructions
Restore a previous pattern from history by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | History entry ID to restore |
Implementation Reference
- The handler implementation for the 'restore_history' tool. It checks if the browser is initialized, finds the history entry by ID from this.historyStack, pushes the current pattern to undoStack, writes the restored pattern using the controller, and returns a success message with timestamp.case 'restore_history': if (!this.isInitialized) { return 'Browser not initialized. Run init first.'; } const entryToRestore = this.historyStack.find(e => e.id === args.id); if (!entryToRestore) { return `History entry #${args.id} not found. Use list_history to see available entries.`; } // Save current state before restoring const currentBeforeRestore = await this.controller.getCurrentPattern(); this.undoStack.push(currentBeforeRestore); if (this.undoStack.length > this.MAX_HISTORY) { this.undoStack.shift(); } await this.controller.writePattern(entryToRestore.pattern); return `Restored pattern from history #${args.id} (${this.formatTimeAgo(entryToRestore.timestamp)})`;
- The input schema definition for the 'restore_history' tool, specifying a required 'id' parameter of type number.{ name: 'restore_history', description: 'Restore a previous pattern from history by ID', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'History entry ID to restore' } }, required: ['id'] } },
- src/server/EnhancedMCPServerFixed.ts:419-429 (registration)The tool registration entry in the getTools() array, which includes the name, description, and schema, used by the MCP server to advertise and validate the tool.{ name: 'restore_history', description: 'Restore a previous pattern from history by ID', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'History entry ID to restore' } }, required: ['id'] } },