Skip to main content
Glama
C4 Diagram MCP Server

C4 Diagram MCP Server

by tarastclair

create-component-diagram

Create a C4 Component diagram in an existing architecture project to show a container's internal components and how they interact. Requires a project ID and title.

Instructions

Create a new C4 Component diagram within an existing architecture project.

If you need to make changes to an existing diagram, use the update-element and update-relationship tools instead.

A Component diagram (C4 Level 3) zooms into a specific container to show the components that make up that container. Use this to show how container responsibilities are distributed across components and how these components interact.

IMPORTANT: Before using this tool, you will need either:
- the project ID returned from the create-c4-project tool
- to locate the project ID of an existing project; In this case, the projectId can be found in a note within the PUML source code for each diagram in the existing project

DO NOT create a new project if you have access to an existing project ID. Reusing the same project ID ensures proper relationships between different diagram levels.

Benefits:
- Shows the internal architecture of a specific container
- Clarifies how responsibilities are distributed across components
- Helps identify key classes, data structures, and libraries needed

Required Input Fields:
- projectId: String (ID of the project to add this diagram to)
- title: String (The name of your container/diagram)

Optional Input Fields:
- description: String (A brief explanation of what the diagram represents)

The response will include unique IDs that you'll need for all subsequent operations,
and the diagram will be saved in your project's component/ directory.

Response Fields:
- message: String (User-friendly message about the update)
- projectId: String (UUID of the project)
- elementIds: Object (Mappings of element IDs by diagram)

You can use the add-element and add-relationship tools to design your diagram,
and when you're finished, you must call the generate-diagram-image tool to create
a png image of the completed diagram.

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>",
      "title": "<title>"
    },
    "name": "create-component-diagram"
  }
}

Input Schema

NameRequiredDescriptionDefault
titleYesTitle for the new diagram
projectIdYesID of the project to add this diagram to
descriptionNoOptional description of what the diagram represents

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does disclose meaningful behavior: the diagram is written into the project's component/ directory, unique IDs are returned for subsequent operations, and image generation is a mandatory final step. It stops short of covering failure modes, permission requirements, or what the initial empty diagram looks like.

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?

The critical routing and prerequisite information is front-loaded, which is good, but the "Benefits" bullet list and the full restatement of input fields (already 100% documented in schema) are padding. The bulk is justified only partly by the absence of an output schema.

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?

For a creation tool with no annotations and no output schema, the description supplies the missing pieces: prerequisites for projectId, response fields, storage location, and the required downstream workflow. An agent could invoke this and know what to do next without further inspection.

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 all three parameters are already documented in the schema. The description restates the same required/optional fields and adds only the mild clarification that title names the container/diagram; it contributes no format or constraint detail beyond the schema, so the baseline 3 applies.

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 ("Create a new C4 Component diagram") and scopes it to an existing project. It further disambiguates by defining what a Component diagram is (C4 Level 3, zooms into a container) and by naming the siblings that handle the adjacent case (update-element/update-relationship).

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?

Explicitly separates creation from modification ("If you need to make changes to an existing diagram, use the update-element and update-relationship tools instead"). It also states prerequisites for obtaining projectId, forbids creating a redundant project, and closes with the required next steps (add-element, add-relationship, then generate-diagram-image).

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