open_drawio_xml
Open the draw.io editor with a diagram from draw.io XML for custom styling, precise positioning, and stencil-based visuals such as cloud, network, P&ID, UI mockups, or floor plans.
Instructions
Opens the draw.io editor with a diagram from draw.io XML. Use it for custom styling, precise positioning and stencil-based diagrams (cloud, network, P&ID, UI mockups, floor plans); prefer open_drawio_mermaid for flowcharts, sequence, class, ER and the other types Mermaid covers.
XML rules:
Skeleton: …. Unique ids. No XML comments.
Vertex:
Edge: . Never self-closing. No waypoints or exitX/entryX.
Labels: html=1 in every style; escape HTML in values (<b>Name</b><br>detail); line break <br>, never \n.
Shapes: rhombus (decision), ellipse, shape=cylinder3 (database), text.
Grid, no layout math: x=col180+40, y=row120+40, one node per cell; 140×60 boxes, 140×80 diamonds.
Containers: swimlane;startSize=24; (titled) or group; (invisible); children set parent="" with coordinates relative to it. An edge's parent is the innermost container holding both its ends, else "1".
Lanes: swimlane;horizontal=0;startSize=110; at x=0, y=lane150, height 150; nodes inside at x=120+col180, y=45.
Edges: orthogonal; entityRelationEdgeStyle for ER; labels 1-3 words; dashed=1 for one meaning, with a legend.
Cloud/network/P&ID icons or logos: call search_shapes, use its style.
Set postLayout "elk" for flowcharts, process and tree diagrams (ELK places nodes and routes edges), or routing "libavoid" for hand-placed layouts whose edges would cross shapes. Never both.
Only when the diagram needs layers, tags, metadata and placeholders, tables, cross-functional grids or dark-mode colors, call get_drawio_reference with format "xml" for the full reference.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dark | No | Dark mode setting. Default: auto | |
| content | Yes | The draw.io XML content in mxGraphModel format. | |
| routing | No | Optional obstacle-avoiding orthogonal edge-routing pass (libavoid), applied server-side before the diagram opens. The only value is "libavoid". It keeps your vertex positions and only recomputes the connectors so they run in clean right-angle segments that route AROUND the boxes instead of cutting through them (draw.io's default router draws a straight/simple line with no obstacle avoidance). Set it for hand-placed diagrams where edges would otherwise cross shapes — architecture, network, deployment, UML, floor plans. Omit it for sparse layouts where connectors won't overlap anything. Treat `postLayout` and `routing` as alternatives: ELK already routes its own edges, so don't set both. | |
| lightbox | No | Open in lightbox mode (read-only view). Default: false | |
| direction | No | Flow direction for `postLayout: "elk"`: "vertical" (top-down, the default) or "horizontal" (left-to-right). Only meaningful together with `postLayout`. | |
| postLayout | No | Optional full re-layout (ELK layered flow), applied server-side before the diagram opens. The only value is "elk". It PLACES the vertices — your x/y coordinates then only need to express rough direction — and routes the edges as part of the layout. Set it for every directional/hierarchical diagram: flowcharts, process and state diagrams, decision trees, pipelines. Omit it when the layout carries hand-crafted meaning (swimlanes, containers, architecture, UML), which is the usual reason to place cells by hand. Node sizes are kept exactly as you declare them; only positions change (and containers resize around their laid-out children). |