Edit Mermaid diagram
mutateApply a list of structured edit ops to an existing Mermaid source and
return the edited diagram. This is the declarative counterpart to execute:
plain JSON in, plain JSON out, no sandbox. Prefer it for straightforward edits;
reserve execute for logic the ops don't express.
Returns { ok, family, source, verify:{ ok, warnings } } on success, or
{ ok:false, family, opIndex, error } — where error names the offending field
and lists the valid ones — when an op is malformed or cannot apply. Ops apply in
order and are all-or-nothing: the first failing op stops the batch (its position
is opIndex) and the input is left untouched.
Each op is { "kind": , …fields }. Call describe_sdk for the detected
family before authoring unfamiliar ops; it returns compact signatures or exact
field types, enum values, defaults, and constraints.
Set mode to source-preserving for supported edits to opaque Class or Flowchart
source. Exact edited bytes and portability warnings are retained; unsupported
operations still fail atomically. This mode does not promise portable export.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"source": "<source>",
"ops": "<ops>"
},
"name": "mutate"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | Yes | Non-empty ordered list of edit ops; each is { kind, ...fields }. | |
| mode | No | Source-preserving mode edits owned source ranges without regenerating unsupported syntax. | structured |
| source | Yes | Mermaid source to edit. |