Skip to main content
Glama

generate_mermaid_diagram_file

Generate a Mermaid diagram and save it as a file (PNG, PDF, or SVG) to a local directory. Requires Mermaid CLI and write permissions.

Instructions

Generate a Mermaid diagram and save it to a local file system directory.

SYSTEM PREREQUISITES:

  • Node.js must be installed (v14 or higher)

  • Mermaid CLI must be installed globally: npm install -g @mermaid-js/mermaid-cli

  • The 'mmdc' command must be available in the system PATH

  • Python 3.8 or higher with MCP tools installed

IMPORTANT TRANSPORT & ACCESS REQUIREMENTS:

  • Works with both STDIO and SSE transport modes

  • REQUIRES: The MCP client (e.g., AI assistant) must have access to the local file system where the image is saved

  • The client must have write permissions for the specified folder

PARAMETER GUIDANCE:

  • code: Valid Mermaid diagram syntax (see https://mermaid.js.org/)

  • folder: Absolute or relative path to an existing directory with write permissions

  • name: Filename for the diagram (extension can determine format if format not specified)

  • theme: Theme name for the diagram. MUST be one of: ["default", "neutral", "dark", "forest", "base"]

    • default: Default theme for all diagrams

    • neutral: Great for black and white documents that will be printed

    • dark: Works well with dark-colored elements or dark-mode

    • forest: Contains shades of green

    • base: The only theme that can be modified for customization

  • backgroundColor: Optional hex color code (e.g., '#FFFFFF') or color name (e.g., 'white', 'transparent')

  • format: Output format. Recommended: "png". Also supports "pdf". "svg" is available but not recommended for general use. If not specified:

    1. Inferred from filename extension (e.g., "diagram.png" -> png).

    2. Defaults to "png" if no valid extension or format is provided.

RESPONSE:

  • Returns the absolute path to the generated file

  • The client must be able to access this path to use the generated image

USE CASE: Best suited for scenarios where:

  1. The client needs to persist the diagram to disk

  2. The client has local file system access

  3. The client needs to reference the image file path in subsequent operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
folderYes
nameYes
themeNo
backgroundColorNo
formatNo
Behavior3/5

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

No annotations provided, so description carries full burden. It covers transport modes, prerequisites, and response format. However, it does not disclose behaviors like overwriting files, error handling if folder is missing, or side effects.

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?

Well-structured with clear sections (purpose, prerequisites, parameter guidance, response, use case). Slightly lengthy but each section adds value. Front-loaded with primary purpose.

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?

Given no output schema and 6 parameters, description provides thorough guidance on parameters, prerequisites, and use cases. Lacks error handling details and examples, but is largely complete for typical usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, but description's PARAMETER GUIDANCE section provides detailed explanations for all 6 parameters, including options for theme, format inference, and background color. This adds significant value beyond the bare schema.

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 clearly states the specific verb 'generate' and resource 'Mermaid diagram' and the action of saving to file system. It distinguishes from the sibling tool 'generate_mermaid_diagram_stream' by focusing on file persistence.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a USE CASE section with explicit scenarios (client needs to persist to disk, has local FS access, needs file path). It also includes SYSTEM PREREQUISITES and ACCESS REQUIREMENTS. However, it does not explicitly state when not to use this tool vs the sibling stream tool.

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/codingthefuturewithai/mcp_mermaid_image_gen'

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