MCP server for compiling and rendering D2 diagrams with support for SVG, PNG, and ASCII output formats
d2-mcp provides three tools for D2 diagram compilation and rendering. Tool naming follows verb_noun convention (compile-d2, render-d2, fetch_d2_cheat_sheet), which is clear and actionable. All tools have non-empty descriptions meeting the 10-1024 character baseline. However, parameter descriptions lack critical constraint information (format enums, mutually exclusive parameter documentation, range limits). Output schemas are not explicitly documented. Error handling is absent from visible code, no recovery guidance, categorization, or actionable error messages. The compile-d2 and render-d2 tools accept mutually exclusive 'code' and 'file_path' parameters but lack explicit mutual exclusivity documentation in descriptions. Parameter descriptions are minimal (avg ~50-60 chars, below the 72-char baseline for A+ tools). No validation rules are stated (e.g., for file_path: path traversal guards, existence checks, readable-by-agent guarantees). Tool composition is sound, each tool has single responsibility, and render-d2 builds on compile-d2's logic internally.
Compile D2 code to validate and check for errors
Retrieve the bundled D2 quick-reference cheat sheet in Markdown.
Render a D2 diagram in png, svg, ascii format
Mutually exclusive parameters (code vs file_path) not documented in parameter descriptions. LLMs will not know whether passing both causes an error or if one takes precedence. compile-d2 and render-d2 both exhibit this.
No output schema documented. Tools return base64-encoded PNG/SVG bytes or plaintext ASCII, but the response structure (field names, types, cardinality) is not declared. LLMs cannot plan downstream processing without knowing the response shape.
No error handling guidance. Handler implementations log errors but do not provide actionable recovery hints. If compile-d2 receives invalid D2 syntax, the error message is not visible in the schema; the LLM has no guidance on what to try next.
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | D | 58 | <=2025-11-25 | v2 |
| 2026-03-09 | D | 52 | - | v1 |
Parameter descriptions lack constraint documentation. 'format' enum is declared in schema, but descriptions do not state 'must be one of: png, svg, ascii'. 'ascii_mode' enum is similarly under-documented.
file_path parameter lacks validation documentation. No mention of: path traversal guards, working directory context (/data), whether absolute paths are allowed, or whether file must exist and be readable. LLMs may pass invalid paths.