Convert Mermaid diagrams to Excalidraw diagrams and export as images with preview URLs
The server implements a single tool 'draw-diagram' with significant definition quality gaps. While the tool is explicitly registered with a Zod schema and description, the definition lacks parameter descriptions, comprehensive error handling guidance, and output schema documentation. The tool name is action-oriented but the implementation reveals deeper issues: input validation is minimal, error messages are generic, and there is no structured output schema communicated to the LLM. The schema is present but incomplete, the 'diagram' parameter has a description, but the return value structure is not formally documented, forcing LLMs to infer output shape from runtime behavior.
Convert a mermaid diagram to an image and preview URL displaying the Excalidraw diagram
Output schema not documented. Tool returns a complex content array with text, image, and metadata fields, but LLMs have no formal specification of this structure. This forces LLMs to infer output shape at runtime and makes downstream tool chaining impossible.
Generic error handling. Catch block returns 'Failed to export mermaid diagram: ' + error message, but does not categorize the error (retryable? user-fixable?) or suggest recovery steps. Per pattern:recovery-guide, errors must tell LLMs what to do next.
Tool description lacks clarity on when to use it vs alternatives and what constitutes valid Mermaid input. Description is 97 characters, within acceptable range, but does not specify supported Mermaid diagram types, constraints, or failure modes.
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | D | 55 | <=2025-11-25 | v2 |
| 2026-03-09 | F | 41 | - | v1 |
No input validation on 'diagram' parameter. Tool accepts any string and relies on downstream mermaid-to-excalidraw library to reject invalid input. Missing formal parameter constraints (e.g., min/max length, allowed diagram types) per pattern:constrained-input.
Side effect of calling external user app API (POST to localhost:8080/api/current-diagram) is not documented in tool description. Agents need to know this tool modifies external state. Per pattern:command-tool, state-modifying tools must declare this explicitly.
No idempotency guarantee. Tool generates screenshot and sends to local app; repeated calls with same input may produce slightly different results (e.g., if app state changed). Per pattern:idempotent-operation, tools should be safe to retry.