Skip to main content
Glama

Render diagram to PNG

render_diagram

Convert diagram-as-code text into a PNG file and return its local path. If the code does not parse, receive an error listing the offending line numbers.

Instructions

Render diagram-as-code text to a PNG file and return the path. Runs locally with no browser and no network. Returns an error listing the offending line numbers if the code does not parse.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesDiagram source code. Call diagram_syntax for the language reference.
nameNoBase name for the file, without extension. Defaults to the diagram title.
scaleNoPixel density multiplier. Default 2.
paddingNoMargin around the diagram in pixels. Default 40.
overwriteNoReplace an existing file with the same name. Default false, which adds a numeric suffix.
backgroundNoDefault white. Use transparent for docs with a dark theme.
outputPathNoExact path to write, ending in .png. Must sit inside the render directory or the working directory unless DIAGRAM_MCP_ALLOW_ANY_OUTPUT_PATH is set.
Behavior4/5

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

Annotations are all false and convey little, so the description carries the burden. It adds meaningful behavior: local/offline rendering, returning a file path, and reporting parse errors with offending line numbers. It does not detail overwrite/persistence behavior, but that is covered by the overwrite parameter schema.

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 dense, front-loaded sentences: the first names the action and result, the second gives execution environment and error behavior. There is no filler or redundant restatement.

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?

Even without an output schema, the description explains the return value ('return the path') and error case ('error listing the offending line numbers'). Combined with full parameter schema coverage, the agent has enough information to invoke the tool correctly and interpret results.

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 description does not need to compensate for undocumented parameters. It adds only general context like 'diagram-as-code text,' which maps to the code parameter but does not go beyond what the schema already provides.

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: 'Render diagram-as-code text to a PNG file and return the path.' It clearly distinguishes itself from the sibling tools: validate_diagram checks code, preview_diagram probably shows a preview, and diagram_syntax is a language reference.

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 description implies the use case — produce a PNG file on disk — and adds environment context ('Runs locally with no browser and no network'). However, it does not explicitly say when to prefer render_diagram over validate_diagram or preview_diagram, nor does it mention any exclusion criteria.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/JVmano/diagram-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server