Skip to main content
Glama

Edit architecture diagram

edit_diagram

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.

TDQS

A4.4/5.0
Behavior4/5

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

Discloses re-layout/re-render, version conflict handling (STALE_VERSION), and that geometry is computed. No annotations provided, so description bears full burden. Lacks explicit mutation warning or permissions, but adequately transparent.

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?

Well-structured with summary, guidelines, operation list, example, and output description. Slightly verbose but every sentence contributes. Could tighten, but complexity justifies length.

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?

Covers main behaviors, error handling (STALE_VERSION), and return values. No output schema, so description explains url, svg, etc. Missing edge case errors for invalid ops, but overall complete for a complex tool.

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?

Adds heavy value beyond schema: details each operation type, provides worked example, explains insert_between key op, mentions node kinds, and warns not to send x/y/position. Compensates for low schema coverage (67%) on ops array items.

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 the tool applies a list of operations to an EXISTING diagram, using a specific verb and resource. It distinguishes from siblings (create_diagram, get_diagram) by focusing on modification of existing diagrams.

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?

Explicitly instructs to call get_diagram first and explains versioning. Provides a worked example. Could explicitly state not to use for creation, but context and sibling names make it clear.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A4.4/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: create for new diagrams, get for retrieving existing ones, and edit for modifying them. No ambiguity or overlap.

Naming Consistency5/5

All tool names follow the 'verb_diagram' pattern consistently: create_diagram, edit_diagram, get_diagram, making it easy to predict and remember.

Tool Count4/5

Three tools is slightly thin but appropriate for the focused domain of diagram creation and editing. Each tool encapsulates rich functionality.

Completeness2/5

The set lacks a tool for listing or deleting diagrams, which would be expected for a complete CRUD surface. Core create/read/update is covered, but missing delete and list are significant gaps.

Resources