Skip to main content
Glama
601,525 tools. Updated 2026-09-23 01:42

"Mermaid" matching MCP tools:

  • Replace a workspace's doc body. Takes EITHER TipTap JSON (`content`) OR Markdown (`markdown`): pass markdown when you're producing prose from scratch (CommonMark + GFM is the format every LLM emits natively), pass TipTap JSON when you need structural edits to an existing doc (round-trip from get_doc, mutate, write back). Beyond CommonMark + GFM, the markdown layer recognizes: - **![alt text](https://…)** → inline image. Use ANY publicly-reachable URL (HTTPS preferred — HTTP fires browser mixed-content warnings; data: URIs are rejected by `allowBase64: false`). Renders block-feeling via CSS (max-width 100%, rounded corners, drop shadow) even though the underlying node is inline. The `alt` text is the accessible label and shows in place of the image if the URL fails to load — always include it. To attach a user-uploaded file, hit `POST /api/workspaces/:slug/upload-image` from the human-side UI first to get a Vercel Blob URL, then reference that URL in the doc markdown. - A **lone video-file URL on its own line** (extension `.mp4` / `.m4v` / `.webm` / `.mov` / `.mkv`, signed-params + timestamp fragments tolerated) → native HTML5 `<video controls preload="metadata">` player. Source URL is referenced directly: no iframe, no transcoding, no quality loss. Vercel Blob is the canonical hosting (5 GB per file, served with HTTP range requests so 4K masters stream cleanly), but ANY publicly-reachable HTTPS URL works. Sample shape: a paragraph containing only `https://cdn.dock.ai/2025-launch-walkthrough.mp4`. Mid-paragraph URLs stay as plain links — surrounding prose disqualifies the auto-promotion (matches the oEmbed convention). - **```mermaid** fenced code → diagram (15 sub-types: flowchart, sequence, gantt, ER, state, class, mindmap, timeline, pie, quadrant, sankey, XY-chart, packet, block, journey) - **$x$** inline math, **$$x$$** block math (LaTeX, KaTeX-rendered, scripts/href disabled) - **> [!NOTE]** / **[!TIP]** / **[!IMPORTANT]** / **[!WARNING]** / **[!CAUTION]** GFM-style callouts - **```svg** fenced code → sanitized SVG embed (the universal escape hatch for custom diagrams; scripts and event handlers stripped at write time) - **<details><summary>X</summary>BODY</details>** → collapsible toggle - **[[slug]]** / **[[org/slug]]** / **[[slug#tab]]** / **[[slug#row-id]]** / **[[slug|display]]** → cross-references to another workspace, surface, or row. Resolved against your accessible workspace set; targets you can't see render as plain text on the reader's side (no info leak). Every cross-ref creates a Backlink row so the target's 'referenced from' sidebar shows this doc. - **[@Label](dock:mention/<kind>/<id>)** → @-mention of a user or agent. `<kind>` is `agent` or `human`; `<id>` is the principal id. Optional query params `?org=<slug>` (agents) or `?email=<addr>` (humans) for renderer hints. Mentioning a human writes a `doc_mention` row to their inbox + sends a deep-link email; mentioning an agent fires the `doc.mention_added` webhook so the agent service can wake up and reply. Re-saving a doc that already mentions someone does NOT re-fire — only newly-added mentions notify (computed from a diff against the previous body). Use this from agent code to ping a teammate when a doc you wrote needs their eyes. - A **lone URL on its own line** from a safelisted provider (YouTube, Vimeo, Loom, Figma, CodePen, GitHub gists) → sandboxed iframe embed. Other URLs stay as regular links. Surrounding prose disqualifies the auto-embed. Per-format caps: max 50 Mermaid diagrams (30 KB source each), max 500 math expressions (8 KB source each), max 50 SVG blocks (100 KB source each post-sanitize), max 200 cross-refs per doc, max 500 @-mentions per doc, max 20 embeds per doc, max 20 videos per doc (5 GB per file at upload time), max 200 images per doc. See /docs/doc-formats for examples. Last-write-wins; no CRDT merge. Emits doc.updated + doc.heading_added + doc.mention_added events as applicable. Requires editor role. Multi-surface workspaces optionally accept `surface_slug` to write to a specific doc tab; omitted writes the primary doc surface. Append-only updates have a dedicated `append_doc_section` tool that doesn't require fetching the body first.
    ConnectorNo auth
  • Replace a single section of a workspace's doc body, identified by its heading text. The targeted edit complement to `update_doc` (full replacement) and `append_doc_section` (append-only at the end). Use this when the agent maintains a recurring section (e.g., a 'Status' block in a launch-prep doc, an 'Outcomes' block in a meeting note) and only needs to refresh that one piece. Without it, agents are forced into 'GET → splice → PUT' which costs tokens, costs latency, and races against any concurrent human edit elsewhere in the doc (last-write-wins clobbers). Section semantics: the FIRST heading whose plain text matches `heading` exactly (case-sensitive on trimmed text) is found, and everything from that heading up to the next heading at the same OR shallower level is replaced. So a `## Outcomes` section ends at the next `## …` or `# …`; nested `### …` subsections stay part of the replaced range. Returns 404 when no matching heading exists; strict by design so a misremembered heading fails loudly. `markdown` is the FULL replacement, INCLUDING the heading line: pass it back as-is to keep the heading, change it to rename or rewrite the heading, change the heading level, or omit the heading entirely (collapses the section into the prior one). Empty `markdown` deletes the section. Same markdown surface as update_doc / append_doc_section (CommonMark + GFM + `![alt](url)` images + lone-URL videos (mp4/webm/mov/mkv/m4v) + Mermaid + KaTeX + callouts + SVG + details + cross-refs + @-mentions + URL embeds). Identity / attribution / events / doc-guard all flow through the same writeDocBody path as the other doc endpoints, so @-mentions in the new section fire `doc.mention_added` for newly-added mentions just like update_doc does. Requires editor role. Multi-surface workspaces optionally accept `surface_slug` to target a specific doc tab. WARNING — a section runs to the next heading of the SAME OR SHALLOWER level, so targeting the LAST heading (or a lone H1) means its section extends to the END OF THE DOCUMENT and this call replaces everything below it. That has silently destroyed a doc twice (#8196), both times returning success. Call `get_doc` first and check which headings follow the one you are targeting. Agent writes that would drop most of the doc's blocks are now REFUSED with both block counts; pass `allowBlockLoss: true` to confirm an intended large deletion.
    ConnectorNo auth
  • Apply 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": <op>, …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.
    ConnectorNo auth
  • Generate a Mermaid.js flowchart for human visual inspection only. NOT for orphan detection or programmatic analysis — use audit(mode=orphans) to find isolated memories. Output may be truncated for large domains; never infer graph properties (e.g. orphans) from a truncated result. Pass memory_id (memory ID) to see a single memory and all its direct connections. Pass domain to see the full domain graph (most-connected memories first, capped at limit, default 40 max 100). Returns JSON with mermaid, node_count, edge_count, nodes_shown, nodes_total, edges_shown, edges_total, truncated, memories([{id,label}]) and connections([{from,to,relationship}]). If client supports HTML widgets, prefer passing memories and connections to an interactive renderer rather than outputting raw mermaid. If not, output mermaid inside a ```mermaid code block. If truncated is true, note only most-connected memories are shown and nodes_total/edges_total reveal what was dropped.
    ConnectorAPI key
  • 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 }.
    ConnectorNo auth
  • Render Mermaid source with Line9's layout engine. Call this whenever you write or change Mermaid and the user should see the result. Flowcharts and sequence diagrams get Line9's layout; other Mermaid kinds are rendered with Mermaid's own layout and flagged as such. Returns a short verdict — kind, size, warnings, or a parse error with its line and column — plus an "Open in Line9" link. On a parse error, fix the named line and call again. Assistants that support MCP Apps show the diagram in a panel; there, do not paste the SVG or repeat the source in your reply. In an assistant with no panel (a terminal or editor), reply with the verdict line and the `open_url` link — that link is the only way the user sees the diagram. Write flowcharts as `flowchart LR` unless the user asks for top-to-bottom; chat panels are wide and short. No sign-in needed; renders carry a small Line9 mark unless the user is signed in to Line9 Pro. Set theme, orientation, spacing and legend in the source itself (`line9:` frontmatter; `flowchart LR`), never as arguments. This connector cannot publish or save. To publish, the user opens the diagram in Line9 (the `open_url` link) and publishes there — not with the Line9 CLI.
    ConnectorNo auth

Matching MCP Servers

Matching MCP Connectors

  • Render, verify, describe, and safely edit Mermaid diagrams through MCP.

  • Generate dynamic Mermaid diagrams and charts with AI assistance. Customize styles and export diagr…

  • [cost: free (pure CPU, no network) | read-only, no persistence] Reduce a raw SIP trace to a compact form suitable for sending to an LLM. Preserves SDP bodies and routing/auth/dialog headers; prunes well-known noise (User-Agent, Server, Allow, Accept-*, Date, P-* informational, etc.). Expected input format: raw SIP messages separated by blank lines, each starting with a request line (`INVITE sip:...@... SIP/2.0`) or status line (`SIP/2.0 200 OK`). PCAP-decoded text from sngrep / ngrep / tcpdump / tshark, syslog with SIP body, sipflow's own export format, or a hand-pasted INVITE/200 dialog all work. Annotation lines like `# [timestamp] sender -> receiver` or ngrep-style `U <ip>:<port> -> <ip>:<port>` between blocks are tolerated. Safe to run on production traces - the input is processed in-memory and is not persisted or sent off-server. Pair with: `detect_sip_stack` to identify the vendor, then `search_sip_docs(vendor=...)` for vendor-grounded analysis; `render_sip_ladder` to visualize the trace as a Mermaid call-flow ladder; `lint_sip_request` / `parse_sip_message` to mechanically validate any single message in the trace.
    ConnectorNo auth
  • Turns YOUR repo classification (you scan the repo and pass what you found) into a complete, approvable deploy plan WITHOUT creating anything. ⚡ REDU NEEDS THREE FILES IF THEY EXIST - redu.md, the compose file, the Dockerfile - and there are two ways to give them. ⭐ BEST, for an upload-mode deploy: run prepare_upload FIRST and pass its `source_token`; redu reads all three straight out of the upload you already made, the upload stays deployable, and you emit nothing. Pasting the same files costs you 20-29 KB of output for bytes the server already has. Otherwise (git mode) paste `redu_md` (cat redu.md), `compose_yaml`, `dockerfile`. Either way you do NOT read or interpret them; redu parses them SERVER-SIDE and returns (a) a short digest, (b) `pin_dname` so a redeploy keeps the SAME public URL, and (c) `preflight` - preemptive fixes for known failure patterns found in YOUR repo, each learned from a real failed build. Giving redu these files is the single highest-value thing you can do for a first deploy. picks the VM + managed-Postgres sizes, prices them at the real pricing_rules rates, and checks they FIT your quota — so a plan that can't provision is caught HERE, before any spend. You pass what you detected in the repo (runtime, port, needs_postgres/redis/clickhouse/vector_db); it returns resources + £/hr + £/mo + a feasibility verdict + a checkpoint summary to confirm with the user. Defaults: app VM m1.medium, managed Postgres m1.small, managed ClickHouse m1.medium; pass single_vm to collapse the app + Postgres onto one VM. SET needs_clickhouse:true FOR ANY ANALYTICS-SHAPED APP (Plausible, PostHog, Langfuse, Matomo, SigNoz, or anything with a clickhouse image / CLICKHOUSE_* env / a ClickHouse client dep): those products keep config in Postgres and EVERY EVENT in ClickHouse, so the events tier is a second VM with a second line on the bill: measured 2026-08-07, omitting it quoted GBP 53.29/mo for a GBP 65.99/mo deployment. It is sized, quota-checked and priced here; unlike Postgres and Redis it is not auto-wired by deploy_app, so the plan tells you to run plan_managed_datastore engine:'clickhouse' -> create_clickhouse and pass CLICKHOUSE_* env yourself. Vector-DB needs are flagged, not provisioned. Any containerizable app works (node, python, go, ...) — it deploys as a container, so the language doesn't gate it. Set serves_http:false for a non-web repo (a library, CLI, or language runtime with no HTTP server) and it returns a clean not-a-web-service verdict instead of a costed VM plan. Set heavy_build:true for resource-heavy builds (compiled-from-source native code, a monorepo/turborepo build, a large Node heap) and it raises the app VM to a build-capable floor so the on-VM build doesn't get OOM-killed. Set memory_heavy:true for a RAM-forward app whose persistent state lives in a MANAGED DB / external store (Next.js like cal.com/cal.diy, Rails, Django, JVM/Java apps) — it sizes onto a memory-optimized SMALL-DISK flavor (m1.mem16/m1.mem32: full RAM, a lean 40 GB disk instead of 160 GB) that costs less and snapshots/clusters far faster; do NOT set it if the app keeps lots of data on local disk. Also returns a brand-named markdown report (Mermaid diagram + cost) to save as redu-deploy-plan.md and show the user. Every deploy leaves TWO MANDATORY files at the repo root with DIFFERENT purposes: redu-deploy-plan.md = THIS run's plan/estimate, and redu.md = the DURABLE deploy memory the NEXT deploy reads. If a redu.md exists, READ it FIRST and reuse its known-good plan + recorded fixes; if NONE exists, one MUST be created at the end of the deploy (get_deployment returns redu_md_bootstrap_markdown for exactly that case; when a redu.md DOES exist, pass it as redu_md and write the merged redu_md_markdown). They are SEPARATE files — even if your own memory/notes from a prior deploy call redu-deploy-plan.md 'the record', the durable record is redu.md, so do not skip creating it.
    ConnectorNo auth
  • Publish an artifact — deploys its committed files (git HEAD; uncommitted edits are not included) to a live public URL. Works for app AND markdown artifacts; an asset artifact cannot be published (tell the user so and share its artifactUrl instead). Publishing makes the content PUBLIC to the world. It is NOT needed for sharing — the artifact is already visible at its artifactUrl to everyone who can reach it, and liveUrl is NOT an editor. Call this only when the user explicitly asked to publish/deploy; otherwise share that URL and offer publishing as a follow-up question. Requires a sessionId from a previously created artifact (via artifact-create). **What goes live:** - app: the running web application. - markdown: one document. liveUrl renders the initial file (README.md if present, else the first .md lexicographically); the raw source is at <liveUrl without the query string>/index.md (Content-Type: text/markdown) — give the user that path when they want the markdown. Other .md files are served raw at their own paths, each with a rendered .html sibling. ```mermaid fences render as diagrams; the .md keeps the fence. accTitle/accDescr label a diagram. **Modes:** - "webapp" (default): Deploys to a live URL; use it for both app and markdown artifacts. Returns { success, liveUrl, subdomain }. - "designSystem": NOT available over MCP — always fails with an enterprise contact link, whatever you pass. Do not offer it as a capability. **Returns:** { success, liveUrl, subdomain }
    Connector
    Destructive
    OAuth
  • Get the whole entity graph, or a filtered part of it, in a chosen format: json for the canonical document, jsonld for a validator, mermaid or markdown to read in a conversation, dot or graphml for a graph tool. Defaults to json. Takes the same filters as list_entities. mermaid caps declared entities at 150 and markdown caps rows at 50, and both say so in truncation; json, jsonld, dot and graphml apply no node cap. No cap is not the same as complete: every format renders the stored map, and on the local server that map carries no per-edge page list and no per-page reference list, so those arrays are empty because they were never stored rather than because nothing matched. mermaid's cap bounds declared entities only, so one entity referencing thousands of undeclared ids still renders thousands of placeholder nodes. Not every server implements every format: one that does not will say so rather than return an empty or partial graph, so read the error rather than treating a refusal as a site with nothing to draw. Fix-and-verify loop: call list_entities with problem="no-id" to find entities declared on several pages with nothing to tie them together, give each one an absolute @id, re-run the audit with run_audit, then call compare_entities and check that gainedId contains the keys you fixed. gainedId is the only confirmation that the fix landed: an entity that gained an @id changes key, so it would otherwise look like one removal plus one addition. Check each entry's coverage field before calling it done: "proven" means the newer audit visited every page that declared the broken version AND found the replacement on all of them, "partial" means one of those could not be established.
    ConnectorNo auth
  • [cost: free (pure CPU, no network) | read-only] Parse a raw SIP trace (PCAP-decoded text, sngrep export, syslog, or pasted INVITE/200 dialog) and emit a Mermaid `sequenceDiagram` block visualizing the call flow. Most chat hosts (Claude, ChatGPT, Cursor, GitHub) render Mermaid inline. Lane keying: by default participants are keyed by IP, not `ip:port`, so an endpoint that sends from an ephemeral source port and listens on 5060 collapses into one column. Multi-port IPs list their ports in the participant label (e.g. `10.0.0.1 :5060,:53412`) and arrows touching them get a `(:srcPort→:dstPort)` suffix. Pass `groupByIp: false` to restore the legacy one-column-per-`ip:port` layout. Lane labeling: aliases are matched against (in order) `${ip}:${port}` from message source/dest, then bare `${ip}`, then top-Via host, then Contact host. The most-specific match wins. When no alias matches the renderer falls back to the peer's address rather than emitting `unknown:5060`. Pair with: `minimize_sip_trace` first to compact a noisy trace; `diff_sip_messages` when two adjacent INVITEs in the ladder differ unexpectedly; `lint_sip_request` to validate a single message you pulled from the ladder.
    ConnectorNo auth
  • [cost: free (pure CPU, no network) | read-only] Return a hand-curated SIP scenario as a Mermaid `sequenceDiagram` plus a bullet list of step-by-step explanations with RFC references. Use this when the user asks 'show me what X looks like' and you don't have a real trace handy. Available scenarios: basic-call, auth-challenge, cancel-before-answer, early-media, hold-resume, refer-blind, proxy-with-record-route, shaken-attested-invite, bye-glare, redirect-302. Pair with: `search_sip_docs` for vendor-specific quirks of the scenario; `render_sip_ladder` if the user does have a real trace.
    ConnectorNo auth
  • Render a Mermaid diagram definition and return the image with metadata. The definition should be valid Mermaid syntax (e.g. flowchart, sequence, class, ER, state, or Gantt diagram). Returns a list of content blocks: the rendered image plus a JSON text block with metadata including a mermaid.live edit link for opening the diagram in a browser editor. Args: definition: Mermaid diagram definition text. filename: Output filename without extension. format: Output format — ``"png"`` (default), ``"svg"``, or ``"pdf"``. download_link: If True, return a temporary download URL path (/images/{token}) that expires after 15 minutes; if False, return inline image bytes. Defaults to True (URL) — set ``DIAGRAMS_INLINE_DEFAULT=true`` on the server to flip the default. SVG/PDF and PNGs larger than the inline limit always use a download link.
    ConnectorNo auth
  • Append a chunk of Markdown to the END of a workspace's doc body. Designed for crons + ingest agents that produce content in timestamped chunks (changelog updates, daily standups, batch summaries). Same markdown surface as update_doc: supports CommonMark, GFM, **`![alt](url)` inline images** (any publicly-reachable HTTPS URL), **lone video URLs** (`.mp4`/`.webm`/`.mov`/`.mkv`/`.m4v` → native `<video>` player, 5 GB per file), ```mermaid diagrams, $math$/$$math$$ KaTeX, > [!NOTE]/[!TIP]/[!IMPORTANT]/[!WARNING]/[!CAUTION] callouts, ```svg sanitized embeds, <details><summary>X</summary>...</details> toggles, [[slug]] cross-references, [@Label](dock:mention/<kind>/<id>) @-mentions of users + agents, and lone-URL embeds (YouTube/Vimeo/Loom/Figma/CodePen/gists). Server fetches the current body, splices the new blocks on, and writes the result through the same path as update_doc with the same auth, same events, same byte/depth/node-count guard. Append is non-idempotent by design (every call adds content); the caller is responsible for dedupe. @-mentions inside the appended chunk fire `doc.mention_added` + inbox/email fan-out for newly-added mentions only — appending a chunk that re-mentions someone already mentioned earlier in the doc won't re-fire. Requires editor role. Multi-surface workspaces optionally accept `surface_slug` to append to a specific doc tab.
    ConnectorNo auth
  • Run JavaScript in an isolated sandbox; return a value. One call composes edits. Submit JavaScript; declaration types are guidance. No promises, async/await, dynamic import, or type annotations. Hosted note: execute runs in an on-demand isolate and costs more than the direct render_svg/render_ascii/render_png/verify/describe tools — prefer those for plain render/verify calls. For straightforward structured edits, prefer the declarative mutate/build tools; reserve execute for logic the ops don't express. Hosted mermaid.renderMermaidSVG*, renderMermaidASCII*, and layoutMermaidWithReceipt calls force security:'strict' and embedFontImport:false; caller code cannot weaken that host policy. SDK declaration: type DiagramKind = 'flowchart' | 'state' | 'sequence' | 'timeline' | 'class' | 'er' | 'journey' | 'architecture' | 'xychart' | 'pie' | 'quadrant' | 'gantt' | 'mindmap' | 'gitgraph' | 'radar' type MutationOp = { kind: string; [field: string]: unknown } type Result<T, E = { code: string; message: string }> = { ok: true; value: T } | { ok: false; error: E } interface SourceLocation { readonly line: number; readonly col: number } interface SourceMapSpans { readonly preserved: PreservedSourceSpans; readonly nodes: ReadonlyMap<string, SourceSpan>; readonly edges: ReadonlyMap<string, SourceSpan>; readonly groups: ReadonlyMap<string, SourceSpan>; readonly labels: ReadonlyMap<string, SourceSpan> } interface SourceMap { readonly nodes: ReadonlyMap<string, SourceLocation>; readonly edges: ReadonlyMap<string, SourceLocation>; readonly groups: ReadonlyMap<string, SourceLocation>; readonly labels: ReadonlyMap<string, SourceLocation>; readonly spans?: SourceMapSpans } interface ValidDiagram { readonly kind: DiagramKind; readonly source: SourceMap } type ExternalFamilyId = `family:${string}` interface ExtensionCompatibility { readonly [contract: string]: string | undefined readonly core?: string readonly scene?: string } interface ExtensionProvenance { readonly owner: string; readonly source: string; readonly reference?: string } interface ExtensionIdentity<Kind extends string = string> { readonly id: `${Kind}:${string}` readonly kind: Kind readonly version: string readonly compatibility: ExtensionCompatibility readonly provenance: ExtensionProvenance } interface SourceSpanPoint { readonly offset: number; readonly line: number; readonly col: number } interface SourceSpan { readonly start: SourceSpanPoint; readonly end: SourceSpanPoint } interface PreservedSourceSpans { readonly source: SourceSpan readonly wrapper?: SourceSpan readonly frontmatter?: SourceSpan readonly initDirectives?: readonly SourceSpan[] readonly accessibilityDirectives?: readonly SourceSpan[] readonly header: SourceSpan readonly body: SourceSpan } interface SourcePreservationReceipt { readonly version: 1 readonly classification: 'unsupported' | 'inventory-only' | 'unknown' readonly source: string readonly header: string readonly upstreamFamilyId?: string readonly mermaidVersion: string readonly spans?: PreservedSourceSpans } interface ParseError { readonly code: string readonly message: string readonly line?: number readonly col?: number readonly preservation?: SourcePreservationReceipt readonly help?: string } interface ExtensionValidDiagram { readonly kind: ExternalFamilyId readonly descriptorIdentity: ExtensionIdentity<'family'> readonly source: SourceMap } interface PreservedValidDiagram { readonly kind: ExternalFamilyId readonly source: SourceMap readonly body: { readonly kind: 'preserved' readonly representation: 'opaque' | 'unknown' readonly source: string readonly preservation: SourcePreservationReceipt readonly spans: PreservedSourceSpans readonly diagnostic: { readonly code: 'UNSUPPORTED_FAMILY' | 'UNKNOWN_HEADER' | 'FAMILY_DESCRIPTOR_MISMATCH' readonly message: string readonly help: string } } } type ParsedDiagram = ValidDiagram | ExtensionValidDiagram | PreservedValidDiagram type RenderedRegionKind='node'|'edge'|'label'|'canvas'|'group'|'cluster'|'lane'|'band'|'compartment'|'plot'|'ring' type DiagramActionSecurity='safe'|'unsafe'|'source-only'|'unsupported' interface RenderedRegion { id:string;kind:RenderedRegionKind;elementId?:string;parentId?:string;bounds:{x:number;y:number;w:number;h:number};sourceLine?:number } interface DiagramActionRecord { id?:string;regionId?:string;family:DiagramKind;target:string;action:'href'|'call'|'callback';raw:string;line?:number;href?:string;security:DiagramActionSecurity;executable:false;message?:string } interface RenderedLayout { version: 1; kind: DiagramKind | ExternalFamilyId; bounds: { w: number; h: number }; nodes: unknown[]; edges: unknown[]; groups: unknown[]; regions?: RenderedRegion[]; actions?: DiagramActionRecord[] } interface VerifyResult { ok: boolean; warnings: unknown[]; layout: RenderedLayout } type CheckMermaidSpec = string[] | { include?: string[]; exclude?: string[]; exact?: boolean } interface CheckMermaidResult { ok: boolean; missing: string[]; unexpected: string[]; facts: string[] } type MermaidConfigScalar = string | number | boolean | null type MermaidConfigValue = MermaidConfigScalar | MermaidConfigValue[] | { [key: string]: MermaidConfigValue | undefined } type MermaidRuntimeConfig = { [key: string]: MermaidConfigValue | undefined } interface StyleColors {bg?:string;fg?:string;line?:string;accent?:string;muted?:string;surface?:string;border?:string} type SceneStyleRole="node"|"edge"|"edge-label"|"group"|"group-header"|"label"|"actor"|"lifeline"|"activation"|"message"|"block"|"note"|"class-box"|"member"|"entity"|"attribute"|"relationship"|"cardinality"|"pie-slice"|"legend"|"bar"|"series"|"point"|"axis"|"grid"|"plate"|"section"|"task"|"milestone"|"marker-line"|"rail"|"period"|"event"|"score"|"actor-pill"|"service"|"junction"|"icon"|"title"|"defs"|"prelude"|"chrome" type ExactSceneStyleRole="node"|"edge"|"group"|"group-header"|"label"|"actor"|"relationship"|"pie-slice"|"legend"|"bar"|"series"|"point"|"task"|"milestone" type BindableSceneStyleRole="group-header"|"actor"|"relationship"|"pie-slice"|"legend"|"bar"|"series"|"point"|"task"|"milestone" type RoleStyleSpec={"fontFamily"?:string;"fontSize"?:number;"fontWeight"?:number;"letterSpacing"?:number;"textTransform"?:"uppercase"|"lowercase"|"capitalize";"textColor"?:string;"paddingX"?:number;"paddingY"?:number;"cornerRadius"?:number;"lineWidth"?:number;"bendRadius"?:number;"fillColor"?:string;"borderColor"?:string;"strokeColor"?:string;"headerFillColor"?:string;"cue"?:"none"|"outline"|"double-line"|"pattern"} type RoleStyleFor<R extends ExactSceneStyleRole>=R extends "node"|"actor"?Pick<RoleStyleSpec,"borderColor"|"cornerRadius"|"fillColor"|"fontSize"|"fontWeight"|"letterSpacing"|"lineWidth"|"paddingX"|"paddingY"|"textColor"|"textTransform">:R extends "edge"|"relationship"?Pick<RoleStyleSpec,"bendRadius"|"fontSize"|"fontWeight"|"letterSpacing"|"lineWidth"|"strokeColor"|"textColor"|"textTransform">:R extends "group"?Pick<RoleStyleSpec,"borderColor"|"cornerRadius"|"fillColor"|"fontFamily"|"fontSize"|"fontWeight"|"headerFillColor"|"letterSpacing"|"lineWidth"|"paddingX"|"paddingY"|"textColor"|"textTransform">:R extends "group-header"?Pick<RoleStyleSpec,"borderColor"|"cue"|"fillColor"|"fontFamily"|"fontSize"|"fontWeight"|"letterSpacing"|"lineWidth"|"strokeColor"|"textColor"|"textTransform">:R extends "label"?Pick<RoleStyleSpec,"fontSize"|"fontWeight"|"letterSpacing"|"textColor"|"textTransform">:R extends "pie-slice"|"task"|"milestone"?Pick<RoleStyleSpec,"borderColor"|"cue"|"fillColor"|"lineWidth"|"strokeColor">:R extends "legend"?Pick<RoleStyleSpec,"borderColor"|"fillColor"|"lineWidth"|"strokeColor"|"textColor">:R extends "bar"|"point"?Pick<RoleStyleSpec,"borderColor"|"fillColor"|"lineWidth"|"strokeColor">:R extends "series"?Pick<RoleStyleSpec,"borderColor"|"lineWidth"|"strokeColor">:never type RoleStyles={[R in ExactSceneStyleRole]?:Readonly<RoleStyleFor<R>>} type SemanticBindingChannel="category" interface SemanticBinding {channel:SemanticBindingChannel;value:string;slot:string;role?:BindableSceneStyleRole} type BrandConstraint={kind:"contrast";action:'warn'|'error';role?:SceneStyleRole;minimum?:number}|{kind:"accent-area";action:'warn'|'error';maxFraction:number}|{kind:"mono-role";action:'warn'|'error';role:SceneStyleRole} interface StyleSpec {"formatVersion"?:1;"$schema"?:string;"name"?:string;"blurb"?:string;"colors"?:StyleColors;"font"?:string;"roles"?:RoleStyles;"semanticSlots"?:Readonly<Record<string,Readonly<RoleStyleSpec>>>;"bindings"?:readonly SemanticBinding[];"constraints"?:readonly BrandConstraint[];"stroke"?:"crisp"|"jittered"|"freehand";"roughness"?:number;"bowing"?:number;"passes"?:number;"strokeWidth"?:number;"fill"?:"none"|"hachure"|"solid"|"wash";"hachureAngle"?:number;"hachureGap"?:number;"fillWeight"?:number;"washOpacity"?:number;"washEdge"?:number;"backdrop"?:"plain"|"paper-ruled"|"grid";"intent"?:"premium"|"draft"|"lofi";"mono"?:boolean} type StyleInput=string|StyleSpec type ArchitectureVisualOverrides = Readonly<Record<string, unknown>> interface SharedRenderOptions { bg?:string;fg?:string;line?:string;accent?:string;muted?:string;surface?:string;border?:string;font?:string;style?:StyleInput | StyleInput[];padding?:number;nodeSpacing?:number;layerSpacing?:number;wrappingWidth?:number;componentSpacing?:number;transparent?:boolean;interactive?:boolean;shadow?:boolean;class?:{ hierarchicalNamespaces?:boolean };architecture?:{ visual?:ArchitectureVisualOverrides };timeline?:{ maxWidth?:number };journey?:{ experienceCurve?:boolean };gantt?:{ dependencyArrows?:boolean; criticalPath?:boolean };mermaidConfig?:MermaidRuntimeConfig;embedFontImport?:boolean;compact?:boolean;idPrefix?:string;security?:'default' | 'strict';ganttToday?:string;seed?:number;} interface ConfigDiagnostic { code: 'INEFFECTIVE_CONFIG'; field: string; message: string } interface TerminalProjectionDiagnostic { code: string; feature: string; message: string } interface SvgRenderOptions extends SharedRenderOptions { onConfigDiagnostic?:(diagnostic: ConfigDiagnostic) => void;} interface AsciiRenderOptions extends SharedRenderOptions { useAscii?:boolean;paddingX?:number;paddingY?:number;boxBorderPadding?:number;colorMode?:'auto' | 'none' | 'ansi16' | 'ansi256' | 'truecolor' | 'html';theme?:{ fg?:string; border?:string; line?:string; arrow?:string; accent?:string; bg?:string; corner?:string; junction?:string };maxWidth?:number;targetWidth?:number;onConfigDiagnostic?:(diagnostic: ConfigDiagnostic) => void;onProjectionDiagnostic?:(diagnostic: TerminalProjectionDiagnostic) => void;} interface LayoutRenderOptions extends SharedRenderOptions { debug?:boolean;regions?:boolean;actions?:boolean;onConfigDiagnostic?:(diagnostic: ConfigDiagnostic) => void;} interface RenderArtifactDiagnostic { code: string; message?: string; reference?: string; feature?: string; input?: string; canonicalId?: string; removal?: { release: string; date: string } } interface CapabilityResolution { readonly id: `${string}:${string}`; readonly range: string; readonly level: 'required' | 'preferred' | 'optional'; readonly status: 'selected' | 'unsupported' | 'incompatible'; readonly version?: string } interface CapabilityDecision { readonly version: 1; readonly accepted: boolean; readonly resolutions: readonly CapabilityResolution[] } interface RenderExecutionDecision { readonly family: { readonly id: string; readonly version: string };readonly backend: { readonly mode: 'scene'; readonly requestedId: string; readonly selectedId: string; readonly version: string; readonly hostPolicy: boolean } | { readonly mode: 'family-svg' };readonly digest: string;} interface RenderRequestReceipt { version: 2; output: 'svg' | 'png' | 'ascii' | 'unicode' | 'html' | 'layout'; sharedRequestDigest: string; requestDigest: string; appearanceDigest: string; capabilityDecision: CapabilityDecision; diagnostics?: readonly RenderArtifactDiagnostic[]; graphicalProjectionDigest?: string; executionDecision?: RenderExecutionDecision } interface RenderedSvg { svg: string; receipt: RenderRequestReceipt } interface RenderedAscii { text: string; receipt: RenderRequestReceipt; terminalStyle: Record<string, unknown>; outputPolicy: Record<string, unknown> } interface RenderedLayoutArtifact { layout: VerifyResult['layout']; receipt: RenderRequestReceipt } declare const mermaid: { parseRegisteredMermaid(source: string): Result<ParsedDiagram, ParseError[]> createMermaid(kind: DiagramKind, opts?: { direction?: 'TD' | 'TB' | 'LR' | 'BT' | 'RL' }): ValidDiagram buildMermaid(kind: DiagramKind, ops: MutationOp[], opts?: { direction?: 'TD' | 'TB' | 'LR' | 'BT' | 'RL' }): Result<ValidDiagram, { code: string; message: string; opIndex: number }> asFlowchart(diagram: ValidDiagram): ValidDiagram | null asState(diagram: ValidDiagram): ValidDiagram | null asSequence(diagram: ValidDiagram): ValidDiagram | null asTimeline(diagram: ValidDiagram): ValidDiagram | null asClass(diagram: ValidDiagram): ValidDiagram | null asEr(diagram: ValidDiagram): ValidDiagram | null asJourney(diagram: ValidDiagram): ValidDiagram | null asArchitecture(diagram: ValidDiagram): ValidDiagram | null asXyChart(diagram: ValidDiagram): ValidDiagram | null asPie(diagram: ValidDiagram): ValidDiagram | null asQuadrant(diagram: ValidDiagram): ValidDiagram | null asGantt(diagram: ValidDiagram): ValidDiagram | null asMindmap(diagram: ValidDiagram): ValidDiagram | null asGitGraph(diagram: ValidDiagram): ValidDiagram | null asRadar(diagram: ValidDiagram): ValidDiagram | null mutate(diagram: ValidDiagram, op: MutationOp): Result<ValidDiagram> verifyMermaid(input: ParsedDiagram | string, opts?: { suppress?: string[]; labelCharCap?: number; renderOptions?: SharedRenderOptions }): VerifyResult analyzeMermaid(diagram: ValidDiagram): Record<string, unknown> analyzeMermaidSource(source: string): Result<Record<string, unknown>> describeMermaidFacts(diagram: ValidDiagram): string[] describeMermaidFactsSource(source: string): Result<string[]> checkMermaid(diagram: ValidDiagram, spec: CheckMermaidSpec): CheckMermaidResult checkMermaidSource(source: string, spec: CheckMermaidSpec): Result<CheckMermaidResult> serializeMermaid(diagram: ParsedDiagram): string renderMermaidSVG(input: ParsedDiagram | string, opts?: SvgRenderOptions): string renderMermaidSVGWithReceipt(input: ParsedDiagram | string, opts?: SvgRenderOptions): RenderedSvg renderMermaidASCII(input: ParsedDiagram | string, opts?: AsciiRenderOptions): string renderMermaidASCIIWithReceipt(input: ParsedDiagram | string, opts?: AsciiRenderOptions): RenderedAscii layoutMermaidWithReceipt(input: ParsedDiagram | string, opts?: LayoutRenderOptions): RenderedLayoutArtifact describeOps(family: DiagramKind): Record<string, { name: string; required: boolean; type: string; note?: string }[]> opSignatures(family: DiagramKind): string[] }
    ConnectorNo auth
  • Create a NEW architecture diagram from a graph that YOU author, and get back a shareable, editable canvas URL plus a rendered SVG and Mermaid. You produce only the SEMANTICS — nodes, the groups (VPC/cluster/...) they live in, and the directed edges between them. You do NOT lay anything out: never send x/y/position/pinned. A deterministic layout engine computes all geometry and an icon layer picks the pictures from each node's kind. kind.catalog is one of aws | gcp | azure | k8s | saas | generic, each with rich per-catalog kind.types (e.g. aws:lambda, gcp:bigquery, azure:cosmos_db, k8s:deployment, saas:kafka): - "aws" (api_gateway, lambda, s3, rds, dynamodb, sqs, bedrock, kinesis, fargate, eventbridge, aurora, ...). - "gcp" (compute_engine, gke, cloud_run, cloud_sql, spanner, firestore, bigquery, pubsub, dataflow, vertex_ai, ...). - "azure" (virtual_machine, aks, app_service, functions, blob_storage, sql_database, cosmos_db, service_bus, event_hubs, key_vault, ...). - "k8s" (pod, deployment, statefulset, daemonset, job, cronjob, service, ingress, configmap, secret, hpa, ...). - "saas" for hosted third-parties (redis, postgresql, mysql, mongodb, kafka, stripe, twilio, auth0, github, cloudflare, ...). - "generic" primitive when nothing branded fits: service, database, cache, queue, user, external_system, storage, gateway, function, note. - "generic" FLOWCHART kinds for processes/flowcharts: process, decision, terminator, data, document, subprocess. edge.kind is one of: request, response, async_event, data_flow, dependency, network, generic. WORKED EXAMPLE — a user hitting an API in a VPC that talks to Postgres: { "title": "Web API", "domain": "cloud_architecture", "graph": { "groups": [{ "id": "g_vpc", "label": "VPC", "type": "vpc" }], "nodes": [ { "id": "n_user", "label": "User", "kind": { "catalog": "generic", "type": "user" } }, { "id": "n_api", "label": "API", "kind": { "catalog": "aws", "type": "api_gateway" }, "parentId": "g_vpc" }, { "id": "n_db", "label": "Postgres", "kind": { "catalog": "aws", "type": "rds" }, "parentId": "g_vpc" } ], "edges": [ { "id": "e1", "source": "n_user", "target": "n_api", "kind": "request" }, { "id": "e2", "source": "n_api", "target": "n_db", "kind": "data_flow" } ] } } Returns { diagramId, url, svg, mermaid, version }. Give the user the url — opening it shows the same diagram on an editable canvas (anonymous; it's theirs to claim by signing in). To change the diagram afterwards, use get_diagram then edit_diagram.
    ConnectorNo auth
  • Render an interactive MCP app mind map when the user needs hierarchical structure shown visually instead of as prose. Use it for breaking down ideas, plans, study material, or systems into a root topic with nested branches; do not use it for tables, flowcharts, Mermaid/Graphviz diagrams, or plain text lists. Input `mindmap_markdown` must be a clean markdown tree with one `#` root heading and 2-space-indented bullet nesting. If the user gives prose, first reshape it into that hierarchy, then call this tool.
    ConnectorNo auth
  • Return version-matched mutation operations for one diagram family. Use detail=signatures for the compact op menu or detail=fields (default) for exact field types, required flags, enum values, defaults, and constraints. Call this before build, mutate, or execute when the family schema is not already known.
    ConnectorNo auth
  • Render a Mermaid source string to text. Returns { ok, text }. useAscii true → plain ASCII (+,-,|); false/absent → Unicode box drawing (┌,─,│). targetWidth sets a hard terminal display-cell bound; impossible bounds return a typed error.
    ConnectorNo auth
  • Creates and displays an interactive draw.io diagram. Accepts either draw.io XML or Mermaid.js syntax — provide exactly one. **Format decision — this is the first thing to settle before you write anything:** if the diagram type appears on the Mermaid list below, use `mermaid`. Only use `xml` when the diagram type isn't on that list (UI mockups, floorplans, cloud/network/electrical architecture with stencils, hand-placed UML, etc.) or when the user has explicitly asked for draw.io XML. **Use Mermaid** for the following diagram types (all rendered natively, no upstream mermaid runtime): - flowchart / graph (TD, LR, …) - sequenceDiagram - classDiagram - stateDiagram / stateDiagram-v2 - erDiagram - gantt - pie - journey (user-journey) - gitGraph - mindmap - timeline - quadrantChart - xychart-beta - sankey-beta - requirementDiagram - C4Context / C4Container / C4Component - block-beta - architecture-beta - packet-beta - kanban - radar-beta - treemap-beta - treeview-beta (draw.io-specific) - venn (draw.io-specific) — syntax: `venn` then `set A ["Label"]` for each set, `union A,B` for declared overlaps (informational), and `text A` / `text A,B` followed by `["Region label"]` for text inside a region. Do NOT use `A AND B[...]` or `A["..."]` shorthand — those lines are ignored. - ishikawa (draw.io-specific) - zenuml **Strong default: use Mermaid for every diagram type on that list above.** Mermaid is simpler, more reliable, and the native Mermaid layout handles positioning and routing for you. For a flowchart, state diagram, sequence, ER, class, gantt, gitGraph, mindmap, etc. — reach for the `mermaid` parameter, not `xml`. Do not default to XML for flowcharts. **Use XML** when the diagram type isn't on the Mermaid list above OR when the user explicitly asks for XML / draw.io format. Typical cases where XML is the right choice: - **UI mockups / wireframes / screen designs** — buttons, form fields, sidebars, modal dialogs (`shape=mxgraph.bootstrap.*`, `shape=mxgraph.ios.*`, `shape=mxgraph.android.*`) - **Floor plans / seating charts / room layouts** — rooms, doors, furniture (`shape=mxgraph.floorplan.*`) - **Cloud architecture** with AWS / Azure / GCP / Kubernetes icons (`shape=mxgraph.aws4.*`, `shape=mxgraph.azure.*`, `shape=mxgraph.gcp2.*`, `shape=mxgraph.kubernetes.*`) - **Network topology** with Cisco / Rack / networking shapes (`shape=mxgraph.cisco*.*`, `shape=mxgraph.rack.*`, `shape=mxgraph.networking.*`) - **P&ID / electrical / engineering schematics** (`shape=mxgraph.pid2.*`, `shape=mxgraph.electrical.*`, `shape=mxgraph.mscae.*`) - **Swimlanes / pools** with custom colors and hand-placed contents - **UML class / component / deployment diagrams** where positioning carries meaning - **Venn diagrams, quadrant charts, concept maps** with custom regions — anything where hand-placed geometry is the point - **Any diagram requiring specific colors, fonts, stencils, or layouts** that Mermaid can't control precisely Call `search_shapes` first when you need industry icons (AWS / Azure / Cisco / P&ID / Kubernetes / floorplan / mockup / electrical) or brand logos / pictorial concept icons (e.g. 'react', 'slack', 'shopping cart') to find the correct `style` string for each shape. --- **XML reasoning discipline (applies ONLY when you chose XML — skip this whole section if you're using Mermaid):** Your job in XML is declaring logical structure — nodes, edges, labels, groupings. Follow these steps in order: (1) **Decide `postLayout` and `routing` FIRST, before writing any XML.** If the XML diagram is a flowchart, state diagram, decision tree, or any directional/hierarchical process diagram (which you should rarely be writing as XML — prefer Mermaid), you MUST pass `postLayout: "elk"` (add `direction: "horizontal"` when the flow is drawn left-to-right; it defaults to vertical). Omit `postLayout` only when the layout carries hand-crafted meaning (swimlanes, containers, architecture, UML) — the typical reason you chose XML in the first place. When `postLayout` is set, your x/y coordinates only need to express rough direction; ELK re-lays out the vertices. For those hand-placed diagrams where you omit `postLayout`, consider `routing: "libavoid"` — it leaves your positions untouched and only routes the edges around the boxes in clean right angles (set it whenever connectors would otherwise overlap or cut through shapes). Treat `postLayout` and `routing` as alternatives: ELK already routes its own edges, so if you set `postLayout: "elk"` do NOT also set `routing` (redundant); use `routing` only on a hand-placed layout where you are NOT re-laying-out with ELK. (2) Pick ONE concrete scenario on your first impulse and commit — do not pitch alternatives, do not flip-flop between approaches. (3) Use the rigid grid in the XML reference (`x = col*180 + 40`, `y = row*120 + 40`) without computing spacings, canvas dimensions, or overlap checks. (4) Never add `<Array as="points">` waypoints or `exitX/exitY/entryX/entryY` — when postLayout or routing runs it sets them; otherwise drawio's edge router handles it. (5) Do NOT narrate in your reasoning: no "building the diagram", no column enumeration, no coordinate math in prose, no coordinate re-verification after placement. Go straight to XML. **User preference override — XML only.** If the user expresses a preference for draw.io XML over Mermaid in any phrasing (examples: "no mermaid", "skip mermaid", "use xml", "I want drawio format", "stop using mermaid", "give me the xml", "native drawio only", etc.), from that point onward in the conversation you MUST use the `xml` parameter exclusively and MUST NOT use the `mermaid` parameter, even for diagram types where Mermaid would normally be preferable. This preference persists for the remainder of the conversation unless the user clearly reverses it (e.g. "mermaid is fine again"). When the preference is active, translate any diagram request — including flowcharts, sequence diagrams, ER diagrams, etc. — directly to well-formed mxGraphModel XML. When using XML: IMPORTANT — the XML must be well-formed. Do NOT include ANY XML comments (<!-- -->) in the output. # draw.io XML Reference Detailed reference for styles, edge routing, containers, layers, tags, metadata, and dark mode. Consult this when generating draw.io XML diagrams. ## Reasoning budget (read this first) Your job is to declare the **logical structure** of the diagram — what nodes exist, what edges connect them, what labels they carry, what lane/container groups them. The edge router and the optional layout pass (`postLayout: "elk"`, see **Edge routing & layout passes**) handle routing and placement; you do **not** need to do layout math. **Do NOT** in your reasoning: - Do NOT debate the topic. The user asked for a flowchart / architecture / sequence / etc. — pick one concrete scenario on your first impulse and commit. Never write "Actually, let me think of something else…" or pitch alternatives. - Do NOT debate flat-lanes vs nested-pools, horizontal vs vertical orientation, one vs multiple variations. Pick the first reasonable option (almost always: flat swimlanes, top-down or left-right based on what fits the content). Do not flip-flop. - Do NOT compute x/y coordinates in prose. No "column spacings of 160px totaling 1840px width — that's too wide, let me tighten to 1700…" loops. Use the rigid grid below; do the arithmetic in your head and write the XML. - Do NOT re-derive drawio mechanics (`horizontal=0`, `startSize=110`, nested-lane coordinates). Use the templates below as-is. - Do NOT enumerate columns ("customer lane columns 0-10, web app 1-7"). Place a node, move on. - Do NOT add `<Array as="points">` waypoints. Edges are routed automatically. - Do NOT set `exitX` / `exitY` / `entryX` / `entryY` connection-point overrides unless you have specific geometric intent. - Do NOT verify, re-check, or adjust coordinates after placing a node. - Do NOT narrate "building the diagram / finalizing the XML / now let me…". Just emit XML. - Do NOT write out lists of node positions as planning text. Emit them as `<mxCell>` elements directly. **Do** in your reasoning: - Identify the diagram type + actors/stages (1-2 short sentences). - Identify any grouping (swimlanes? containers? none?). - Go straight to XML. **Rigid grid — use for every XML diagram:** - Column x = `col_index * 180 + 40` (col 0 = 40, col 1 = 220, col 2 = 400, …) - Row y = `row_index * 120 + 40` (row 0 = 40, row 1 = 160, row 2 = 280, …) - Node size: rectangles `140×60`, diamonds `140×80`, circles `60×60`, documents `120×80`, cylinders `100×70` Pick a `(col, row)` for each node. Don't think about centers or exact gaps — the grid already spaces nodes apart, and slight misalignment is invisible in the result. **Give every node its own `(col, row)` cell.** Two nodes in the same cell land on top of each other. With `postLayout: "elk"` the positions are only a rough starting direction (ELK re-places everything); without it they are the final positions, so the cell you pick is what the user sees. ## General principles - **Use proper draw.io shapes and connectors** — choose the semantically correct shape for each element (e.g., `shape=cylinder3` for databases and tanks, `rhombus` for decisions, `shape=mxgraph.pid2valves.*` for valves in P&IDs). draw.io has extensive shape libraries; prefer domain-appropriate shapes over generic rectangles. - **Decide whether to search for shapes** — before generating a diagram, decide if it needs domain-specific shapes from draw.io's extended libraries. **Skip `search_shapes`** for standard diagram types that use basic geometric shapes: flowcharts, UML (class, sequence, state, activity), ERD, org charts, mind maps, Venn diagrams, timelines, wireframes, and any diagram using only rectangles, diamonds, circles, cylinders, and arrows. Also skip if the user explicitly asks to use basic/simple shapes or says not to search. **Use `search_shapes`** when the diagram requires industry-specific or branded icons: cloud architecture (AWS, Azure, GCP), network topology (Cisco, rack equipment), P&ID (valves, instruments, vessels), electrical/circuit diagrams, Kubernetes, BPMN with specific task types, or any domain where the user expects realistic/standardized symbols rather than labeled boxes. It also finds brand/product logos and general-purpose pictorial icons (e.g. `react`, `slack`, `shopping cart`, `solar panel`) — returned as ready-to-use `shape=image` styles — so use it too when the user asks for logos or everyday concept icons. - **Match the language of labels to the user's language** — if the user writes in German, French, Japanese, etc., all diagram labels, titles, and annotations should be in that same language. - **Group related nodes, and surface a hub when edges converge** — put nodes that belong together inside a container or swimlane, and keep external actors (users, files, third-party systems) outside implementation containers. When many edges converge on one area or cross several groups, route them through a single hub/gateway node (a registry, broker, event log, …) instead of drawing every low-level dependency across the canvas — fewer crossings, clearer contract. - **Encode secondary detail in node text, not edges** — draw an edge only when the relationship itself carries meaning; push incidental detail into the node label so the connector layer stays readable. - **File each edge at the innermost container holding BOTH endpoints** — `parent="<container_id>"` when both ends sit in the same container (at any nesting depth), `parent="1"` when one end is outside all containers. Auto-layout reads an edge's coordinates in its parent's frame, so an edge parked further out than its endpoints is laid out in the wrong place. Details under [Nested architecture containers](#nested-architecture-containers-cloud-infra-network-topologies). ## Common styles **Rounded rectangle:** ```xml <mxCell id="2" value="Label" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxGeometry x="100" y="100" width="120" height="60" as="geometry"/> </mxCell> ``` **Diamond (decision):** ```xml <mxCell id="3" value="Condition?" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxGeometry x="100" y="200" width="120" height="80" as="geometry"/> </mxCell> ``` **Arrow (edge):** ```xml <mxCell id="4" value="" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="2" target="3" parent="1"> <mxGeometry relative="1" as="geometry"/> </mxCell> ``` **Labeled arrow:** ```xml <mxCell id="5" value="Yes" style="edgeStyle=orthogonalEdgeStyle;html=1;" edge="1" source="3" target="6" parent="1"> <mxGeometry relative="1" as="geometry"/> </mxCell> ``` ## Style properties | Property | Values | Use for | |----------|--------|---------| | `rounded=1` | 0 or 1 | Rounded corners | | `whiteSpace=wrap` | wrap | Text wrapping | | `fillColor=#dae8fc` | Hex color | Background color | | `strokeColor=#6c8ebf` | Hex color | Border color | | `fontColor=#333333` | Hex color | Text color | | `shape=cylinder3` | shape name | Database cylinders | | `shape=mxgraph.flowchart.document` | shape name | Document shapes | | `ellipse` | style keyword | Circles/ovals | | `rhombus` | style keyword | Diamonds | | `edgeStyle=orthogonalEdgeStyle` | style keyword | Right-angle connectors | | `edgeStyle=elbowEdgeStyle` | style keyword | Elbow connectors | | `dashed=1` | 0 or 1 | Dashed lines | | `swimlane` | style keyword | Swimlane containers | | `group` | style keyword | Invisible container (pointerEvents=0) | | `container=1` | 0 or 1 | Enable container behavior on any shape | | `pointerEvents=0` | 0 or 1 | Prevent container from capturing child connections | | `html=1` | 0 or 1 | Enable HTML rendering in labels (required for `<b>`, `<br>`, `<font>`, etc.) | | `shape=umlLifeline;perimeter=lifelinePerimeter;size=16` | shape | UML sequence diagram lifeline (size = header height) | ## HTML labels **Always include `html=1` in the style** when the `value` attribute contains any HTML tags (`<b>`, `<br>`, `<font>`, `<i>`, `<u>`, `<hr>`, `<p>`, `<table>`, etc.). Without `html=1`, HTML tags are displayed as literal text instead of being rendered. HTML in attribute values must be **XML-escaped**: `<` → `&lt;`, `>` → `&gt;`, `&` → `&amp;`, `"` → `&quot;` ```xml <mxCell value="&lt;b&gt;Title&lt;/b&gt;&lt;br&gt;Description" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxGeometry x="100" y="100" width="120" height="60" as="geometry"/> </mxCell> ``` **Line breaks:** Use `&#xa;` (works with both `html=1` and `html=0`) or `&lt;br&gt;` (requires `html=1`) for line breaks — never use `\n`, which renders as literal backslash-n text instead of a newline. **Best practice:** Always include `html=1` in every cell style. This ensures labels render correctly whether they contain HTML or plain text — plain text is unaffected by the flag. **Bold/italic/underline:** Use `fontStyle` in the style string when the entire label should be bold (`fontStyle=1`), italic (`fontStyle=2`), or underline (`fontStyle=4`). Values can be combined via bitwise OR (e.g., `fontStyle=3` = bold+italic). Use HTML tags (`<b>`, `<i>`, `<u>`) only when formatting part of the label (e.g., bold title with normal description). Never combine `fontStyle` with HTML tags for the same effect — this is redundant and causes visible raw tags if `html=1` is missing. ## Edges **CRITICAL: Every edge `mxCell` must contain a `<mxGeometry relative="1" as="geometry" />` child element.** Self-closing edge cells (e.g. `<mxCell ... edge="1" ... />`) are invalid and will not render correctly. Always use the expanded form: ```xml <mxCell id="e1" edge="1" parent="1" source="a" target="b" style="..."> <mxGeometry relative="1" as="geometry" /> </mxCell> ``` **Don't hand-route edges.** Just declare `source` and `target`. You do **not** need to: - Add `<mxPoint>` waypoints - Set `exitX` / `exitY` / `entryX` / `entryY` - Route around obstacles - Worry about edge-vertex collisions or parallel edge spacing draw.io's built-in router is **basic**: it draws each edge as a straight line or a simple right-angle path between `source` and `target`, with **no awareness of other shapes** — a wire will run straight across any box that sits between its endpoints. That's fine when connected nodes have open space between them. When edges would otherwise cross over shapes, or you want consistently clean orthogonal wires that route *around* the boxes, set **`routing: "libavoid"`**; for a full re-layout use **`postLayout: "elk"`** (see **Edge routing & layout passes** below). Both compute the waypoints for you — you never add them by hand either way. **What you still choose: the edge style.** The style determines the overall look (orthogonal angles, curves, straight lines) — the router honors the style family. | Style | Syntax | Best for | |-------|--------|---------| | **Orthogonal** | `edgeStyle=orthogonalEdgeStyle` | Flowcharts, architecture, network diagrams, BPMN — any diagram with right-angle connectors | | **Straight** | no `edgeStyle` | UML class/sequence diagrams, direct point-to-point connections. For sequence diagram messages use `endSize=6;startSize=6;` to keep arrowheads small | | **Entity Relation** | `edgeStyle=entityRelationEdgeStyle` | ER diagrams — creates perpendicular stubs at both ends | | **Curved** | `curved=1` | Mind maps, informal diagrams | | **Elbow** | `edgeStyle=elbowEdgeStyle;elbow=vertical;` | Rarely needed — `orthogonalEdgeStyle` handles almost all cases; use this only for simple 1-bend linear flows | **Use a consistent edge style within each diagram.** Pick one based on diagram type and apply it to all edges: ER → `entityRelationEdgeStyle`; UML class → straight; mind maps → curved; flowcharts/architecture/network → `orthogonalEdgeStyle`. **Useful edge style attributes** that apply regardless of routing: - `rounded=1` — rounded corners at bend points (recommended for orthogonal) - `endArrow=classic` / `endArrow=none` — arrow heads - `dashed=1` — dashed line - `strokeColor=#...`, `strokeWidth=2` — color/width - Edge labels: set `value` directly on the edge cell **Keep edge labels short and meaningful** — one to three words (`Yes`, `async`, `reads`). Drop labels that merely restate an obvious action (`call`, `register`); move longer explanations into node text or a small legend node. **Visual semantics — stay consistent, add a legend when mixing styles.** Within one diagram apply `dashed=1`, `strokeColor`, and `strokeWidth` consistently for one chosen meaning (e.g. dashed = optional / async / inferred relationship). Don't mix several dashed meanings without a small legend explaining them. ## Containers and groups For architecture diagrams or any diagram with nested elements, use draw.io's proper parent-child containment — do **not** just place shapes on top of larger shapes. ### How containment works Set `parent="containerId"` on child cells. Children use **relative coordinates** within the container. ### Container types | Type | Style | When to use | |------|-------|-------------| | **Group** (invisible) | `group;` | No visual border needed, container has no connections. Includes `pointerEvents=0` so child connections are not captured | | **Swimlane** (titled) | `swimlane;startSize=30;` | Container needs a visible title bar/header, or the container itself has connections | | **Custom container** | Add `container=1;pointerEvents=0;` to any shape style | Any shape acting as a container without its own connections | ### Key rules - **Edges to children inside containers naturally cross the container boundary** — this is correct and expected. Do not add extra waypoints or complex routing to avoid a parent container when connecting to shapes inside it. - **Always add `pointerEvents=0;`** to container styles that should not capture connections being rewired between children - Only omit `pointerEvents=0` when the container itself needs to be connectable — in that case, use `swimlane` style which handles this correctly (the client area is transparent for mouse events while the header remains connectable) - Children must set `parent="containerId"` and use coordinates **relative to the container** ### Example: Architecture container with swimlane ```xml <mxCell id="svc1" value="User Service" style="swimlane;startSize=30;fillColor=#dae8fc;strokeColor=#6c8ebf;html=1;" vertex="1" parent="1"> <mxGeometry x="100" y="100" width="300" height="200" as="geometry"/> </mxCell> <mxCell id="api1" value="REST API" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="svc1"> <mxGeometry x="20" y="40" width="120" height="60" as="geometry"/> </mxCell> <mxCell id="db1" value="Database" style="shape=cylinder3;whiteSpace=wrap;html=1;" vertex="1" parent="svc1"> <mxGeometry x="160" y="40" width="120" height="60" as="geometry"/> </mxCell> ``` ### Example: Invisible group container ```xml <mxCell id="grp1" value="" style="group;" vertex="1" parent="1"> <mxGeometry x="100" y="100" width="300" height="200" as="geometry"/> </mxCell> <mxCell id="c1" value="Component A" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="grp1"> <mxGeometry x="10" y="10" width="120" height="60" as="geometry"/> </mxCell> ``` ### Swimlanes for grouped actors (BPMN-style flowcharts) Use **flat swimlanes** at `parent="1"`, stacked vertically. One row of nodes per lane. **Fixed values — do not compute or debate:** - Lane size: `x=0, y=lane_index*150, width=CANVAS_W, height=150` - Lane style: `swimlane;horizontal=0;startSize=110;fillColor=<pastel>;html=1;` - Child nodes inside a lane: `parent="<lane_id>"`, `x = 120 + col*180`, `y = 45` (always 45), size 140×60 (or 140×80 for diamonds) - Cross-lane edges: `parent="1"` (not inside a lane) Pick `CANVAS_W = max_col * 180 + 300`. Choose lane colors from `#f5f5f5, #e8f4f8, #fff0e6, #e8f5e9, #fff9e6, #fce4ec` in that order. ```xml <mxCell id="lane1" value="Customer" style="swimlane;horizontal=0;startSize=110;fillColor=#f5f5f5;html=1;" vertex="1" parent="1"> <mxGeometry x="0" y="0" width="1800" height="150" as="geometry"/> </mxCell> <mxCell id="n1" value="Place Order" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="lane1"> <mxGeometry x="120" y="45" width="140" height="60" as="geometry"/> </mxCell> <mxCell id="lane2" value="System" style="swimlane;horizontal=0;startSize=110;fillColor=#e8f4f8;html=1;" vertex="1" parent="1"> <mxGeometry x="0" y="150" width="1800" height="150" as="geometry"/> </mxCell> <mxCell id="n2" value="Validate" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="lane2"> <mxGeometry x="300" y="45" width="140" height="60" as="geometry"/> </mxCell> <mxCell id="e1" edge="1" parent="1" source="n1" target="n2" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;"> <mxGeometry relative="1" as="geometry"/> </mxCell> ``` Do NOT nest lanes inside a pool. Do NOT vary lane heights. Do NOT compute title-area offset — it is always 110, children start at x=120 to clear it. ### Nested architecture containers (cloud, infra, network topologies) For diagrams with **nested groupings** — VPC → Availability Zone → EC2 instance, Datacenter → Rack → Server, Region → Environment → Service — use nested swimlanes. This is where the AI most often flattens hierarchy that should be nested. Treat each level as a swimlane container. **Rules:** - Every container is a `swimlane` with `startSize=24` (title area at the top). - Child cells set `parent="<container_id>"` and use coordinates **relative to their parent** (origin 0,0 is the parent's top-left, below the title). - **An edge belongs to the innermost container that holds BOTH of its endpoints.** Walk up from both ends until you reach a container that contains both: two cells in the same subnet → that subnet; a web tier and a database tier inside one region → that region; anything with one endpoint outside all containers → `parent="1"`, the layer. This is the rule the draw.io editor's own model maintains, and auto-layout reads an edge's coordinates in its parent's frame, so an edge filed too far out lands in the wrong place. - For industry-specific icons (AWS/Azure/GCP logos, Cisco equipment, etc.), call `search_shapes` to get the exact `style` string and substitute it into a regular vertex — the container structure stays the same. ```xml <mxCell id="vpc" value="VPC" style="swimlane;startSize=24;fillColor=#dae8fc;strokeColor=#6c8ebf;html=1;" vertex="1" parent="1"> <mxGeometry x="0" y="0" width="720" height="360" as="geometry"/> </mxCell> <mxCell id="az1" value="AZ us-east-1a" style="swimlane;startSize=24;fillColor=#fff2cc;strokeColor=#d6b656;html=1;" vertex="1" parent="vpc"> <mxGeometry x="20" y="36" width="320" height="300" as="geometry"/> </mxCell> <mxCell id="web1" value="web-1" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="az1"> <mxGeometry x="30" y="40" width="120" height="60" as="geometry"/> </mxCell> <mxCell id="db1" value="db-1" style="shape=cylinder3;whiteSpace=wrap;html=1;" vertex="1" parent="az1"> <mxGeometry x="180" y="40" width="100" height="70" as="geometry"/> </mxCell> <mxCell id="az2" value="AZ us-east-1b" style="swimlane;startSize=24;fillColor=#fff2cc;strokeColor=#d6b656;html=1;" vertex="1" parent="vpc"> <mxGeometry x="360" y="36" width="340" height="300" as="geometry"/> </mxCell> <mxCell id="web2" value="web-2" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="az2"> <mxGeometry x="30" y="40" width="120" height="60" as="geometry"/> </mxCell> <mxCell id="e1" edge="1" parent="1" source="web1" target="web2" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;"> <mxGeometry relative="1" as="geometry"/> </mxCell> ``` ### Cross-functional flowcharts (actor × phase grid, as a table) Cross-functional flowcharts show a process across **two axes at once** — actors (rows) and phases (columns). Use drawio's `table` shape, which auto-arranges cells into a grid via `childLayout=tableLayout`. This is the canonical draw.io pattern and is distinct from plain swimlanes (which only group on one axis). **Structure:** - Outer container: `shape=table;childLayout=tableLayout;startSize=0;collapsible=0;fillColor=none;` - Rows are children of the table: `shape=tableRow;horizontal=0;startSize=0;collapsible=0;` - Cells are children of rows — regular vertices, one per (actor, phase) intersection - Row heights and cell widths are set via `mxGeometry`; they tile automatically - First row = phase headers; first cell of every other row = actor label - Process nodes go INSIDE the appropriate cell (parent = cell id) at coordinates relative to the cell - Cross-cell edges must use `parent="1"` (same rule as containers) ```xml <mxCell id="tbl" style="shape=table;childLayout=tableLayout;startSize=0;collapsible=0;fillColor=none;" vertex="1" parent="1"> <mxGeometry x="0" y="0" width="900" height="320" as="geometry"/> </mxCell> <mxCell id="r0" style="shape=tableRow;horizontal=0;startSize=0;collapsible=0;" vertex="1" parent="tbl"> <mxGeometry width="900" height="40" as="geometry"/> </mxCell> <mxCell id="h0" style="text;html=1;" vertex="1" parent="r0"> <mxGeometry width="140" height="40" as="geometry"/> </mxCell> <mxCell id="h1" value="Order" style="text;align=center;fontStyle=1;fillColor=#e8e8e8;" vertex="1" parent="r0"> <mxGeometry x="140" width="380" height="40" as="geometry"/> </mxCell> <mxCell id="h2" value="Fulfill" style="text;align=center;fontStyle=1;fillColor=#e8e8e8;" vertex="1" parent="r0"> <mxGeometry x="520" width="380" height="40" as="geometry"/> </mxCell> <mxCell id="r1" style="shape=tableRow;horizontal=0;startSize=0;collapsible=0;" vertex="1" parent="tbl"> <mxGeometry y="40" width="900" height="140" as="geometry"/> </mxCell> <mxCell id="a1" value="Customer" style="fillColor=#dae8fc;fontStyle=1;" vertex="1" parent="r1"> <mxGeometry width="140" height="140" as="geometry"/> </mxCell> <mxCell id="c_cust_order" style="fillColor=none;" vertex="1" parent="r1"> <mxGeometry x="140" width="380" height="140" as="geometry"/> </mxCell> <mxCell id="t_place" value="Place Order" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="c_cust_order"> <mxGeometry x="120" y="40" width="140" height="60" as="geometry"/> </mxCell> <mxCell id="c_cust_fulfill" style="fillColor=none;" vertex="1" parent="r1"> <mxGeometry x="520" width="380" height="140" as="geometry"/> </mxCell> <mxCell id="r2" style="shape=tableRow;horizontal=0;startSize=0;collapsible=0;" vertex="1" parent="tbl"> <mxGeometry y="180" width="900" height="140" as="geometry"/> </mxCell> <mxCell id="a2" value="System" style="fillColor=#d5e8d4;fontStyle=1;" vertex="1" parent="r2"> <mxGeometry width="140" height="140" as="geometry"/> </mxCell> <mxCell id="c_sys_order" style="fillColor=none;" vertex="1" parent="r2"> <mxGeometry x="140" width="380" height="140" as="geometry"/> </mxCell> <mxCell id="t_validate" value="Validate" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="c_sys_order"> <mxGeometry x="120" y="40" width="140" height="60" as="geometry"/> </mxCell> <mxCell id="c_sys_fulfill" style="fillColor=none;" vertex="1" parent="r2"> <mxGeometry x="520" width="380" height="140" as="geometry"/> </mxCell> <mxCell id="t_ship" value="Ship" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="c_sys_fulfill"> <mxGeometry x="120" y="40" width="140" height="60" as="geometry"/> </mxCell> <mxCell id="e1" edge="1" parent="1" source="t_place" target="t_validate" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;"> <mxGeometry relative="1" as="geometry"/> </mxCell> <mxCell id="e2" edge="1" parent="1" source="t_validate" target="t_ship" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;"> <mxGeometry relative="1" as="geometry"/> </mxCell> ``` **When to use cross-functional tables vs flat swimlanes:** - Flat swimlanes — one-dimensional (actors only, or phases only). Simpler. Use this when you just need to show who does what in sequence. - Cross-functional table — two-dimensional (actors AND phases). Use this when **both** the actor and the process stage matter, and every step belongs to a specific (actor, phase) cell. **Do NOT** nest swimlanes inside a table row, do NOT set `startSize` on rows or cells (columns tile from `x=0`), and do NOT rely on the AI to produce exact widths that sum to the table width — close-enough totals are fine, the `tableLayout` normalizes them. ## Layers Layers control visibility and z-order. Every cell belongs to exactly one layer. Use layers to manage diagram complexity — viewers can toggle layer visibility to show or hide groups of elements (e.g., "Physical Infrastructure" vs "Logical Network" vs "Security Zones"). Cell `id="0"` is the root and cell `id="1"` is the default layer — both always exist. Additional layers are `mxCell` elements with `parent="0"`: ```xml <mxGraphModel> <root> <mxCell id="0"/> <mxCell id="1" parent="0"/> <mxCell id="2" value="Annotations" parent="0"/> <mxCell id="10" value="Server" style="rounded=1;html=1;" vertex="1" parent="1"> <mxGeometry x="100" y="100" width="120" height="60" as="geometry"/> </mxCell> <mxCell id="20" value="Note: deprecated" style="text;" vertex="1" parent="2"> <mxGeometry x="100" y="170" width="120" height="30" as="geometry"/> </mxCell> </root> </mxGraphModel> ``` - A layer is an `mxCell` with `parent="0"` and no `vertex` or `edge` attribute - Assign shapes to a layer by setting `parent` to the layer's id - Later layers render on top of earlier layers (higher z-order) - Add `visible="0"` as an attribute on the layer cell to hide it by default - Use layers when the diagram has distinct conceptual groupings that viewers may want to toggle independently ## Tags Tags are visual filters that let viewers show or hide elements by category. Unlike layers, a single element can have multiple tags, making tags ideal for cross-cutting concerns (e.g., tagging shapes as "critical", "v2", or "backend"). Tags require wrapping `mxCell` in an `<object>` element. Tags are assigned via the `tags` attribute as a space-separated string: ```xml <mxGraphModel> <root> <mxCell id="0"/> <mxCell id="1" parent="0"/> <object id="2" label="Auth Service" tags="critical v2"> <mxCell style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxGeometry x="100" y="100" width="120" height="60" as="geometry"/> </mxCell> </object> <object id="3" label="Legacy API" tags="critical deprecated"> <mxCell style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxGeometry x="300" y="100" width="120" height="60" as="geometry"/> </mxCell> </object> </root> </mxGraphModel> ``` - Tags require the `<object>` wrapper — a plain `mxCell` cannot have tags - The `label` attribute on `<object>` replaces `value` on `mxCell` - Tags are space-separated in the `tags` attribute - Viewers filter the diagram by selecting tags in the draw.io UI (Edit > Tags) - Tags do not affect z-order or structural grouping — they are purely a visibility filter ## Metadata and placeholders Metadata stores custom key-value properties on shapes as additional attributes on the `<object>` wrapper element. Combined with placeholders, metadata values can be displayed in labels — useful for data-driven diagrams showing status, owner, IP addresses, or versions on each shape. Set `placeholders="1"` on the `<object>` to enable `%propertyName%` substitution in the `label`: ```xml <mxGraphModel> <root> <mxCell id="0"/> <mxCell id="1" parent="0"/> <object id="2" label="&lt;b&gt;%component%&lt;/b&gt;&lt;br&gt;Owner: %owner%&lt;br&gt;Status: %status%" placeholders="1" component="Auth Service" owner="Team Backend" status="Active"> <mxCell style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1"> <mxGeometry x="100" y="100" width="160" height="80" as="geometry"/> </mxCell> </object> </root> </mxGraphModel> ``` - Custom properties are plain XML attributes on `<object>` (e.g., `component="Auth Service"`) - Set `placeholders="1"` to enable `%key%` substitution in the label and tooltip - The label must use `html=1` style when using HTML formatting with placeholders - Placeholders resolve by walking up the containment hierarchy: shape attributes first, then parent container, then layer, then root — first match wins - Predefined placeholders work without custom properties: `%id%`, `%width%`, `%height%`, `%date%`, `%time%`, `%timestamp%`, `%page%`, `%pagenumber%`, `%pagecount%`, `%filename%` - Use `%%` for a literal percent sign in labels - Tags, metadata, and placeholders can all be combined on the same `<object>` element - Use metadata when shapes represent data records (servers, services, components) and you want to attach structured information beyond the visible label ## Dark mode colors draw.io supports automatic dark mode rendering. How colors behave depends on the property: - **`strokeColor`, `fillColor`, `fontColor`** default to `"default"`, which renders as black in light theme and white in dark theme. When no explicit color is set, colors adapt automatically. - **Explicit colors** (e.g. `fillColor=#DAE8FC`) specify the light-mode color. The dark-mode color is computed automatically by inverting the RGB values (blending toward the inverse at 93%) and rotating the hue by 180° (via `mxUtils.getInverseColor`). - **`light-dark()` function** — To specify both colors explicitly, use `light-dark(lightColor,darkColor)` in the style string, e.g. `fontColor=light-dark(#7EA6E0,#FF0000)`. The first argument is used in light mode, the second in dark mode. To enable dark mode color adaptation, the `mxGraphModel` element must include `adaptiveColors="auto"`. When generating diagrams, you generally do not need to specify dark-mode colors — the automatic inversion handles most cases. Use `light-dark()` only when the automatic inverse color is unsatisfactory. ## Edge routing & layout passes By default, edges are drawn by draw.io's **built-in router**, which is intentionally basic: each edge is a straight line or a simple right-angle path between its endpoints, with **no obstacle avoidance** — a connector runs straight through any shape lying between its `source` and `target`. Two **opt-in** passes upgrade this. Set them as fields on the same call that carries the diagram; the result you open, export or copy always reflects the finished pass. - **`routing: "libavoid"`** (XML only) — obstacle-avoiding orthogonal **edge routing**. Vertices stay exactly where you placed them; only the connectors are recomputed, so they run in clean right-angle segments that route *around* the boxes (and spread apart when parallel) instead of cutting across them. Use it for diagrams you laid out deliberately — architecture, network topology, deployment, swimlanes, UML, floor plans — where you want tidy wires without disturbing your layout. - **`postLayout: "elk"`** — a **full re-layout** (ELK `layered` flow). Vertices move from your positions to canonical hierarchical ones, and the edges are routed as part of that. Node sizes are kept exactly as you declare them, so a label still has to fit the box you gave it. Best for flowcharts, process/state diagrams, decision flows, pipelines, and other directional/hierarchical diagrams. (You should rarely hand-write these as XML — prefer Mermaid.) Flow **direction**: on XML set the optional `direction` field (`"vertical"` (default) / `"horizontal"`); on Mermaid it is read from the flowchart code (`flowchart TD/TB` vs `LR/RL`) and `direction` is ignored. The four combinations: | `postLayout` | `routing` | Result | |---|---|---| | — | — | basic built-in router (straight / simple right-angle, no obstacle avoidance); your positions kept | | — | `libavoid` | your positions kept; wires re-routed orthogonally *around* the shapes | | `elk` | — | ELK places the vertices **and** routes the edges (decent routing built in) | | `elk` | `libavoid` | rarely worth it — ELK already routes; only add `libavoid` if ELK's routing specifically comes out poor | **Pick ONE — they are essentially alternatives, not a stack:** - **Neither** — fine when connected nodes sit in clear rows/columns with open space between them, so the basic router's straight/right-angle lines won't cross another shape. Simplest and lightest; do this by default for sparse layouts. - **`routing: "libavoid"`** — keep your hand-placed layout but clean up the wires: use whenever an edge would otherwise cut across a box, or you want consistently clean orthogonal wires routed around shapes (architecture, network topology, deployment, UML, floor plans — anything densely connected). - **`postLayout: "elk"`** — when you want a canonical re-layout (vertices moved). ELK routes the edges itself as part of the layout, so **do not also set `routing`** — the combination is redundant in almost all cases. Add `direction: "horizontal"` for left-to-right flow. **When you are passing Mermaid instead of XML: see the `postLayout` parameter description for when to set it.** Complex Mermaid flowcharts (≥ ~20 nodes, ≥ 3 decision diamonds, feedback edges, or ≥ 3 endpoints) need `postLayout: "elk"` because the native parser's layout goes cramped or unbalanced past that threshold — the direction follows the flowchart code, so no `direction` is needed. Simple flowcharts and all non-flowchart Mermaid types (sequence, class, ER, sankey, …) need no `postLayout`. **When NOT to use (XML):** - The user has asked for specific positions (swim lanes with exact lanes, architecture diagrams with meaningful spatial arrangement). - The diagram relies on containers/grouping where spatial layout encodes information. ## Style reference Complete style reference (all shape types, style properties, color palettes, HTML labels, and more): https://github.com/jgraph/drawio-mcp/blob/main/shared/style-reference.md XML Schema (XSD): https://github.com/jgraph/drawio-mcp/blob/main/shared/mxfile.xsd ## CRITICAL: XML well-formedness When generating draw.io XML, the output **must** be well-formed XML: - **NEVER include ANY XML comments (`<!-- -->`) in the output.** XML comments are strictly forbidden — they waste tokens, can cause parse errors, and serve no purpose in diagram XML. - Escape special characters in attribute values: `&amp;`, `&lt;`, `&gt;`, `&quot;` - Always use unique `id` values for each `mxCell` --- # Mermaid Reference Short hints for generating Mermaid diagrams that render correctly in draw.io. draw.io's Mermaid parser covers 28 diagram types — the header keyword on the first non-directive line selects the type. _Canonical list & dialog/ELK docs: <https://github.com/jgraph/drawio/discussions/5643>._ ## General rules - **Pick the type keyword carefully.** `graph`/`flowchart`, `classDiagram`, `stateDiagram-v2`, `erDiagram`, `sequenceDiagram`, `gitGraph`, `journey`, `pie`, `gantt`, `mindmap`, `timeline`, `quadrantChart`, `requirementDiagram`, `sankey-beta`, `xychart-beta`, `block-beta`, `c4Context`/`C4Container`/`C4Component`, `architecture-beta`, `radar-beta`, `packet-beta`, `venn-beta`, `treemap-beta`, `treeView-beta`, `ishikawa-beta`, `kanban`, `zenuml`, `wardley-beta`, `eventmodeling`. Misspelling the header yields a blank diagram. - **No trailing punctuation on node IDs.** IDs are identifiers (`myNode`, `node_1`, `A`) — spaces, hyphens (in some contexts), and reserved words (`end`, `class`, `subgraph`) break the parse. Put display text in brackets or quotes instead: `A["User's Account"]`. - **One statement per line.** Separate statements with newlines; `;` works as a delimiter in flowchart but not everywhere. - **Quote labels with special characters** (`:`, `-`, parentheses, non-ASCII). Use `"` not `'`. - **HTML in labels:** only `<br>`, `<b>`, `<i>`, `<u>` are reliable across types. Use `#` for hex colors in styles, never `rgb()`. - **Diagrams can take a title block** for some types: ``` --- title: My Diagram --- flowchart TD ``` - **Match the language of labels to the user's language** — if the user writes in German, French, etc., the diagram labels should be in that language too. ## Flowchart (most common) ``` flowchart TD A[Start] --> B{Decision?} B -->|Yes| C[Do thing] B -->|No| D[Skip] C --> E((End)) D --> E ``` - **Direction:** `TD`/`TB` (top-down), `BT`, `LR`, `RL`. - **Node shapes by bracket:** `[rect]`, `(rounded)`, `([stadium])`, `[[subroutine]]`, `[(cylinder)]`, `((circle))`, `{rhombus}`, `{{hexagon}}`, `[/parallelogram/]`, `[\parallelogram alt\]`, `[/trapezoid\]`, `>asymmetric]`. - **Edges:** `-->` arrow, `---` no arrow, `-.->` dotted, `==>` thick, `<-->` bidirectional. Inline label: `A -- text --> B` or `A -->|text| B`. - **Subgraphs:** ``` subgraph Frontend A --> B end ``` ### Layout for complex flowcharts draw.io's Mermaid parser lays flowcharts out itself, but the result gets cramped or unbalanced once the diagram has any structural complexity. Switch that flowchart to the **ELK layered layout** (the same engine as draw.io's *Arrange ▸ Layout ▸ Vertical/Horizontal Flow*) when ANY of these holds: - ≥ ~20 nodes, OR - ≥ 3 decision diamonds (`{...}`), OR - any feedback/back-edge (an edge pointing back to an earlier node — an error path looping to a retry), OR - ≥ 3 distinct endpoints. Two ways to ask for it, depending on the tool: - **A `postLayout: "elk"` field** on the call, if the tool offers one — use it. - **Otherwise select it in the source**, as a YAML frontmatter block at the very top. draw.io honors it wherever it converts Mermaid (editor, opened link, desktop CLI): ``` --- config: layout: elk --- flowchart TD A[Start] --> B{Retry?} ``` Combines with a `title:` — both are keys of the same frontmatter block. The flow direction always follows the flowchart code (`TD`/`TB` vs `LR`/`RL`). **Flowcharts only** — sequence, class, ER, gantt and the rest lay themselves out and ignore the setting. Simple flowcharts (linear chains, < 20 nodes, no branching or back-edges) don't need it either. ### Styling & colors Three ways — pick one, don't mix for the same node: **1. Inline per-node (`style`):** ``` flowchart LR A[Start] --> B[End] style A fill:#f9f,stroke:#333,stroke-width:2px,color:#fff style B fill:#bbf,stroke:#f66,stroke-dasharray:5 5 ``` **2. Reusable classes (`classDef` + `:::`):** ``` flowchart LR A:::happy --> B:::sad classDef happy fill:#dfd,stroke:#0a0 classDef sad fill:#fdd,stroke:#a00 ``` Or apply to many: `class A,B,C happy`. **3. Link styling (edges):** ``` linkStyle 0 stroke:#f00,stroke-width:3px linkStyle default stroke:#999 ``` `0` = first edge in order defined; `default` targets unstyled edges. Style properties that work: `fill`, `stroke`, `stroke-width`, `stroke-dasharray`, `color` (font color). ## Sequence diagram ``` sequenceDiagram participant U as User participant S as Server U->>S: Request S-->>U: Response Note right of S: Logged ``` - **Arrows:** `->` (no head), `->>` (arrow), `-->>` (dashed), `-x` (X end), `--x` (dashed X). - **Activate/deactivate:** `activate S` / `deactivate S` or `S->>+S2: call` / `S2-->>-S: return`. - **Blocks:** `alt/else/end`, `opt/end`, `loop/end`, `par/and/end`, `critical/option/end`. - **Notes:** `Note left of A`, `Note over A,B: text`. - Optional `autonumber` after header numbers the messages. ## Class diagram ``` classDiagram class Animal { +String name +int age +eat() void } class Dog Animal <|-- Dog : inherits Dog "1" --> "*" Bone : has ``` - **Relations:** `<|--` inherit, `*--` composition, `o--` aggregation, `-->` association, `..>` dependency, `..|>` realize, `<-->` bidirectional. - **Visibility:** `+` public, `-` private, `#` protected, `~` package. - **Annotations:** `<<interface>>`, `<<abstract>>`, `<<enumeration>>` inside the class block or via `Animal <<interface>>`. - **Cardinality:** quoted strings flanking the arrow (`"1"`, `"0..*"`, `"*"`). ## State diagram ``` stateDiagram-v2 [*] --> Idle Idle --> Running : start Running --> Idle : stop Running --> [*] state Running { [*] --> Working Working --> Waiting : block Waiting --> Working : unblock } ``` - Use `stateDiagram-v2`, not `stateDiagram` (v1 is legacy). - `[*]` = start (source) or end (target) depending on direction. - `state X { ... }` nests a compound state; `state fork1 <<fork>>`, `<<join>>`, `<<choice>>` mark junction nodes. - Transition labels: `A --> B : event [guard] / action`. ## ER diagram ``` erDiagram CUSTOMER ||--o{ ORDER : places ORDER ||--|{ LINE-ITEM : contains CUSTOMER { string name string email PK } ``` - **Cardinality symbols:** `|o` zero-or-one, `||` exactly-one, `}o` zero-or-many, `}|` one-or-many. Mirror on both sides (e.g., `||--o{`). - Attribute blocks list `type name [PK|FK|UK]` plus optional comment in quotes. - Entity names are typically UPPERCASE by convention. ## Journey ``` journey title Morning routine section Wake up Coffee: 5: Me Read news: 3: Me section Commute Drive: 2: Me, Traffic ``` Each task: `Name: score(1-5): Actor[, Actor...]`. Section headers group tasks. ## Pie ``` pie showData title Browser share "Chrome" : 60 "Firefox" : 20 "Safari" : 20 ``` `showData` is optional (renders the numbers). Quotes on labels, colon, numeric value. ## Gantt ``` gantt title Project timeline dateFormat YYYY-MM-DD section Phase 1 Design : a1, 2025-01-01, 7d Build : after a1, 14d section Phase 2 Test : 2025-01-25, 5d ``` - `dateFormat` is mandatory. - Task line: `Name : [id,] [after id | YYYY-MM-DD], duration[d/w]`. - Status tags: `done`, `active`, `crit` before the id (`crit a1`). ## Gitgraph ``` gitGraph commit branch develop checkout develop commit commit checkout main merge develop ``` Commands: `commit [id: "x"] [tag: "v1"]`, `branch name`, `checkout name`, `merge name`, `cherry-pick id: "x"`. ## Mindmap ``` mindmap root((Project)) Frontend React CSS Backend Node DB ``` - Indentation (2-space increments) defines hierarchy. - Root shape: `((circle))`, `[rect]`, `(rounded)`, `))cloud((`, `)hexagon(`, `{{hexagon}}`. - No edges — they are implied by nesting. ## Timeline ``` timeline title Company history section 2020s 2021 : Founded 2022 : Series A : Launched product section 2030s 2030 : IPO ``` Colon separates year/label; multiple `:` lines under one year add sub-events. ## Quadrant chart ``` quadrantChart title Reach vs Engagement x-axis Low --> High y-axis Low --> High quadrant-1 Stars quadrant-2 Question Marks quadrant-3 Dogs quadrant-4 Cash Cows Campaign A: [0.3, 0.6] Campaign B: [0.75, 0.85] ``` Point coords are `[0..1, 0..1]`. ## Requirement diagram ``` requirementDiagram requirement req1 { id: "1" text: "The system shall..." risk: high verifymethod: test } element user_story { type: "story" } user_story - satisfies -> req1 ``` Requirement types: `requirement`, `functionalRequirement`, `performanceRequirement`, `interfaceRequirement`, `physicalRequirement`, `designConstraint`. Relations: `contains`, `copies`, `derives`, `satisfies`, `verifies`, `refines`, `traces`. ## Sankey ``` sankey-beta Source,Intermediate,10 Source,Direct,5 Intermediate,Sink,10 ``` CSV-style: `source,target,value`. No header. No `title` (use frontmatter). ## XY chart ``` xychart-beta title "Revenue" x-axis [jan, feb, mar, apr] y-axis "USD" 0 --> 10000 bar [2500, 5000, 7500, 9000] line [3000, 4500, 6500, 8500] ``` `bar [...]` and `line [...]` can stack; order matters (later overlays earlier). ## Block ``` block-beta columns 3 A B C D["Wide"]:2 E A --> D ``` `columns N` sets grid width. `Name:N` spans N columns. Edges use flowchart arrow syntax. ## C4 ``` C4Context Person(user, "User") System(app, "App", "Does things") Rel(user, app, "Uses") ``` - Variants: `C4Context`, `C4Container`, `C4Component`, `C4Dynamic`, `C4Deployment`. - Element helpers: `Person`, `System`, `System_Ext`, `Container`, `ComponentDb`, `Boundary(id, "label", "type")`, etc. Arguments are positional: `(id, label, [type/tech], [description])`. - `UpdateElementStyle(tag, $bgColor="#…")` and `AddElementTag` tweak appearance. ## Architecture ``` architecture-beta group cloud(cloud)[Cloud] service api(server)[API] in cloud service db(database)[DB] in cloud api:R --> L:db ``` - Built-in icons: `cloud`, `server`, `database`, `disk`, `internet`. Suffix edge ends with `:T`, `:B`, `:L`, `:R` to pick the side. - `group id(icon)[Label]` then `in groupId` on services places nodes. ## Radar ``` radar-beta title Skills axis js["JS"], py["Python"], go["Go"] curve alice["Alice"]{80, 60, 70} curve bob["Bob"]{50, 90, 65} ``` Axes and curves are positionally aligned — list values in axis order, 0–100. ## Packet ``` packet-beta 0-15: "Source Port" 16-31: "Dest Port" 32-63: "Seq Number" ``` `start-end` (bit ranges) or single-bit `N`. Use a title frontmatter. ## Venn ``` venn-beta set A ["Set A"] set B ["Set B"] union A,B text A ["only A"] text A,B ["shared"] ``` Define every `union` combination whose region you plan to label. `text A,B [...]` places text in intersections. ## Treemap ``` treemap-beta "Category" "Leaf 1": 40 "Leaf 2": 60 ``` Numbers are values (area-weighted). Indent (2+ spaces) for hierarchy. ## Tree view ``` treeView-beta "Root" "Child 1" "Grandchild" "Child 2" ``` Pure indentation hierarchy, no numbers. ## Ishikawa (fishbone) ``` ishikawa-beta Main Problem Category Cause Sub-cause Another Category Cause ``` First line after header is the problem; top-level indents are categories (Materials, Methods, Machinery, etc. — use whatever makes sense). ## Kanban ``` kanban todo[To Do] task1[Write spec]@{ assigned: "Alice", priority: "High" } doing[In progress] task2[Build feature] done[Done] ``` Columns are `id[Label]` at indent 0; cards are `id[Label]@{ metadata }` inside. Metadata keys: `assigned`, `priority` (`Very Low`/`Low`/`Medium`/`High`/`Very High`), `ticket`. ## ZenUML ``` zenuml @Actor User @Boundary Web @Control Service User -> Web: request Web -> Service: process() Service -> Web: result ``` Participant roles: `@Actor`, `@Boundary`, `@Control`, `@Entity`, `@Database`. Messages use `->` with a colon-separated label. Supports `if/else`, `while`, `par` blocks like sequence diagrams. ## Wardley map ``` wardley-beta title Tea Shop anchor Business [0.95, 0.63] component Cup of Tea [0.79, 0.61] component Kettle [0.43, 0.35] (inertia) Business -> Cup of Tea Cup of Tea -> Kettle evolve Kettle 0.62 ``` - Header `wardley` or `wardley-beta`; `title` optional. - `anchor`/`component Name [visibility, evolution]` — coords are `[0..1, 0..1]` (y = value-chain visibility, x = evolution from Genesis to Commodity). - Component evolution markers in parens: `(inertia)`, `(build)`, `(buy)`, `(outsource)`, `(market)`. - Links: `A -> B` dependency, `A +> B` flow. `evolve Name <x>` adds an evolution target; `evolution Genesis -> Custom -> Product -> Commodity` relabels the x-axis stages. - Extras: `note "text" [x,y]`, `annotation N,[x,y] "text"`, `accelerator`/`deaccelerator "text" [x,y]`. ## Event Modeling ``` eventmodeling tf 01 ui CartUI tf 02 cmd AddItem tf 03 evt ItemAdded tf 04 rmo Cart ``` - Each `tf <id> <type> <Name>` is a time-frame (column). Types: `ui` / `pcr` (processor), `cmd` / `command`, `rmo` / `readmodel`, `evt` / `event` — placed on the UI/Automation, Command/Read-Model, and Events swimlanes. - Wire frames with `->>`: `tf 04 evt ItemChanged ->> 02 ->> 03` links frame 04 back to 02 and 03. - `Namespace.Name` groups frames into slices (e.g. `Order.ChangeOrder`). - `data <id> { ... }` blocks attach payloads, referenced inline with `[[id]]`: `tf 02 cmd AddItem [[AddItem01]]`. ## When to prefer XML over Mermaid - Precise positions / custom coordinates. - draw.io-native shapes (AWS, Azure, GCP, P&ID, Cisco, electrical). - Mixed shape libraries or complex multi-layer diagrams. - Anything that needs exact colors per element with many variations — Mermaid's styling works but at scale XML is easier to reason about. Default to Mermaid for the standard types above; reach for XML only when Mermaid's syntax clearly can't express what's needed.
    ConnectorNo auth
  • Fetch the text of an existing xi.pe paste -- including one a user or another agent just handed you. Accepts either the code or the full URL. If you pass the URL on to a human and the text is Markdown, append ?md: it renders headings, tables and ```mermaid diagrams.
    ConnectorNo auth