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:
Inferred from filename extension (e.g., "diagram.png" -> png).
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:
The client needs to persist the diagram to disk
The client has local file system access
The client needs to reference the image file path in subsequent operations
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| folder | Yes | ||
| name | Yes | ||
| theme | No | ||
| backgroundColor | No | ||
| format | No |