Skip to main content
Glama

add_diagram

Insert Mermaid diagrams into Slidev slides by appending, inserting at a position, or replacing a slide; preview changes with dry_run before writing.

Instructions

Add a Mermaid diagram to a Slidev presentation slide. Supports all Mermaid diagram types including flowcharts, sequence diagrams, class diagrams, ER diagrams, Gantt charts, pie charts, git graphs, mind maps, timelines, and more. The diagram is wrapped in a ```mermaid code block as required by Slidev. Can append a new slide, insert at a position, or replace an existing slide. Set dry_run=true to preview the slides.md diff without writing. Reference: https://mermaid.js.org/intro/syntax-reference.html

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "diagram_type": "<diagram_type>",
      "definition": "<definition>"
    },
    "name": "add_diagram"
  }
}

Input Schema

NameRequiredDescriptionDefault
indexNoIf provided (and slide_number is not set), INSERTS the new diagram slide at this 1-based position. If both index and slide_number are omitted, appends at the end.
titleNoOptional slide heading (rendered as # heading above the diagram). Leave empty to show only the diagram with no title.
layoutNoSlidev layout to apply to this slide (e.g. 'center', 'default', 'full'). Defaults to 'default' if omitted.
captionNoOptional caption displayed below the diagram. Useful for citing sources or adding brief notes.
dry_runNoPreview the change without writing slides.md. Returns dryRun, wouldWrite, and diff.
definitionYesThe Mermaid diagram definition. Do NOT include the opening diagram type keyword if it is already captured by diagram_type — instead provide only the diagram body. However, for diagram types like 'flowchart', 'graph', 'sequenceDiagram', etc. that require a direction or keyword as the first line (e.g. 'flowchart TD' or 'sequenceDiagram'), include the full definition starting from that keyword. IMPORTANT: The tool wraps your definition in ```mermaid ... ``` automatically. Do NOT add the code fence yourself. Example for flowchart: flowchart TD A[Start] --> B{Decision} B -->|Yes| C[Result] Example for sequenceDiagram: sequenceDiagram Alice->>Bob: Hello Bob-->>Alice: Hi!
diagram_typeYesMermaid diagram type. Supported types: flowchart/graph — Directed flowcharts and graphs sequenceDiagram — Sequence/interaction diagrams classDiagram — UML class diagrams stateDiagram-v2 — State machine diagrams erDiagram — Entity-relationship diagrams gantt — Project/schedule Gantt charts pie — Pie/donut charts journey — User journey maps gitGraph — Git branching history mindmap — Mind maps timeline — Timeline diagrams quadrantChart — 2x2 quadrant analysis xychart-beta — Bar/line XY charts block-beta — Block/box diagrams packet-beta — Network packet structure architecture-beta — Cloud/system architecture requirementDiagram — Requirements traceability c4Context — C4 architecture context sankey-beta — Sankey flow/energy diagrams zenuml — ZenUML sequence diagrams Reference: https://mermaid.js.org/intro/syntax-reference.html
slide_numberNoIf provided, REPLACES the existing slide at this 1-based position with the diagram slide. If omitted, a new slide is APPENDED at the end of the presentation.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.1.0

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations, the description carries the full burden and does disclose meaningful behavior: the tool auto-wraps the definition in a mermaid code fence, and slide_number REPLACES an existing slide, which is a destructive side effect worth knowing. It omits permissions, what happens when the presentation has not been initialized, and error behavior for invalid Mermaid syntax, so the safety profile is only partial.

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?

Front-loaded with the core action and mode behavior, and the dry_run preview is called out explicitly. The enumeration of supported diagram types (flowcharts, sequence diagrams, class diagrams, ER, Gantt, pie, git graphs, mind maps, timelines, 'and more') duplicates the diagram_type enum and is the one clearly redundant passage.

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?

An 8-parameter mutation tool with full schema coverage and no output schema, so the description needs to cover write modes and fencing behavior — both are present, plus a syntax reference URL. The remaining gap is operational context: no mention of prerequisites such as an existing slides.md or what the write result looks like.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 8 parameters, making 3 the baseline. The description adds genuinely useful meaning beyond it: the definition body must not include the code fence, and diagram types requiring a leading keyword (flowchart TD, sequenceDiagram) must include it — a common failure mode the schema only hints at.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Add a Mermaid diagram to a Slidev presentation slide') plus the three write modes (append, insert, replace) and the automatic ```mermaid fencing. It does not name a sibling such as add_slide or update_slide to say when a plain content slide should be used instead, so it falls short of the 5 bar for sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

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

Gives clear mode selection: dry_run=true previews the slides.md diff without writing, and the schema-backed index/slide_number semantics distinguish append vs insert vs replace. It never states the inverse case — when a non-diagram slide tool should be used or whether this requires an initialized presentation — so exclusions are missing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.