Skip to main content
Glama

Create New Diagram

diagrams_create

Create new PlantUML or Mermaid diagram files with automatic directory creation and basic syntax validation. Clearly invalid sources are rejected to prevent incorrect files.

Instructions

Create a new PlantUML or Mermaid diagram file under the diagrams root.

The diagram type is inferred from the file extension in relative_path:

  • .puml or .plantuml -> PlantUML

  • .mmd or .mermaid -> Mermaid

This tool refuses to overwrite an existing file — use diagrams_update for that. Intermediate directories in relative_path are created automatically.

Performs a basic, dependency-free syntax check before writing (not full validation): PlantUML must include @startuml/@enduml boundaries; Mermaid must start with a known diagram declaration. Clearly invalid or empty sources are rejected without creating a file.

Args:

  • relative_path (string): Path for the new file, relative to the diagrams root, with a recognized extension

  • content (string): Full diagram source text

Returns: JSON with schema: { "relative_path": string, "created": true }

Examples:

  • Use when: "Create a class diagram for the User model" -> relative_path="models/user-class.puml", content="@startuml\nclass User {\n +id: int\n}\n@enduml"

  • Don't use when: The file already exists and you want to change it (use diagrams_update instead)

Error Handling:

  • Returns "Error: ... already exists" if a file already exists at relative_path

  • Returns "Error: ... does not have a recognized diagram extension" if the extension isn't one of .puml/.plantuml/.mmd/.mermaid

  • Returns "Error: Invalid PlantUML diagram (basic check): ..." if PlantUML source is empty or missing @startuml/@enduml boundaries

  • Returns "Error: Invalid Mermaid diagram (basic check): ..." if Mermaid source is empty or has no recognized diagram declaration

  • Returns "Error: Refused to access path outside the diagrams root" if relative_path attempts to escape the diagrams directory

  • Unexpected internal failures return a generic "Error: Unexpected internal error ..." with isError:true and are logged to stderr without source, paths, or secrets

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesFull PlantUML or Mermaid source text for the diagram.
relative_pathYesPath for the new diagram, relative to the diagrams root, including extension (.puml, .plantuml, .mmd, or .mermaid). E.g. 'system/order-flow.puml'.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only indicate non-readOnly, non-idempotent, non-destructive behavior. The description goes far beyond this by disclosing that it refuses to overwrite, creates intermediate directories automatically, performs a basic non-validating syntax check, rejects invalid/empty sources without creating files, prevents path escape, and logs unexpected errors safely without leaking secrets.

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?

The description is well structured: purpose first, then extension rules, overwrite policy, validation behavior, arg definitions, return shape, examples, and error handling. It is long but every section earns its place and the most decision-relevant information is front-loaded.

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 output schema, the description fully compensates by specifying the exact return JSON structure, listing all expected error messages, and providing concrete usage examples. An agent has everything needed to invoke it correctly and anticipate failure modes.

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?

The input schema already describes both parameters fully (100% coverage). The description adds value by clarifying the extension-to-type mapping, the meaning of a recognized extension, automatic creation of intermediate directories, and the syntax-check behavior, which give the agent practical context for constructing valid parameter values.

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?

The description states a specific verb ('Create'), a specific resource ('PlantUML or Mermaid diagram file under the diagrams root'), and the inference rule from the file extension. It clearly distinguishes this tool from diagrams_update by explicitly saying it refuses to overwrite existing files.

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?

The description gives explicit usage context: use for creating new diagrams, and explicitly says not to use it when the file exists and needs changing, naming diagrams_update as the alternative. The included examples of when and when not to use it make the decision easy for an agent.

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

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/mohammad-emad-dev/diagrams-mcp-server'

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