# Draw a Mindmap · as an image

Draw a saved Mindmap or a working outline as standalone SVG or interactive HTML with Xale Pro. The render tool also works on tool-only clients.

Checked 2026-12-05 · https://xale.app/docs/ai/draw-a-mindmap-as-an-image

## Draw with a tool call

Call [`xale_render_mindmap`](https://xale.app/docs/ai/tools/xale_render_mindmap) with the broad `read` scope and active Xale Pro. It works on tool-only clients using `tools/list` and `tools/call`.

- Saved Mindmap: send `mapId` from a find or save response. The tool draws up to 500 visible nodes. It uses the saved styling and reports `truncated` if the result is partial.
- Working outline: send `nodes` and an optional `title`. The outline stays unsaved. For either source, `mode` defaults to `light` and `format` defaults to `svg`.

Parse `result.content[0].text` and read its `data`. Save `data.svg` as the supplied `filename` or convert the standalone SVG locally to PNG. For `format: "html"`, open `data.html` in a host that runs scripts. Its **Download PNG** control works where the host permits downloads. Keep the original Xale footer in either format.

## Draw with resources

An active OAuth connection requires confirmed Xale Pro to list or read these two resources. Use `resources/list`, then `resources/read` with the desired `uri`. Each response contains `contents` entries with `uri`, `mimeType` and `text`.

### How to draw a Mindmap as an image

- URI `xale://formats/mindmap-image`
- Name `mindmap-image-format`
- MIME type `text/markdown`

### Mindmap viewer (HTML)

- URI `xale://templates/mindmap-viewer.html`
- Name `mindmap-viewer`
- MIME type `text/html`

If a direct read returns `-32003`, ask the person to check their Pro access. Xale keeps the connection so it works again when Pro is active.

## Prepare data for the resource viewer

For a saved map, use `xale_read_mindmap` with its `id` and the connection’s `read` scope. It reads up to 200 nodes by default and accepts `maxNodes` up to 300. If `data.truncated` is true, retry at 300 if the first limit was lower. If it stays true, label the drawing as partial and say nodes or title text may be missing.

Use the guide’s `fromSavedMindmap(data, glyphFor)` recipe. Keep the returned IDs, parent IDs, titles and sibling order. Copy `style.side` to `side` on root branches, `style.customColor` to border `color`, and the stored `done` flag. The optional glyph resolver maps known stored symbol IDs within the text budget. Link and Task markers in the viewer are visual cues. A Task marker identifies a linked Task, and the check reflects the node’s stored `done`.

For a map you’re working out in the chat, use the guide’s example. Supply one tree of 1 to 500 nodes with unique IDs and existing parent IDs, one `null` parent for the root and no cycles. The display budget is 200 UTF-16 units for the map title, 1,000 per node title, up to eight symbols per node and 16 units per symbol, and 20,000 units for all display text combined.

## Fill the resource viewer and download

Fill the HTML template’s JSON slot with escaped, serialised data. Escape each literal less-than sign before inserting the JSON. Use a replacement callback so literal dollar sequences in text survive.

```js
const filled = html.replace("/*XALE_MAP*/", () =>
  JSON.stringify(map).replace(/</g, "\\u003c")
);
```

Open the filled HTML in a client that runs the template’s script and styles. The template renders with local fonts and makes no network requests. Use `Dark mode` to change the view and `Download PNG` where the host supports blob images and downloads. The PNG prefers 2× resolution, within 8,192 pixels per side and about 16.8 million pixels overall. Keep the Xale footer on the drawing. For a separate renderer, use the guide’s drawing tokens, plain-text labels and footer.

## Save only after agreement

Keep the working JSON for redraws. If the person agrees to save a new map, send OPML 2.0 to [xale_save_mindmap](https://xale.app/docs/ai/tools/xale_save_mindmap) with `write:memories`. For an existing map, ask before calling [xale_add_mindmap_nodes](https://xale.app/docs/ai/tools/xale_add_mindmap_nodes) with `write:memories`, or [xale_rename_mindmap_node](https://xale.app/docs/ai/tools/xale_rename_mindmap_node) with `write:changes`. [xale_tick_mindmap_node](https://xale.app/docs/ai/tools/xale_tick_mindmap_node) uses `write:intentions`.

## Related

- For people: [How do I export a Xale mind map as an image or OPML?](https://xale.app/help/export-a-mindmap-opml-and-image)
- For people: [What can Claude do in Xale?](https://xale.app/help/what-a-connected-ai-can-do)
- Tools: [xale_render_mindmap](https://xale.app/docs/ai/tools/xale_render_mindmap)
- Tools: [xale_read_mindmap](https://xale.app/docs/ai/tools/xale_read_mindmap)
- Tools: [xale_save_mindmap](https://xale.app/docs/ai/tools/xale_save_mindmap)
- Read next: [Mindmap format · OPML](https://xale.app/docs/ai/mindmap-format-opml)
- Read next: [Scopes · what each allows](https://xale.app/docs/ai/scopes-what-each-allows)
