Skip to content
Connect an agent

Single tools

embed_diagram

Write a snippet that shows a Plotwork picture in a web page or a React app with the viewer @plotwork.official/viewer (pan, zoom, trace). It is a single tool of the MCP server and the HTTP API, with the title "Embed diagram".

TL;DR

QuestionAnswer
What is it?A single tool: it does one thing.
What does it do?Write a snippet that shows a Plotwork picture in a web page or a React app with the viewer @plotwork.official/viewer (pan, zoom, trace).
How do I call it over HTTP?POST /v1/diagrams/embed
Does it change anything?No. It is read-only and idempotent, and it talks to nothing outside itself. It saves no file and returns its answer as data.
Which bounds apply?None beyond the limits of each argument, which are in the schema below.
Where do I read its schema as data?An MCP client gets the name, description, and JSON Schema of every tool from tools/list.

What it does

Write a snippet that shows a Plotwork picture in a web page or a React app with the viewer @plotwork.official/viewer (pan, zoom, trace). Send a hosted url, the svg text of a file the site serves, or both. pin adds the svg fingerprint so only that picture shows; live follows /l/ and /o/ links. A choice that cannot apply is left out and said in notes. Fetches nothing.

Arguments

FieldTypeRequiredDescription
urlstringnoA hosted picture (/d/), stable link (/l/) or organisation embed link (/o/) on cdn.plotwork.dev. Never fetched. at least 1 character; at most 200 characters.
svgstringnoThe text of a Plotwork SVG; needed to pin. at least 1 character; at most 1000000 characters.
pathstringnoWhere the page serves svg from, when there is no url. at least 1 character; at most 500 characters.
format"html" | "react"nohtml for any page, react for React. default "html".
livebooleannoFollow new versions: /l/ and /o/ links only. default false.
pinbooleannoShow only exactly this picture: needs svg. default false.
labelstringnoWhat the diagram shows, for a screen reader. at most 200 characters.

Result

FieldTypeRequiredDescription
okbooleanyesFalse when the url is not a hosted picture or the svg is not an SVG; message and hint say why.
snippetstring | nullyesThe code to paste into the page or component, or null when ok is false.
installstringyesThe command that installs the viewer.
srcstring | nullyesThe address the snippet loads the picture from.
linkKind"picture" | "stable" | "organisation" | nullyespicture (/d/), stable (/l/), organisation (/o/), or null for a file the page serves.
fingerprintstring | nullyessha256- of the svg text, whether or not the snippet pins it; null without svg.
livebooleanyesTrue when the snippet carries live.
pinnedbooleanyesTrue when the snippet carries fingerprint.
notesstring[]yesEach choice left out and why, and what to know about the link.
messagestringyesWhat happened, in one sentence.
hintstring | nullyesWhat to send instead, when ok is false.

Behavior hints

HintValue
readOnlyHinttrue
destructiveHintfalse
idempotentHinttrue
openWorldHintfalse

See also

DocWhy
Tool referenceEvery tool, with the workflows first
POST /v1/diagrams/embedThe same operation over HTTP
Language referenceWhat the diagram source may contain
Writing diagrams with an agentThe loop in practice