edit_pattern
Change the current Strudel session pattern by writing new code, appending, inserting at a line, replacing text, or clearing the editor.
Instructions
Mutate the current session pattern. mode=write replaces the editor contents (default; mirrors the old write tool exactly, including optional pattern validation and auto_play). mode=append concatenates code after the current pattern with a newline. mode=insert places code at the given line position. mode=replace runs a single string-replace from search to replace. mode=clear empties the editor. Example: edit_pattern({ mode: "write", pattern: "s("bd")", auto_play: true }). For reading the editor without mutating it use get_pattern; for the on-disk pattern catalog use pattern_store.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Which edit operation to perform (default: write) | |
| pattern | No | Pattern code (mode=write) | |
| code | No | Code to append/insert (mode=append/insert) | |
| position | No | Line number (mode=insert) | |
| search | No | Text to replace (mode=replace) | |
| replace | No | Replacement text (mode=replace) | |
| auto_play | No | Start playback after write (mode=write only, default: false) | |
| validate | No | Validate pattern before write (mode=write only, default: true) | |
| session_id | No | Optional session ID (#108). Omit to use default session. |