clear
Clear the Strudel.cc editor to remove existing patterns and start fresh with new music code.
Instructions
Clear the editor
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- Schema definition for the 'clear' tool: no input parameters required, clears the editor.name: 'clear', description: 'Clear the editor', inputSchema: { type: 'object', properties: {} }
- Handler implementation: calls writePatternSafe('') to clear the current pattern in the editor.case 'clear': return await this.writePatternSafe('');
- src/server/EnhancedMCPServerFixed.ts:571-573 (registration)Registers the listTools handler which returns all tools including 'clear' via getTools().this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: this.getTools() }));
- Helper method used by 'clear' handler to safely write an empty pattern, handling uninitialized state.private async writePatternSafe(pattern: string): Promise<string> { if (!this.isInitialized) { // Store the pattern for later use const id = `pattern_${Date.now()}`; this.generatedPatterns.set(id, pattern); return `Pattern generated (initialize Strudel to use it): ${pattern.substring(0, 50)}...`; } return await this.controller.writePattern(pattern); }