Diagram
diagramRender source code into visual charts using Mermaid, D2, Graphviz, or similar languages, returning PNG or SVG output for display or download.
Instructions
Diagram. Render a diagram via GET. Use type (mermaid, d2, …), query (source code), and format=png for ChatGPT. POST uses diagram_type and diagram_source instead. Credit cost: 5 credits per call.
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": {
"type": "<type>",
"query": "<query>"
},
"name": "diagram"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Diagram language. Allowed values: mermaid, graphviz, plantuml, d2, svgbob, nomnoml, blockdiag, seqdiag, actdiag, nwdiag, bpmn, erd, excalidraw, ditaa, vega, vegalite, wavedrom, wireviz, c4plantuml, structurizr, tikz, pikchr, umlet, symbolator, packetdiag, rackdiag, bytefield, dbml. Default: "mermaid". | |
| query | Yes | Diagram source code (URL-encoded). | |
| share | No | If true, persist the result and return share URLs instead of an image. Leave false to get the image. | |
| fields | No | Comma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost. | |
| format | No | Use png so ChatGPT can display the image. svg is for download or infinite scale. Allowed values: svg, png, jpeg, pdf. Default: "svg". |