Skip to main content
Glama
Strudel MCP Server

Strudel MCP Server

edit_pattern

Mutate the current Strudel pattern by writing, appending, inserting, replacing, or clearing code in the editor, with optional validation and auto-play after write.

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 substitutes search with replace — the first occurrence only, unless replace_all is true. The response reports how many occurrences matched, were replaced, and remain. 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

NameRequiredDescriptionDefault
codeNoCode to append/insert (mode=append/insert)
modeNoWhich edit operation to perform (default: write)
searchNoText to replace (mode=replace)
patternNoPattern code (mode=write)
replaceNoReplacement text (mode=replace)
positionNomode=insert: 0-indexed line to insert BEFORE. 0 puts the code at the top; a value equal to the line count appends. Out of range is an error, not an append.
validateNoValidate pattern before write (mode=write only, default: true)
auto_playNoStart playback after write (mode=write only, default: false)
session_idNoOptional session ID (#108). Omit to use default session.
replace_allNomode=replace: replace every occurrence instead of just the first (default false)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv4.1.1
    • changedInput schema / properties / position / description
      Previous value: -"Line number (mode=insert)"New value: +"mode=insert: 0-indexed line to insert BEFORE. 0 puts the code at the top; a value equal to the line count appends. Out of range is an error, not an append."
    • addedInput schema / properties / replace_all
      Added value: +{
      +  "description": "mode=replace: replace every occurrence instead of just the first (default false)",
      +  "type": "boolean"
      +}
  2. Addedv4.0.0

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden well: it discloses that the default mode replaces editor contents entirely, that write mirrors the old write tool including validation and auto_play, that replace touches only the first occurrence unless replace_all, that the response reports matched/replaced/remaining counts, and that clear wipes the editor. What is missing is whether mutations are undoable/recoverable via history and whether a session must exist first, so it falls short of a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose, then one sentence per mode, then alternatives and an example. Every sentence maps to a distinct behavior, though the mode enumeration partially duplicates the enum documentation in the schema and could be slightly tighter.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 10-parameter, five-mode mutation tool with no output schema, the description covers mode behavior, defaults, the shape of the response counts, and routing to sibling tools. The remaining gap is side-effect and recoverability context (does an overwrite lose prior work, is there an undo path through history), which matters for a destructive-capable tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and each parameter already carries a mode-scoped description, so the baseline is 3. The description adds cross-parameter meaning the schema cannot express — which parameter pairs are active for which mode — plus a concrete example call combining mode, pattern, and auto_play, which is real added value but largely restates mode semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("Mutate the current session pattern") and then enumerates all five modes, each with its precise effect. It explicitly differentiates itself from siblings get_pattern (read) and pattern_store (on-disk catalog), so an agent can tell exactly which tool owns editor mutation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives per-mode conditions of use (write replaces, append concatenates with newline, insert at position, replace uses search/replace, clear empties) and names the alternatives plus the condition that selects them: get_pattern when reading without mutating, pattern_store for the disk catalog. Nothing about tool selection is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.