Skip to main content
Glama
C4 Diagram MCP Server

C4 Diagram MCP Server

by tarastclair

generate-diagram-image

Generate a PNG image from the current C4 diagram state by sending PlantUML code to the PlantUML server. Call it after diagram edits to create the visual output for users.

Instructions

Generate a PNG image from the current state of the diagram.

This tool generates a visual representation (PNG) of your C4 diagram by sending the PlantUML
code to the PlantUML server. It should be used ONLY when you've finished designing your
diagram to avoid rate limiting issues with the PlantUML server.

All other diagram modification tools (add-element, add-relationship, etc.) only update
the PlantUML source file but do not generate the image. You must explicitly call this
tool when you have finished designing your diagram to create its visual representation
for the user.

Required Input Fields:
- projectId: String (UUID from create-c4-project)
- diagramId: String (UUID from create-context-diagram or create-container-diagram)

Response Fields:
- message: String (User-friendly message about the operation)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element UUIDs to their names)

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": {
      "projectId": "<projectId>",
      "diagramId": "<diagramId>"
    },
    "name": "generate-diagram-image"
  }
}

Input Schema

NameRequiredDescriptionDefault
diagramIdYesUUID of the diagram from create-context-diagram or create-container-diagram
projectIdYesUUID of the project from create-c4-project

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does well: it discloses the external dependency (PlantUML server round-trip), the rate-limit constraint, and the fact that no other tool produces the image. It does not describe failure behavior or where/how the PNG is surfaced, which keeps it short of a 5.

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?

Purpose and the rate-limit caveat are front-loaded, and the field lists are scannable. The 'Required Input Fields' block largely restates the schema, and the response field list includes an elementIds mapping that is not obviously tied to image generation, adding minor noise.

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?

There is no output schema, so documenting the response fields is appropriate and helpful, and the description covers the external dependency an agent should anticipate. The listed elementIds response field is unexplained and slightly undermines confidence in the stated return shape.

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, but the description adds provenance value by naming the originating tools (create-c4-project for projectId, create-context-diagram/create-container-diagram for diagramId), which helps the agent resolve the UUIDs rather than guess.

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 artifact ('Generate a PNG image from the current state of the diagram') and explicitly distinguishes itself from the sibling mutation tools, noting that add-element/add-relationship only update the PlantUML source and do not render. An agent can pick this tool over its siblings without inspecting 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 explicit when-to-use ('ONLY when you've finished designing your diagram'), the reason (avoid rate limiting on the PlantUML server), and the when-not-to-use case (intermediate edits, where the other tools suffice). It also states the call must be explicit rather than implied by prior edits.

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