Skip to main content
Glama

Diagram

diagram
Read-only

Render source code into visual charts using Mermaid, D2, Graphviz, or similar languages, returning PNG or SVG output for display or download.

Instructions

Diagram. Render a diagram via GET. Use type (mermaid, d2, …), query (source code), and format=png for ChatGPT. POST uses diagram_type and diagram_source instead. Credit cost: 5 credits per call.

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": {
      "type": "<type>",
      "query": "<query>"
    },
    "name": "diagram"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeYesDiagram language. Allowed values: mermaid, graphviz, plantuml, d2, svgbob, nomnoml, blockdiag, seqdiag, actdiag, nwdiag, bpmn, erd, excalidraw, ditaa, vega, vegalite, wavedrom, wireviz, c4plantuml, structurizr, tikz, pikchr, umlet, symbolator, packetdiag, rackdiag, bytefield, dbml. Default: "mermaid".
queryYesDiagram source code (URL-encoded).
shareNoIf true, persist the result and return share URLs instead of an image. Leave false to get the image.
fieldsNoComma-separated list of fields to keep in the response, with dot notation for nested fields (e.g. name,location.city). Does not change the credit cost.
formatNoUse png so ChatGPT can display the image. svg is for download or infinite scale. Allowed values: svg, png, jpeg, pdf. Default: "svg".

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior3/5

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

Adds real value beyond annotations with the credit cost (5 credits per call), which no structured field conveys, and implies a read-style GET render that matches readOnlyHint=true. However, the "POST uses diagram_type and diagram_source instead" sentence describes parameters that do not exist in this tool's schema, which is confusing noise for an agent reading the definition.

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

Conciseness3/5

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

Short and front-loaded, with the core action first and cost last. The GET/POST sentence does not apply to this tool's five-parameter schema and reads as copied context, so it fails to earn its place.

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

Completeness3/5

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

For a five-parameter render tool with full schema coverage, annotations, and no output schema, the definition covers cost and format selection reasonably. It leaves out when to prefer persisted share links over a returned image, and how this tool relates to the diagram_render/diagram_view siblings.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3; the description largely restates schema content (type, query, format values, png-for-ChatGPT advice). It adds the credit-cost caveat but never explains the trade-off between image output and persisted share URLs, so it does not meaningfully exceed the schema.

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

Purpose4/5

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

States a specific verb and resource ("Render a diagram") and names the key inputs (type, query, format), so the core action is unambiguous. It does not distinguish itself from siblings like diagram_render, diagram_ai, or diagram_view, which is the only thing keeping it from a 5.

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

Usage Guidelines3/5

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

Offers one concrete usage rule ("Use format=png for ChatGPT") and a cost note, which implies this is the direct/low-level render path. It gives no explicit when-to-use versus diagram_ai or diagram_render, and no exclusions, so routing between siblings remains inferred.

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