Skip to main content
Glama

generate_mermaid_diagram_stream

Generate a Mermaid diagram as a base64-encoded image streamed directly to the client via SSE transport, with customizable theme, background color, and format.

Instructions

Generate a Mermaid diagram and return it directly as a base64-encoded image.

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

  • MCP client must support SSE transport and binary/base64 image handling

IMPORTANT TRANSPORT REQUIREMENTS:

  • REQUIRES SSE TRANSPORT MODE ONLY

  • Will NOT work with STDIO transport

  • DO NOT use this endpoint if your MCP client doesn't support SSE transport

  • DO NOT use this endpoint if your client can't handle binary/base64 image data

PARAMETER GUIDANCE:

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

  • 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. Defaults to "png" if not specified.

RESPONSE:

  • Returns the diagram as a base64-encoded image in the specified format

  • No file system access or permissions required

  • Image data is streamed directly back to the client

USE CASE: Best suited for scenarios where:

  1. The client is using SSE transport mode

  2. The client can handle base64-encoded image data

  3. No need to persist the image to disk

  4. No file system access is available or desired

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYes
themeNo
backgroundColorNo
formatNo
Behavior4/5

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

With no annotations, the description provides extensive behavioral details: system prerequisites, transport constraints, no file system access, and direct base64 streaming. However, it lacks specifics about error handling or behavior when prerequisites are not met.

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?

The description is well-structured with clear sections and front-loaded purpose. While somewhat verbose, the level of detail is justified given the tool's complexity (streaming, prerequisites, transport). Could be slightly more concise but remains effective.

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?

The description covers system prerequisites, parameter usage, response format, and use cases, which is comprehensive for a tool with 4 parameters and no output schema. It could mention potential errors or limitations, but overall it provides sufficient context for an agent to decide to invoke the tool.

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?

The input schema has 0% description coverage, but the description compensates fully by explaining each parameter's purpose, allowed values for theme, formatting guidance for backgroundColor and format, and default behaviors. This adds significant value beyond the 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 tool's purpose: generate a Mermaid diagram and return it as a base64-encoded image. It distinguishes from the sibling tool 'generate_mermaid_diagram_file' by emphasizing streaming and no 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 Guidelines5/5

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

The description provides explicit when-to-use and when-not-to-use guidance, including system prerequisites, transport requirements (SSE only), and a dedicated 'USE CASE' section. It implicitly contrasts with the sibling tool for file-based persistence.

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