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.
Behavior4/5

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

No annotations exist, so the description carries full burden. It discloses that ops are validated, applied, re-layout, re-render. It explains the version-based conflict error (STALE_VERSION) and side effects (remove_node also drops edges). It mentions automatic geometry computation. Lacks details on authentication, rate limits, or reversibility, but what is provided is substantial.

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 well-structured: concise overview, critical prerequisite call, enumerated operation list with definitions, worked example, and return fields. Every sentence is informative and earns its place, with key usage warnings 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?

Given the tool's complexity (3 parameters, one being a large array of operations), the description is remarkably complete. It covers prerequisite calls, error handling, all operation semantics, a concrete example, and the return value structure. No output schema exists, but the return fields are listed explicitly.

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 coverage is 67%, but the description compensates thoroughly. It explains each operation type in detail, including behavioral effects (e.g., 'insert_between' splices an edge), constraints (e.g., 'Never send x/y/position'), and formatting guidance. This adds significant meaning beyond the bare schema structure.

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?

The description clearly states 'Apply a list of operations to an EXISTING diagram', specifying the verb (apply), resource (existing diagram), and scope. It distinguishes itself from siblings (create_diagram for new, get_diagram for reads) implicitly through context.

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

Usage Guidelines4/5

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

The description explicitly instructs 'ALWAYS call get_diagram(diagramId) first' and explains version-based conflict handling. It provides a worked example. However, it does not explicitly state when not to use this tool (e.g., for creating a new diagram instead of editing).

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/abhishek-genailytics/flowgraf-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server