Skip to main content
Glama

Generate Diagram

generate_uml
Idempotent

Render diagram source code into an image and return a render link, Markdown embed, or saved file for documentation and chat use.

Instructions

Render diagram source into an image. Returns url (render link), playground (source editor), display_markdown (chat embed), content_base64/mime_type when bytes are fetched and local_path for a saved file. Prefer SVG in MCP Apps.

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": {
      "diagram_type": "<diagram_type>",
      "code": "<code>"
    },
    "name": "generate_uml"
  }
}

Input Schema

NameRequiredDescriptionDefault
codeYesDiagram source code in the syntax required by diagram_type.
scaleNoSVG scale factor; ignored for non-SVG output.
themeNoOptional theme: PlantUML name (e.g. cerulean), Mermaid default/dark/forest/neutral/base, D2 default/dark, or light/dark/bw.
output_dirNoOptional local directory for the rendered file; omit on hosted deployments.
diagram_typeYesCatalog key selecting the source language and renderer; discover keys with list_diagram_types.
output_formatNoImage or document encoding to produce; consult the type’s formats from list_diagram_types.svg

Output Schema

NameRequiredDescriptionDefault
urlNo
codeYes
errorNo
sourceNo
successNo
attemptsNoRenderers tried, in order.
cache_hitNo
mime_typeNo
render_msNo
local_pathNo
playgroundNo
inline_noteNo
diagram_typeNo
error_detailNoFailed requests only: code, message, retryable, line, column, suggestion, diagram_type, backend.
fallback_usedNo
output_formatNo
content_base64NoInline preview
inline_omittedNo
source_omittedNo
cache_lookup_msNo
preview_resizedNo
display_markdownNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.4.1
    • changedOutput schema / description
      Previous value: -"Structured output for diagram generation tools.\n\nThe first MCP Apps response is bounded because structuredContent and the\nMCP image block may each contain an encoded copy of the same diagram."New value: +"Diagram render result."
    • changedOutput schema / properties / attempts / description
      Previous value: -"Renderers tried, in order: backend, ok, status, duration_ms, error_summary, error_code, retry_count."New value: +"Renderers tried, in order."
    • changedOutput schema / properties / content_base64 / description
      Previous value: -"Bounded inline preview (max 48,000 base64 characters); larger images use a resized PNG preview when possible."New value: +"Inline preview"
  2. Changed10 schema fields changedv1.4.0
    • addedInput schema / properties / code / description
      Added value: +"Diagram source code in the syntax required by diagram_type."
    • addedInput schema / properties / diagram_type / description
      Added value: +"Catalog key selecting the source language and renderer; discover keys with list_diagram_types."
    • addedInput schema / properties / output_dir / description
      Added value: +"Optional local directory for the rendered file; omit on hosted deployments."
    • addedInput schema / properties / output_format / description
      Added value: +"Image or document encoding to produce; consult the type’s formats from list_diagram_types."
    • addedInput schema / properties / scale / description
      Added value: +"SVG scale factor; ignored for non-SVG output."
    • addedInput schema / properties / theme / description
      Added value: +"Optional theme: PlantUML name (e.g. cerulean), Mermaid default/dark/forest/neutral/base, D2 default/dark, or light/dark/bw."
    • removedOutput schema / additionalProperties
      Removed value: -true
    • addedOutput schema / description
      Added value: +"Structured output for diagram generation tools.\n\nThe first MCP Apps response is bounded because structuredContent and the\nMCP image block may each contain an encoded copy of the same diagram."
    • addedOutput schema / properties
      Added value: +{
      +  "attempts": {
      +    "anyOf": [
      +      {
      +        "items": {
      +          "additionalProperties": true,
      +          "type": "object"
      +        },
      +        "type": "array"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ],
      +    "description": "Renderers tried, in order: backend, ok, status, duration_ms, error_summary, error_code, retry_count."
      +  },
      +  "cache_hit": {
      +    "type": [
      +      "boolean",
      +      "null"
      +    ]
      +  },
      +  "cache_lookup_ms": {
      +    "type": [
      +      "number",
      +      "null"
      +    ]
      +  },
      +  "code": {
      +    "maxLength": 12000,
      +    "type": "string"
      +  },
      +  "content_base64": {
      +    "anyOf": [
      +      {
      +        "maxLength": 48000,
      +        "type": "string"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ],
      +    "description": "Bounded inline preview (max 48,000 base64 characters); larger images use a resized PNG preview when possible."
      +  },
      +  "diagram_type": {
      +    "type": [
      +      "string",
      +      "null"
      +    ]
      +  },
      +  "display_markdown": {
      +    "type": [
      +      "string",
      +      "null"
      +    ]
      +  },
      +  "error": {
      +    "type": [
      +      "string",
      +      "null"
      +    ]
      +  },
      +  "error_detail": {
      +    "anyOf": [
      +      {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      {
      +        "type": "null"
      +      }
      +    ],
      +    "description": "Failed requests only: code, message, retryable, line, column, suggestion, diagram_type, backend."
      +  },
      +  "fallback_used": {
      +    "type": [
      +      "boolean",
      +      "null"
      +    ]
      +  },
      +  "inline_note": {
      +    "type": [
      +      "string",
      +      "null"
      +    ]
      +  },
      +  "inline_omitted": {
      +    "type": [
      +      "boolean",
      +      "null"
      +    ]
      +  },
      +  "local_path": {
      +    "type": [
      +      "string",
      +      "null"
      +    ]
      +  },
      +  "mime_type": {
      +    "type": [
      +      "string",
      +      "null"
      +    ]
      +  },
      +  "output_format": {
      +    "type": [
      +      "string",
      +      "null"
      +    ]
      +  },
      +  "playground": {
      +    "type": [
      +      "string",
      +      "null"
      +    ]
      +  },
      +  "preview_resized": {
      +    "type": [
      +      "boolean",
      +      "null"
      +    ]
      +  },
      +  "render_ms": {
      +    "type": [
      +      "number",
      +      "null"
      +    ]
      +  },
      +  "source": {
      +    "type": [
      +      "string",
      +      "null"
      +    ]
      +  },
      +  "source_omitted": {
      +    "type": [
      +      "boolean",
      +      "null"
      +    ]
      +  },
      +  "success": {
      +    "type": [
      +      "boolean",
      +      "null"
      +    ]
      +  },
      +  "url": {
      +    "type": [
      +      "string",
      +      "null"
      +    ]
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "code"
      +]
  3. Changed6 schema fields changedv1.3.1
    • removedInput schema / properties / code / description
      Removed value: -"Diagram code in the syntax for the chosen type"
    • removedInput schema / properties / diagram_type / description
      Removed value: -"Type of diagram (class, sequence, activity, mermaid, d2, etc.)"
    • removedInput schema / properties / output_dir / description
      Removed value: -"Directory to save the image. Omit or None for URL, playground,\nand content_base64 only (no file write; use in serverless / read-only)."
    • removedInput schema / properties / output_format / description
      Removed value: -"svg, png, pdf, jpeg, txt, or base64 (default: svg). See uml://formats per type."
    • removedInput schema / properties / scale / description
      Removed value: -"Scale factor for SVG only (default 1.0, min 0.1). Ignored for other formats."
    • removedInput schema / properties / theme / description
      Removed value: -"PlantUML theme for UML diagrams (e.g. cerulean)"
  4. First observedv1.3.0

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare idempotent, non-destructive, open-world behavior, so the safety profile is covered. The description adds conditional output semantics — content_base64/mime_type appear only when bytes are fetched, local_path only for a saved file — which is genuine behavioral nuance, but it says nothing about network/auth requirements or failures despite openWorldHint=true. An output schema exists, so restating the return field names earns limited extra credit.

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

Conciseness5/5

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

Two sentences, front-loaded with the action, then a compact enumeration of return artifacts and a formatting recommendation. Nothing is padded and no sentence is redundant.

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?

With a full output schema and complete parameter descriptions, the description only needs to carry purpose and routing. It covers purpose and the return artifact set well; the main gap is the absence of any sibling-routing or pre-validation guidance for a 6-parameter tool with five similarly named neighbors.

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%, with per-parameter docs for scale, theme, output_dir, output_format, and the catalog-key discovery path for diagram_type. The description adds no parameter-level meaning beyond the one implicit hint that SVG is preferred, so the baseline 3 applies.

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?

"Render diagram source into an image" gives a specific verb (render) and resource (diagram source → image), so the core action is unambiguous. It does not name or differentiate itself from close siblings such as generate_uml_image, generate_uml_batch, or rerender_diagram, leaving the agent to infer the boundary.

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?

The only usage steer is "Prefer SVG in MCP Apps," which is a real but narrow formatting guideline. There is no guidance on when to pick this over generate_uml_image or generate_uml_batch, nor a pointer to validate_uml before rendering; the list_diagram_types reference appears only inside the schema, not in the description.

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