Skip to main content
Glama
C4 Diagram MCP Server

C4 Diagram MCP Server

by tarastclair

locate-or-create-c4-project

Finds or creates a C4 architecture project to group related context, container, component, and code diagrams and keep diagram relationships intact.

Instructions

A C4 project is a collection of related architecture diagrams that describe a system at different levels of detail. This tool sets up the foundation for creating a cohesive set of diagrams including Context (L1), Container (L2), Component (L3), and Code (L4) diagrams.

IMPORTANT: If your intent is to create a container, component, or code diagram, then it is likely that a project
already exists and you SHOULD NOT create a new project. Instead:
1. Check for existing project IDs in any PUML code shared in the conversation
2. Look for notes like: "This diagram is part of the X project with ID Y"
3. If you find a project ID, DO NOT use this tool and skip directly to calling the appropriate diagram creation tool

Creating multiple disconnected projects for the same system will break diagram relationships and navigation.

Conditional Input Fields:
To locate an existing project:
- id: String (UUID of an existing project - use this if you already know the project ID)

To search for or create a project:
- name: String (Name of the architecture project to search for or create)
- rootPath: String (Filesystem path where project directories will be created if needed)
- description: String (A brief explanation of what the project represents)
   
Response Fields:
- message: String (User-friendly message about the operation)
- projectId: String (UUID of the existing or newly created project)
- diagrams: Object (Information about existing diagrams if a project was found)

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "locate-or-create-c4-project"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNoUUID of an existing project - use this if you already know the project ID
nameNoName of the architecture project to search for or create
rootPathNoFilesystem path where project directories will be created if needed
descriptionNoOptional description of what the project represents

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations provided, the description carries the burden well: it discloses that the tool both looks up and creates, that directories may be created at rootPath, and it summarizes the response fields (message, projectId, diagrams). It does not state what happens when a name search matches multiple projects, nor whether creation requires any particular permissions, so a small gap remains.

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?

Structure is deliberate: concept definition, then a front-loaded IMPORTANT block with numbered steps, then conditional fields, then response fields. The caution block is long but earns its place by preventing a destructive mistake. Some repetition exists between the prose parameter list and the schema descriptions.

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?

For a tool with side effects (filesystem directories, project creation), no annotations, and no output schema, the description covers the essentials, including return fields and the failure mode of duplicating projects. The main omission is how ambiguous name matches are resolved during the search half of the operation.

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 schema already documents all four parameters. The description's parameter section largely restates those same descriptions (UUID, name to search for or create, filesystem path, brief explanation) with no extra syntax, format, or validation detail, so it adds little beyond structured data. The split into 'locate' vs 'search/create' field groups does give mild guidance on which fields belong together.

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?

The description explains that this tool 'sets up the foundation' for a cohesive diagram set, and the conditional-input section makes the dual locate-or-create behavior explicit. It also distinguishes itself from the sibling diagram-creation tools by saying they should be used instead when a project already exists. The opening sentence defines the domain concept rather than stating the verb directly, so it is slightly indirect but still clear.

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?

It gives an explicit when-NOT-to-use rule, with three concrete steps for detecting an existing project ID (PUML code, notes, then skipping this tool), and names the alternative path (call the appropriate diagram creation tool). It also explains the cost of misuse: disconnected projects break relationships and navigation.

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