render_d2
Render architecture diagrams from D2 code to SVG or PNG. Supports containers, nested groups, icons, and complex layouts with multiple layout engines.
Instructions
Render a D2 architecture diagram to SVG or PNG. Best for: architecture diagrams with containers, nested groups, icons, and complex layouts. IMPORTANT: D2 syntax is NOT Mermaid. Use '->' for arrows (not '-->'), containers with 'name: { ... }' (not 'subgraph'). Anti-patterns: Mermaid syntax, unbalanced braces, >3 nesting levels. Call get_tool_guide('d2') for examples.
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_d2"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | D2 diagram code. Use '->' for arrows, 'name: { ... }' for containers. NOT Mermaid syntax. | |
| theme | No | D2 theme ID: 0=default, 1=neutral-grey, 3=terminal, 100=neutral-default | |
| format | No | Output format. SVG preferred. PNG is slower (requires Chromium conversion). | svg |
| layout | No | Layout engine. dagre=hierarchical (default), elk=complex layouts with many crossings | dagre |