diagram
Render Mermaid, PlantUML, D2, or Graphviz source to a hosted image URL.
When to use
Call diagram when you have diagram source code (Mermaid, PlantUML, D2, or Graphviz dot) and want a clean hosted URL that renders the diagram with a view-source toggle and an OG preview image.
Example user prompts
- Send me a system diagram for this repo.
- Give me a sequence diagram for the data flow from upload to public URL.
- Create a Mermaid diagram of the deploy pipeline and send me the link.
MCP tool signature
render_diagram(
kind: Literal['mermaid', 'plantuml', 'd2', 'dot'],
source: str,
title: str | None = None,
project: str | None = None,
ttl_hours: int | None = None,
access_token: str | None = None,
) -> Share
Example call
result = render_diagram(
kind='mermaid',
source="""
graph TD
A[User] --> B[API]
B --> C[DB]
""",
title='System architecture',
)
print(result['url']) # paste into Slack for a rich OG card
Return value
Returns a Share object identical in shape to upload_content. The rendered page shows the diagram SVG with a view-source toggle. The OG image is the diagram itself, making Slack/iMessage previews show the diagram inline.
Credit cost
1 action per create call.
Recipes
See all recipes for copy-paste patterns
that use diagram and other tools together.