Skip to main content
Glama

Edit architecture diagram

edit_diagram

Apply a sequence of modifications to an existing diagram: add, remove, or update nodes, edges, groups, or insert a node between two connected nodes. Returns updated diagram as SVG, Mermaid, and a live link.

Instructions

Apply a list of operations to an EXISTING diagram. The ops re-use this tool's op vocabulary; you author them, we validate + apply + re-layout + re-render.

ALWAYS call get_diagram(diagramId) first: it returns the current ids and the version. Pass that version as baseVersion. If the diagram changed since you fetched it, you get a STALE_VERSION error telling you the current version — refetch with get_diagram, recompute your ops, and retry.

The operations (each element of ops):

  • add_node { op, node:{ id, label, kind, parentId? } }

  • remove_node { op, id } (also drops edges touching the node)

  • update_node { op, id, patch:{ label?, kind?, parentId?, metadata? } }

  • add_edge { op, edge:{ id, source, target, kind, label?, directed? } }

  • remove_edge { op, id }

  • update_edge { op, id, patch:{ source?, target?, label?, kind?, directed? } }

  • add_group { op, group:{ id, label, type, parentId? } }

  • remove_group{ op, id }

  • move_to_group { op, nodeId, groupId } (groupId null un-nests the node)

  • set_layout { op, patch:{ direction?, spacing? } }

  • insert_between { op, newNode:{ id, label, kind, parentId? }, sourceId, targetId, inKind?, outKind? }

insert_between IS THE KEY OP for "add X between A and B" requests. It splices newNode onto the existing A→B edge: removes that edge, adds the node, and wires A→newNode→B so the connection re-routes through it automatically.

WORKED EXAMPLE — "add a Redis cache between the API and the DB" on the diagram above:

  1. get_diagram(diagramId) → shows nodes n_api, n_db and version 1.

  2. edit_diagram({ diagramId, baseVersion: 1, ops: [ { "op": "insert_between", "sourceId": "n_api", "targetId": "n_db", "newNode": { "id": "n_redis", "label": "Redis", "kind": { "catalog": "saas", "type": "redis" }, "parentId": "g_vpc" }, "inKind": "request", "outKind": "data_flow" } ] }) The API→DB edge is gone and now flows API→Redis→DB. Never send x/y/position — geometry is computed for you.

Node kinds: catalog ∈ {aws, gcp, azure, k8s, saas, generic} with rich per-catalog types (e.g. aws:lambda, gcp:bigquery, azure:cosmos_db, k8s:deployment, saas:kafka), plus generic flowchart kinds (process, decision, terminator, data, document, subprocess).

Returns { url, svg, mermaid, appliedOps, version }.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
opsYes
diagramIdYesThe diagram to edit (from create_diagram or get_diagram).
baseVersionYesThe version you are editing against — get it from get_diagram. Stale → STALE_VERSION.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.2

TDQS

A5/5.0
Behavior5/5

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

With no annotations, the description carries full behavioral burden and succeeds: it discloses validation, apply, re-layout, re-render behavior; stale-version error semantics; automatic geometry computation; and edge-dropping side effects of remove_node. It also explains insert_between's splicing effect on existing edges, making side effects explicit.

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

Conciseness5/5

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

The description is long but structurally dense: prerequisite call, op list, highlighted op, worked example, geometry warning, kind catalog, and return values. Every section earns its place given the tool's complexity, and the most critical usage caveat (fetch version first) is front-loaded.

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

Completeness5/5

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

Since there is no output schema, the description supplies return shape ({ url, svg, mermaid, appliedOps, version }) and key preconditions. It covers op vocabulary, kinds, side effects, and error handling, leaving no critical gap for an agent to invoke the tool correctly on a mutating endpoint.

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

Parameters5/5

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

Schema description coverage is 67% but only at the top level; the ops array itself has no schema description. The description compensates fully by documenting every op variant, required fields, purpose, and a concrete worked example. It adds meaning well beyond the raw JSON schema, especially for insert_between and baseVersion 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?

Description opens with a specific verb+resource: 'Apply a list of operations to an EXISTING diagram.' It clearly differentiates itself from siblings (create_diagram, get_diagram) by targeting existing diagrams and enumerating the mutation operations. The title and purpose align without tautology.

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?

Provides explicit 'ALWAYS call get_diagram(diagramId) first' instructions, including how to handle STALE_VERSION errors and retry. It also gives a worked example for the key op and warns against sending x/y/position, giving the agent clear when-and-how-to-use guidance.

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

Deploy Server

Other Tools