replace
Find and substitute text patterns in Strudel music code to modify sequences, adjust parameters, or update musical elements during live coding sessions.
Instructions
Replace pattern section
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search | Yes | Text to replace | |
| replace | Yes | Replacement text |
Implementation Reference
- Handler for the 'replace' MCP tool: validates search and replace string lengths, gets current pattern, replaces the first occurrence of search with replace, then writes the result via writePatternSafe.
case 'replace': InputValidator.validateStringLength(args.search, 'search', 1000, true); InputValidator.validateStringLength(args.replace, 'replace', 10000, true); const pattern = await this.getCurrentPatternSafe(); const replaced = pattern.replace(args.search, args.replace); return await this.writePatternSafe(replaced); - src/server/EnhancedMCPServerFixed.ts:116-127 (registration)Registration of the 'replace' tool in getTools() array, including description and input schema (object with required 'search' and 'replace' strings).
{ name: 'replace', description: 'Replace pattern section', inputSchema: { type: 'object', properties: { search: { type: 'string', description: 'Text to replace' }, replace: { type: 'string', description: 'Replacement text' } }, required: ['search', 'replace'] } },