Mermaid — 18 Operations for AI Agents

Mermaid puts diagrams in version control — flowcharts, sequence diagrams, architecture sketches living next to the code they describe. act101 reads diagram definitions as structure, so agents update the picture when they update the system.

This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Mermaid code through the act MCP server. 18 operations available: 0 refactor, 18 query, 0 analysis. Each operation is callable from Claude Code, Cursor, Codex, OpenCode, or any MCP-compatible agent host. Click any operation for a stable anchor link suitable for citation.

18Query

Worked Mermaid examples

act101 reads a Mermaid Gantt chart's section declarations as its top-level structure: each one surfaces in the skeleton as a block, named for the section's label. symbols descends further, reporting each section alongside every task it contains, so a section Test with two tasks produces three entries rather than one. The unit of structure this grammar exposes to act101 varies by diagram type — Gantt charts organize around sections and tasks, where a flowchart organizes around subgraphs — so what surfaces for one Mermaid file depends on which diagram it draws. Each example below is the verbatim output of the command shown, run against the file shown. Query outputs are pretty-printed with the timing block omitted.

Read a Gantt chart's sections without its individual tasks

ait-schedule.mmd is a satellite assembly-integration-and-test schedule with three sections — Integration, Test, and Ship — each holding one or two tasks.

$ act query skeleton ait-schedule.mmd

Before

gantt
    title Satellite AIT Schedule
    dateFormat YYYY-MM-DD

    section Integration
    Bus assembly            :a1, 2026-09-01, 14d
    Payload integration     :a2, after a1, 10d

    section Test
    Thermal vacuum test     :b1, after a2, 12d
    Vibration test           :b2, after b1, 5d

    section Ship
    Pack for launch site     :c1, after b2, 3d

Output

{
    "type": "Skeleton",
    "declarations": [
        {
            "kind": "block",
            "name": "Integration",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 5,
                    "column": 5,
                    "byte_offset": 70
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 5,
                    "column": 24,
                    "byte_offset": 89
                }
            },
            "name_range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 5,
                    "column": 12,
                    "byte_offset": 77
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 5,
                    "column": 24,
                    "byte_offset": 89
                }
            }
        },
        {
            "kind": "block",
            "name": "Test",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 9,
                    "column": 5,
                    "byte_offset": 191
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 9,
                    "column": 17,
                    "byte_offset": 203
                }
            },
            "name_range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 9,
                    "column": 12,
                    "byte_offset": 198
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 9,
                    "column": 17,
                    "byte_offset": 203
                }
            }
        },
        {
            "kind": "block",
            "name": "Ship",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 13,
                    "column": 5,
                    "byte_offset": 303
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 13,
                    "column": 17,
                    "byte_offset": 315
                }
            },
            "name_range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 13,
                    "column": 12,
                    "byte_offset": 310
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 13,
                    "column": 17,
                    "byte_offset": 315
                }
            }
        }
    ]
}

The skeleton reports the three sections Integration, Test, and Ship as block declarations; the five tasks inside them, such as Bus assembly or Thermal vacuum test, don't appear at this level.

List sections and the tasks scheduled inside them

The Integration section schedules Bus assembly and Payload integration; the Test section schedules Thermal vacuum test and Vibration test.

$ act query symbols ait-schedule.mmd

Before

gantt
    title Satellite AIT Schedule
    dateFormat YYYY-MM-DD

    section Integration
    Bus assembly            :a1, 2026-09-01, 14d
    Payload integration     :a2, after a1, 10d

    section Test
    Thermal vacuum test     :b1, after a2, 12d
    Vibration test           :b2, after b1, 5d

    section Ship
    Pack for launch site     :c1, after b2, 3d

Output

{
    "type": "Symbols",
    "symbols": [
        {
            "name": " Integration",
            "kind": "function",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 5,
                    "column": 12,
                    "byte_offset": 77
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 5,
                    "column": 24,
                    "byte_offset": 89
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "Bus assembly",
            "kind": "function",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 6,
                    "column": 5,
                    "byte_offset": 94
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 6,
                    "column": 17,
                    "byte_offset": 106
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "Payload integration",
            "kind": "function",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 7,
                    "column": 5,
                    "byte_offset": 143
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 7,
                    "column": 24,
                    "byte_offset": 162
                }
            },
            "visibility": "unknown"
        },
        {
            "name": " Test",
            "kind": "function",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 9,
                    "column": 12,
                    "byte_offset": 198
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 9,
                    "column": 17,
                    "byte_offset": 203
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "Thermal vacuum test",
            "kind": "function",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 10,
                    "column": 5,
                    "byte_offset": 208
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 10,
                    "column": 24,
                    "byte_offset": 227
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "Vibration test",
            "kind": "function",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 11,
                    "column": 5,
                    "byte_offset": 255
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 11,
                    "column": 19,
                    "byte_offset": 269
                }
            },
            "visibility": "unknown"
        },
        {
            "name": " Ship",
            "kind": "function",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 13,
                    "column": 12,
                    "byte_offset": 310
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 13,
                    "column": 17,
                    "byte_offset": 315
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "Pack for launch site",
            "kind": "function",
            "range": {
                "start": {
                    "file": "ait-schedule.mmd",
                    "line": 14,
                    "column": 5,
                    "byte_offset": 320
                },
                "end": {
                    "file": "ait-schedule.mmd",
                    "line": 14,
                    "column": 25,
                    "byte_offset": 340
                }
            },
            "visibility": "unknown"
        }
    ]
}

symbols lists all eight entries — the three sections plus all five tasks, including Pack for launch site under Ship — in the order they appear in the file.

Query

18 query tools, the same on every supported language. Descriptions live in the shared reference: /docs/query-tools.

callers control_flow data_flow definition diagnostics effect_closure effect_summary fix_auto get_type graph import_organize interface mutations references repo_outline skeleton symbols symbols_batch

← MATLABMLIR →