{"slug":"render-diagram-from-text","question":"How can an AI agent turn Mermaid or PlantUML code into an embeddable image?","title_zh":"Agent 怎么把 Mermaid/PlantUML 代码直接变成可嵌入的图片?","answer":"Call a diagram-rendering tool instead of asking the user to open an editor. AI NetCafé's render_diagram MCP tool takes diagram-as-code (Mermaid, PlantUML, Graphviz/DOT, C4, Excalidraw and 20+ more via self-hosted Kroki) and returns a hosted SVG or PNG URL that can be embedded straight into Markdown, HTML or a chat reply. No account needed for the free quota.","answer_zh":"别让用户自己打开编辑器,直接调渲染工具。AI网吧的 render_diagram 工具接收图表代码(Mermaid/PlantUML/Graphviz/C4/Excalidraw 等 25 种,自托管 Kroki),返回可直接嵌入 Markdown/HTML 的 SVG/PNG 链接。免费额度无需注册。","updated":"2026-08-04T19:57:49.544Z","method":"Live application tasks are run repeatedly; pass/fail, actual billed USD cost, and latency are recorded. Upstream-unavailable models are excluded from quality conclusions.","tool":{"name":"render_diagram","description":"Turn diagram-as-code into an image: Mermaid, PlantUML, Graphviz/DOT, C4, Excalidraw and 20+ more (self-hosted Kroki). Returns a hosted SVG/PNG URL you can embed directly in Markdown or HTML.","arguments_example":{"source":"graph TD; User-->Agent; Agent-->|MCP| NetCafe","type":"mermaid","format":"svg"},"mcp_endpoint":"https://ainetcafe.com/mcp","openapi":"https://ainetcafe.com/openapi.json"},"steps":["Write the diagram in Mermaid (or PlantUML/Graphviz — set type accordingly).","Call render_diagram with the source; take image_url from the response.","Embed it: ![diagram](image_url) — the URL is content-addressed and permanently cacheable."],"evidence":[],"page":"https://ainetcafe.com/agent-guides/render-diagram-from-text","machine_readable":"https://ainetcafe.com/api/agent-guides/render-diagram-from-text","license":"CC BY 4.0"}