Render diagram to PNG
render_diagramConvert diagram-as-code text into a PNG file and return its local path. If the code does not parse, receive an error listing the offending line numbers.
Instructions
Render diagram-as-code text to a PNG file and return the path. Runs locally with no browser and no network. Returns an error listing the offending line numbers if the code does not parse.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "render_diagram"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Diagram source code. Call diagram_syntax for the language reference. | |
| name | No | Base name for the file, without extension. Defaults to the diagram title. | |
| scale | No | Pixel density multiplier. Default 2. | |
| padding | No | Margin around the diagram in pixels. Default 40. | |
| overwrite | No | Replace an existing file with the same name. Default false, which adds a numeric suffix. | |
| background | No | Default white. Use transparent for docs with a dark theme. | |
| outputPath | No | Exact path to write, ending in .png. Must sit inside the render directory or the working directory unless DIAGRAM_MCP_ALLOW_ANY_OUTPUT_PATH is set. |