MCP server for validating Mermaid diagrams
Single tool with clear purpose but moderate gaps in schema completeness and parameter descriptions. Tool uses proper Pydantic models for output which is excellent, but input parameters lack formal constraints (enums, ranges). Description is adequate (200+ chars) and addresses prerequisites, but could be more LLM-optimized. Parameter descriptions exist but are generic. Output schema is well-defined via Pydantic BaseModel. No critical security issues detected (no secrets in parameters). Error handling returns structured MermaidValidationResult with is_valid and error_message fields, which guides recovery. Tool follows single-responsibility pattern and is idempotent.
Validate a mermaid diagram and optionally render it as a PNG image. Uses mermaid-cli to validate and render the diagram. Requires mermaid-cli to be installed globally via npm: npm install -g @mermaid-js/mermaid-cli
Missing enum constraint on 'return_image' parameter. Although boolean, the description includes a warning about context length impact. Suggest documenting this as a trade-off pattern with clear guidance on when to use True vs False.
Parameter 'diagram_text' lacks format constraints. No guidance on max length, required syntax, or common failure modes (e.g., 'diagram_text must be valid Mermaid syntax; see https://mermaid.js.org/syntax/syntax.html'). This invites invalid input from LLMs.
Error handling could be more granular. Currently returns single error_message field. Consider distinguishing between validation errors (diagram syntax), dependency errors (mermaid-cli not installed), and runtime errors (subprocess timeout) to enable better agent recovery strategies.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-21 | D | 52 | 2026-07-28+ | v2 |
| 2026-03-09 | D | 59 | - | v1 |
Tool depends on external npm dependency (mermaid-cli) not bundled with the server. Installation instructions are in docstring but not enforced at runtime. Tool should validate mermaid-cli availability on startup and return clear actionable error if missing, rather than failing on first invocation.
Output field 'diagram_image' can be very large (base64-encoded PNG). Description warns about context length but provides no guidance on typical sizes or how to estimate impact. Consider documenting typical image sizes (e.g., 'Small diagrams ~10KB, complex ones ~100KB+').