render_diagram
Render a mingrammer/diagrams Python snippet to PNG and return the image.
The code must be a complete Python script using from diagrams import ... imports
and a with Diagram(...) context manager block.
Use search_nodes to verify node names and get correct import paths before writing code. Read the diagrams://reference/diagram, diagrams://reference/edge, and diagrams://reference/cluster resources for constructor options and usage examples.
Args:
code: Full Python code using the diagrams library.
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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| format | No | png | |
| filename | No | diagram | |
| download_link | No |