Skip to main content
Glama

Create a diagram from Mermaid, or add one to the board

add_elements_from_mermaid

Creates diagram elements from a Mermaid definition. Creates a new canvas if room_id is omitted, or adds to the existing canvas if room_id is provided. Preferred over add_elements for new diagrams and large changes to existing diagrams whenever the content can be represented in Mermaid. Supports: flowchart, graph, flowchart-elk, sequenceDiagram, classDiagram, classDiagram-v2, stateDiagram, stateDiagram-v2, erDiagram, journey, gantt, pie, gitGraph, mindmap, timeline, C4Context, C4Container, C4Component, C4Dynamic, C4Deployment, sankey, sankey-beta, quadrantChart, xychart, xychart-beta, requirement, requirementDiagram, kanban, architecture, block, block-beta, packet, packet-beta, radar-beta, treemap, info. Example: "flowchart TD\n A[Start] --> B{Decision}\n B -->|Yes| C[OK]\n B -->|No| D[Cancel]"

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": {
      "mermaid": "<mermaid>"
    },
    "name": "add_elements_from_mermaid"
  }
}

Input Schema

NameRequiredDescriptionDefault
configNoOptional Mermaid rendering config. flowchart.curve is handled automatically.
mermaidYesMermaid diagram definition. Prefer converting compatible user requests into Mermaid instead of using add_elements.
room_idNoRoom ID of an existing canvas to add to. If the user is continuing a canvas already referenced in this conversation (by room_id, or a URL like ?room=[room_id] or /?gdrive=[room_id]), pass it here. Omit to create a new canvas.
timeoutNoRoom lifetime in seconds (default: 3600, max: 86400). Only used when creating new canvas

Output Schema

NameRequiredDescriptionDefault
urlYesCanvas room URL
isNewYesWhether a new canvas was created
room_idNoCanvas room ID
appStateYesCanvas app state (viewBackgroundColor, etc.)
elementsYesAll elements currently on the canvas
collabUrlYesCollaboration server URL for Socket.IO
pendingMermaidNoMermaid definition pending client-side rendering

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / room_id / description
      Previous value: -"Room ID of an existing canvas to add to. If the user is continuing a canvas already referenced in this conversation (by room_id, or a URL like ?room=[room_id] or /gdrive?id=[room_id]), pass it here. Omit to create a new canvas."New value: +"Room ID of an existing canvas to add to. If the user is continuing a canvas already referenced in this conversation (by room_id, or a URL like ?room=[room_id] or /?gdrive=[room_id]), pass it here. Omit to create a new canvas."
  2. Changed1 schema field changed
    • changedInput schema / properties / room_id / description
      Previous value: -"Room ID. If not provided, creates a new canvas. Extract from URLs as ?room=[room_id] or /gdrive?id=[room_id]."New value: +"Room ID of an existing canvas to add to. If the user is continuing a canvas already referenced in this conversation (by room_id, or a URL like ?room=[room_id] or /gdrive?id=[room_id]), pass it here. Omit to create a new canvas."
  3. Changed3 schema fields changed
    • addedInput schema / properties / room_id
      Added value: +{
      +  "description": "Room ID. If not provided, creates a new canvas. Extract from URLs as ?room=[room_id] or /gdrive?id=[room_id].",
      +  "type": "string"
      +}
    • removedInput schema / properties / room_url
      Removed value: -{
      -  "description": "Room URL or ID. If not provided, creates a new canvas",
      -  "type": "string"
      -}
    • addedOutput schema / properties / room_id
      Added value: +{
      +  "description": "Canvas room ID",
      +  "type": "string"
      +}
  4. Changed8 schema fields changed
    • addedOutput schema / properties / appState / additionalProperties
      Added value: +true
    • changedOutput schema / properties / appState / description
      Previous value: -"Current app state (viewBackgroundColor, etc.)"New value: +"Canvas app state (viewBackgroundColor, etc.)"
    • addedOutput schema / properties / appState / properties
      Added value: +{
      +  "viewBackgroundColor": {
      +    "type": "string"
      +  }
      +}
    • changedOutput schema / properties / elements / description
      Previous value: -"Current scene elements for inline SVG rendering"New value: +"All elements currently on the canvas"
    • addedOutput schema / properties / elements / items
      Added value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
    • changedOutput schema / properties / pendingMermaid / description
      Previous value: -"Mermaid definition to be rendered client-side"New value: +"Mermaid definition pending client-side rendering"
    • addedOutput schema / properties / pendingMermaid / properties
      Added value: +{
      +  "config": {
      +    "additionalProperties": true,
      +    "type": "object"
      +  },
      +  "definition": {
      +    "description": "Mermaid diagram source",
      +    "type": "string"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "url",
      +  "isNew",
      +  "collabUrl",
      +  "elements",
      +  "appState"
      +]
  5. Changed1 schema field changed
    • changedInput schema / properties / mermaid / description
      Previous value: -"Mermaid diagram definition (flowchart, sequence, or class diagram)"New value: +"Mermaid diagram definition. Prefer converting compatible user requests into Mermaid instead of using add_elements."
  6. Changed5 schema fields changed
    • changedInput schema / properties / config / description
      Previous value: -"Optional Mermaid configuration"New value: +"Optional Mermaid rendering config. flowchart.curve is handled automatically."
    • changedInput schema / properties / config / properties / flowchart / properties / curve / description
      Previous value: -"Curve style for flowchart edges (default: linear)"New value: +"Edge curve style (handled server-side; no need to set explicitly)."
    • changedInput schema / properties / config / properties / flowchart / properties / curve / enum
      Previous value: -[
      -  "linear",
      -  "basis"
      -]New value: +[
      +  "basis",
      +  "linear"
      +]
    • removedInput schema / properties / config / properties / maxEdges
      Removed value: -{
      -  "description": "Maximum number of edges to render (default: 1000)",
      -  "type": "number"
      -}
    • removedInput schema / properties / config / properties / maxTextSize
      Removed value: -{
      -  "description": "Maximum text size (default: 1000)",
      -  "type": "number"
      -}
  7. Changed4 schema fields changed
    • addedOutput schema / properties / appState
      Added value: +{
      +  "description": "Current app state (viewBackgroundColor, etc.)",
      +  "type": "object"
      +}
    • addedOutput schema / properties / collabUrl
      Added value: +{
      +  "description": "Collaboration server URL for Socket.IO",
      +  "type": "string"
      +}
    • addedOutput schema / properties / elements
      Added value: +{
      +  "description": "Current scene elements for inline SVG rendering",
      +  "type": "array"
      +}
    • addedOutput schema / properties / pendingMermaid
      Added value: +{
      +  "description": "Mermaid definition to be rendered client-side",
      +  "type": "object"
      +}
  8. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare a non-destructive, non-open-world write, so the description does not need to restate safety. It still adds real behavior: the creation-vs-append fork, and an enumerated list of supported Mermaid dialects, which tells the agent which inputs will succeed and which it must reject or convert. It does not say what happens on an unsupported diagram type or whether the call is atomic, which keeps it below 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The front-loaded purpose and preference sentences are excellent and earn their place, and the inline example is useful. The 35-item enumeration of diagram types and betas is a bulky wall of text that could be compressed to "most Mermaid diagram types; all *-beta variants supported" without losing decision-relevant information.

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 output schema exists, so return-value explanation is unnecessary, and the annotations cover safety. The description covers both operating modes, the sibling trade-off, and the input dialect surface — enough for correct invocation. The only omission is failure behavior for unsupported syntax or oversized diagrams.

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

Parameters3/5

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

Schema coverage is 100% and each parameter already carries its own description, including the room_id URL heuristics and the timeout default/max. The description's room_id sentence restates the schema rather than adding format or validation detail, so the baseline 3 applies.

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?

Opens with a precise verb and resource ("Creates diagram elements from a Mermaid definition") and immediately splits the two modes of operation (new canvas vs. append to existing). It names the closest sibling, add_elements, so an agent can separate the two without opening either schema.

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?

Explicitly states the selection rule against the alternative: preferred over add_elements for new diagrams and large changes whenever the content can be represented in Mermaid. It also gives the condition for room_id (omit to create new, pass to append), including the URL forms that indicate an existing canvas.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources