rendering
Mermaid CLI for Coding Agents
Use the Mermaid CLI for coding agents with headless JSON commands, schema discovery, credentials, and permission controls.
1 functions 0 read 1 write No credentials auth
Mermaid CLI for Coding Agents
Let coding agents discover schemas and execute integration functions through CLI commands or MCP.
Use this pattern when another coding agent needs exact commands and schema discovery. The Mermaid CLI uses the same integration registry as the TUI, Lua runtime, and MCP gateway, but returns predictable command output for automation.
Command Shape
# Mermaid CLI for Coding Agents
kosmokrator integrations:configure mermaid --enable --read allow --write ask --json
kosmo integrations:call mermaid.render_mermaid '{"syntax":"example_syntax","title":"example_title","width":1,"theme":"example_theme"}' --json Discovery Before Execution
Agents and scripts can inspect Mermaid docs and schemas before choosing a function.
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 Useful Mermaid CLI Functions
| Function | Type | Parameters | Description |
|---|---|---|---|
mermaid.render_mermaid | Write | syntax, title, width, theme | 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 |
Automation Notes
- Use
--jsonfor machine-readable output. - Keep credentials out of argv by using environment variables or stored KosmoKrator configuration.
- Configure read/write policy before unattended runs; use
--forceonly for trusted automation. - Use the MCP gateway instead when the agent needs dynamic tool discovery inside a conversation.