KosmoKrator

rendering

Mermaid CLI for AI Agents

Use the Mermaid CLI from KosmoKrator to call Mermaid tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Mermaid CLI Setup

Mermaid can be configured headlessly with `kosmokrator integrations:configure mermaid`.

Install, configure, and verify
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure mermaid --enable --read allow --write ask --json
kosmokrator integrations:doctor mermaid --json
kosmokrator integrations:status --json

Runtime Requirements

Install these host dependencies before calling Mermaid locally.

NameTypeDescription
mmdc binary Mermaid CLI is required to render diagrams.

Credentials

Authentication type: No credentials none. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

No credentials are required.

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call mermaid.render_mermaid '{"syntax":"example_syntax","title":"example_title","width":1,"theme":"example_theme"}' --json
Provider shortcut
kosmo integrations:mermaid render_mermaid '{"syntax":"example_syntax","title":"example_title","width":1,"theme":"example_theme"}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs mermaid --json
kosmo integrations:docs mermaid.render_mermaid --json
kosmo integrations:schema mermaid.render_mermaid --json
kosmo integrations:search "Mermaid" --json
kosmo integrations:list --json

Automation Contexts

The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.

CLI Functions

Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.

mermaid.render_mermaid

Render a Mermaid diagram to a PNG image. Pass valid Mermaid syntax and get back a markdown image embed. Supported diagram types: flowchart, sequence, class, state, ER, Gantt, pie, quadrant, requirement, git graph, C4, mindmap, timeline, sankey, XY chart, block. Example syntax: ``` graph TD A[Start] --> B{Decision} B -->|Yes| C[Action] B -->|No| D[End] ``` Tips: - Use `graph TD` for top-down flowcharts, `graph LR` for left-to-right - Use `sequenceDiagram` for sequence diagrams - Use `erDiagram` for entity-relationship diagrams - Use `classDiagram` for class diagrams - Use `stateDiagram-v2` for state diagrams - Use `gantt` for Gantt charts - Use `pie` for pie charts - Use `gitgraph` for git graphs - Use `mindmap` for mind maps

Write write
Parameters
syntax, title, width, theme
Generic call
kosmo integrations:call mermaid.render_mermaid '{"syntax":"example_syntax","title":"example_title","width":1,"theme":"example_theme"}' --json
Shortcut
kosmo integrations:mermaid render_mermaid '{"syntax":"example_syntax","title":"example_title","width":1,"theme":"example_theme"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

mermaid.render_mermaid 4 parameters
Schema command
kosmo integrations:schema mermaid.render_mermaid --json
ParameterTypeRequiredDescription
syntax string yes Mermaid diagram syntax. Must be valid Mermaid markup (e.g., starting with graph TD, sequenceDiagram, erDiagram, etc.).
title string no Diagram title used as alt text (default: "Diagram").
width integer no Output width in pixels (default: 1400, range: 100-4000).
theme string no Mermaid theme (default: 'default').

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.