Export diagram
export_diagramExport the current diagram to .drawio, .png, .svg, or .drawio.svg files. Specify a page to export a single page, or omit for all pages.
Instructions
Export the current diagram to a file. Supports .drawio (XML), .png, .svg, and .drawio.svg (an SVG with the diagram embedded, which draw.io and load_diagram can open again). The format is auto-detected from the file extension, or can be specified explicitly. Images get a 20 px margin; a PNG has a white background (or the page's own background color) unless transparent is true.
Multi-page behaviour:
.drawio with NO page selector: writes the full (all pages).
.drawio with a page selector: writes a single-page containing only that page.
.png / .svg with NO page selector: exports the currently active page in the browser.
.png with a page selector: renders that page without changing what the user sees.
.svg / .drawio.svg with a page selector: temporarily loads that page into the browser, captures it, then restores the full document (the user sees a brief flicker).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute file path to save to (e.g. /Users/me/diagram.drawio, ~/diagram.png). Relative paths resolve against the MCP server's working directory, which is often not your project. | |
| format | No | Export format. If omitted, detected from file extension. Defaults to drawio. | |
| page_id | No | Target a page by its id (as returned by list_pages or add_page). Wins over page_name and page_index when multiple are set. | |
| page_name | No | Target a page by its display name (e.g. "CNN"). Used only when page_id is not set. | |
| page_index | No | Target a page by its 0-based tab index. Used only when page_id and page_name are not set. | |
| transparent | No | PNG only: a transparent background instead of white. Default false. |