uses
diagram
Render a Mermaid diagram and OG-card it for Slack
Problem
You ask your agent to diagram the system architecture, the data flow, or the migration plan. You want to paste the URL into Slack and have the diagram appear inline as a rich preview card — not a raw code block.
The MCP call
result = render_diagram(
kind='mermaid',
source="""
graph TD
Browser -->|HTTPS| Caddy
Caddy -->|8108| FastAPI
FastAPI -->|SQLAlchemy| Postgres
FastAPI -->|boto3| R2[(Cloudflare R2)]
""",
title='pail production architecture',
ttl_hours=720, # 30 days — long-lived doc asset
)
print(result['url']) # paste this into Slack
What you get back
A Share URL like https://pail.thalos.ai/aB3x.... When pasted into Slack, the OG image (the rendered diagram SVG) appears as an inline card. Clicking opens the full-page render with a view-source toggle.
Notes
Mermaid diagrams are rendered client-side via mermaid@10. PlantUML and D2 are rendered server-side. All formats include a view-source toggle on the rendered page.