append
Add code to extend existing music patterns in Strudel for live coding and AI-powered music generation.
Instructions
Append code to current pattern
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Code to append |
Implementation Reference
- Executes the 'append' tool: validates the code length, retrieves the current pattern safely, appends the new code with a newline, and writes the updated pattern back.case 'append': InputValidator.validateStringLength(args.code, 'code', 10000, true); const current = await this.getCurrentPatternSafe(); return await this.writePatternSafe(current + '\n' + args.code);
- src/server/EnhancedMCPServerFixed.ts:93-102 (registration)Registers the 'append' tool with its name, description, and input schema in the getTools() method.{ name: 'append', description: 'Append code to current pattern', inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'Code to append' } }, required: ['code'] }
- Defines the input schema for the 'append' tool, requiring a 'code' string parameter.inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'Code to append' } }, required: ['code']
- src/StrudelController.ts:423-432 (helper)Helper method in StrudelController that appends code to the current pattern by fetching it, concatenating, and writing back (similar logic to the tool handler).async appendPattern(code: string): Promise<string> { if (!this._page) { throw new Error('Browser not initialized. Run init tool first.'); } const current = await this.getCurrentPattern(); const newPattern = current + '\n' + code; return this.writePattern(newPattern); }