Skip to main content
Glama

Render a drawspec document to SVG, PNG or text

render_document
Read-onlyIdempotent

Draw the document. Use it when it is ready to show; while still fixing errors, validate_document returns just the verdict.

Instructions

Draw the document. Use it when it is ready to show; while still fixing errors, validate_document returns just the verdict. Returns one content block by format: svg (default) self-contained SVG text, safe inline in Markdown; png a base64 image/png block (needs the server's drawspec[png] extra, slowest); text plain text for a code block, only for kinds with a text form. width/height override the document's size; with text, width is cells per line and height and theme are ignored. Local, deterministic, writes nothing. Refusals are error results with JSON text {"ok": false, "error": "DocumentError", "message": "...", "violations": [{"pointer": "/edges/0/to", "message": "..."}]}: error is e.g. DocumentError or FitError, pointer is RFC 6901 (empty for the whole document), and violations is never empty.

Input Schema

NameRequiredDescriptionDefault
scaleNopng only: pixels per SVG unit (default 2).
themeNoA bundled theme name (accent, blueprint, compartment, default, wheel) or a path to a `.toml` theme file on the server's disk, e.g. `blueprint`. Omit for `default`.
widthNoOverride the document's width, e.g. `640`. With format `text`, the most terminal cells a line may take (default 80, or 100 for `lanes` and `sequence`).
formatNosvg (default), png, or text: the diagram as plain text for a code block or a terminal, for the kinds files, tree, sequence, gantt, timeline, board, stack, rag, meter, flow, states, lanes.
heightNoOverride the document's height (ignored with format `text`).
charsetNotext only: box-drawing characters, or ASCII only (default unicode).
documentYesA drawspec document as a JSON object (not a string or a path), e.g. `{"version": 1, "kind": "flow", "nodes": [...], "edges": [...]}`. `list_kinds` names the 36 values `kind` may take, `get_example` returns the smallest valid document of one, and `get_schema` returns its fields (the whole format is published at https://nuncaeslupus.github.io/drawspec/schema/drawspec-v1.schema.json).
variantsNosvg only: more themes for the same drawing, by the name a page selects each with, e.g. `{"dark": "./dark.toml"}`. The SVG switches on an ancestor's `data-theme`, and `dark` also follows `prefers-color-scheme`; `theme` is the base and answers to `light`. A variant may change colours only.
backgroundNopng only: the page the drawing is on (default light).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.4.3
    • addedInput schema / properties / variants
      Added value: +{
      +  "additionalProperties": {
      +    "type": "string"
      +  },
      +  "description": "svg only: more themes for the same drawing, by the name a page selects each with, e.g. `{\"dark\": \"./dark.toml\"}`. The SVG switches on an ancestor's `data-theme`, and `dark` also follows `prefers-color-scheme`; `theme` is the base and answers to `light`. A variant may change colours only.",
      +  "type": "object"
      +}
  2. Changed4 schema fields changedv0.3.4
    • changedInput schema / properties / document / description
      Previous value: -"A drawspec document, as JSON. `list_kinds` names the 36 values `kind` may take, `get_example` returns the smallest valid document of one, and `get_schema` returns its fields (the whole format is published at https://nuncaeslupus.github.io/drawspec/schema/drawspec-v1.schema.json)."New value: +"A drawspec document as a JSON object (not a string or a path), e.g. `{\"version\": 1, \"kind\": \"flow\", \"nodes\": [...], \"edges\": [...]}`. `list_kinds` names the 36 values `kind` may take, `get_example` returns the smallest valid document of one, and `get_schema` returns its fields (the whole format is published at https://nuncaeslupus.github.io/drawspec/schema/drawspec-v1.schema.json)."
    • changedInput schema / properties / height / description
      Previous value: -"Override the document's height."New value: +"Override the document's height (ignored with format `text`)."
    • changedInput schema / properties / theme / description
      Previous value: -"A bundled theme name or a path to a theme file. Omit for the default."New value: +"A bundled theme name (accent, blueprint, compartment, default, wheel) or a path to a `.toml` theme file on the server's disk, e.g. `blueprint`. Omit for `default`."
    • changedInput schema / properties / width / description
      Previous value: -"Override the document's width. With format `text`, the most terminal cells a line may take (default 80, or 100 for `lanes` and `sequence`)."New value: +"Override the document's width, e.g. `640`. With format `text`, the most terminal cells a line may take (default 80, or 100 for `lanes` and `sequence`)."
  3. Addedv0.3.3

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already cover read-only/idempotent/no-write, and the description still adds determinism, a performance note for png, a required server extra (`drawspec[png]`), and the exact refusal envelope with `DocumentError`/`FitError`, RFC 6901 pointers, and non-empty `violations`. That is substantive behavior beyond the structured fields.

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?

Front-loaded with the decision to render versus validate, then returns, then parameter effects, then errors — a sensible order with no filler. Some sentences are long semicolon-chained compounds, but every clause carries operative information.

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

Completeness5/5

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

Nine parameters, a nested document object, and no output schema — yet the description still explains the return block per format and the JSON error shape. An agent has everything needed to call it and interpret both success and refusal.

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 coverage is 100%, so the baseline is 3; the description earns above that by explaining cross-parameter interactions (with `text`, `width` is cells per line while `height` and `theme` are ignored) and by describing per-`format` return shapes. A fair amount still repeats schema text, which keeps it from a 5.

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?

States a specific verb and resource ('Draw the document') and the title adds the concrete outputs (SVG, PNG, text). It explicitly routes away from the sibling `validate_document`, so an agent can distinguish it without opening any schema.

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

Usage Guidelines5/5

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

Gives a clear trigger ('when it is ready to show') and names the alternative for the opposite case ('while still fixing errors, `validate_document` returns just the verdict'). It also steers format choice with per-format guidance (svg default/safe inline, png slowest, text only for kinds with a text form).

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