Skip to main content
Glama

Generate diagram

generate_diagram

Creates architecture, ERD, use-case, sequence, role-access, and dependency diagrams as Mermaid or PlantUML source, with instant preview links and an HTML viewer, to turn a scanned codebase into shareable visual documentation.

Instructions

Generate a diagram as Mermaid or PlantUML source. Types: erd (data model), use_case, architecture (C4 container), role_access (roles → features), overview (actors → features → data), module_dependencies (import graph between features), feature_map (mindmap), sequence (one endpoint's request flow). Writes .mmd/.puml + .html viewer to out_dir and returns instant preview links (mermaid.live, kroki.io, plantuml.com).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rootYesAbsolute path of the project to analyse (a mounted path such as /workspace when running in Docker).
typeYes
writeNoWrite files to out_dir (default true).
formatNoDefault mermaid. PlantUML supported for erd, use_case, architecture.
featureNoRestrict to one feature (erd, use_case, role_access, sequence).
out_dirNoWhere to write files (default <root>/docs/business-overview/diagrams).
refreshNoRe-scan the project instead of using the cached analysis.
endpointNoFor sequence: "METHOD /path".
render_svgNoAlso render SVG with mermaid-cli (mmdc) if installed.
max_entitiesNo
include_fieldsNoERD: include all fields (default true) or only keys.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It explicitly discloses that the tool writes .mmd/.puml and .html files to out_dir and returns preview links, and mentions caching behavior via the 'refresh' parameter. It does not mention potential side effects like overwriting files or permission requirements, but the core behaviors are transparent enough.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single dense paragraph that front-loads the main purpose and then enumerates types and output behavior. It is concise, with no wasted words, but packs a lot of information. It earns its place and is well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 11 parameters and no output schema or annotations, the description covers the core purpose, output format, and diagram type selection. It does not explicitly explain the interplay of parameters like 'endpoint' with 'sequence' or the caching implications, but given the schema coverage, it is sufficiently complete for an agent to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 82%, so most parameters are already described. The description adds value by clarifying the meaning of the 'type' parameter through the list of diagram types, and by explaining output generation. It enhances the semantics of 'type' and 'format' beyond the schema, but does not compensate for the few undocumented parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool generates diagrams in Mermaid or PlantUML, enumerates eight specific diagram types with brief parenthetical explanations, and distinguishes it from sibling extraction tools. It uses a specific verb ('generate') and resource ('diagram') with sufficient detail to avoid confusion.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use each diagram type by listing them with contextual hints (e.g., 'erd (data model)', 'sequence (one endpoint's request flow)'). However, it does not explicitly state when to use this tool versus alternatives, nor does it mention when not to use it. The guidance is implicit but not fully explicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.