updateDiagramInDocument
Update a diagram's code, description, or properties. Call getDiagramTypeGuide for DSL syntax. New diagramCode is COMPILE-CHECKED BY RENDERING at write time — broken DSL is rejected with the renderer's error — and a valid change is re-rendered + re-thumbnailed immediately (response diagram.renderS...
This record as markdown: /tools/io-stablebaseline-sb/updatediagramindocument.md
What updateDiagramInDocument does on Stable Baseline
AI agents use updateDiagramInDocument to create or update resources in Stable Baseline, usually the action step of a workflow, after the agent has gathered context. Every call changes real data in your Stable Baseline environment.
| Parameter | Type | Required | Description |
|---|---|---|---|
align | string | — | Alignment. |
prompt | string | — | New short description (metadata only — does NOT change the rendered diagram). |
caption | string | — | New caption. |
colorPlan | object | — | BPMN only. Updated color plan. Set to null to remove. |
diagramId | string | Yes | Diagram ID from DIAGRAM_OMITTED markers. |
diagramCode | string | — | New diagram DSL source code. REQUIRED to change what the diagram visually renders. Call getDiagramTypeGuide for syntax. Must provide the COMPLETE updated DSL, n |
nlDescription | string | — | New extended description (metadata only — does NOT change the rendered diagram). |
diagramVersionTimestamp | number | — | Diagram-level optimistic lock: versionTimestamp of THIS diagram (from getDiagramInDocument, getDocument with includeDiagramDsl:true, or a previous write's respo |
documentVersionTimestamp | number | — | Document-level optimistic lock: versionTimestamp from getDocument(). Locks the whole document. Provide this OR diagramVersionTimestamp (at least one is required |
Parameters from the server's own tool schema.
Why updateDiagramInDocument is rated Medium
An AI agent can call updateDiagramInDocument faster than any human can review: one bad instruction and it creates or modifies resources in Stable Baseline by the hundred, each call as confident as the last.
Risk signalsHigh parameter count (10 properties)
Attacks that exploit this kind of access
The rule that runs updateDiagramInDocument safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Stable Baseline, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For updateDiagramInDocument, this is the rule to start with:
updateDiagramInDocument stays usable, but capped: an agent stuck in a loop can't make hundreds of changes a minute. Everything else on the server is denied unless you say otherwise.
The button opens the PolicyLayer dashboard: create your workspace, connect Stable Baseline, apply this rule, and every updateDiagramInDocument call is checked against it from then on.
Questions about updateDiagramInDocument
Update a diagram's code, description, or properties. Call getDiagramTypeGuide for DSL syntax. New diagramCode is COMPILE-CHECKED BY RENDERING at write time — broken DSL is rejected with the renderer's error — and a valid change is re-rendered + re-thumbnailed immediately (response diagram.renderStatus tells you the outcome). Provide a version lock: diagramVersionTimestamp (from getDiagramInDocument, getDocument with includeDiagramDsl:true, or any diagram write's response — PREFERRED: locks just this diagram, so concurrent edits elsewhere in the document don't conflict; bare versionTimestamp is accepted as an alias) OR documentVersionTimestamp (locks the whole document). The response returns BOTH fresh tokens for chaining. Documents carrying a legacy marker (no embedded diagramId) are upgraded automatically on update. IMPORTANT: to change what the diagram visually shows you MUST provide diagramCode with the full updated DSL source — prompt/nlDescription are metadata only. After updating, view it with getDiagramImage and keep prompt/nlDescription in step with what the diagram now shows. It is categorised as a Write tool in the Stable Baseline MCP Server, which means it can create or modify data. Consider rate limits to prevent runaway writes.
updateDiagramInDocument accepts 9 parameters: align, prompt, caption, colorPlan, diagramId, diagramCode, nlDescription, diagramVersionTimestamp, documentVersionTimestamp. Required: diagramId. The full parameter table on this page comes from the server's own tool schema.
Register the Stable Baseline MCP server in PolicyLayer and add a rule for updateDiagramInDocument: allow, deny, rate-limit, or require approval. Point your MCP client at the PolicyLayer proxy URL and the rule is enforced on every call, before it reaches Stable Baseline. Nothing to install.
updateDiagramInDocument is a Write tool with medium risk. Write tools should be rate-limited to prevent accidental bulk modifications.
Yes. Add a rate_limit block to the updateDiagramInDocument rule in your PolicyLayer policy. For example, setting max: 10 and window: 60 limits the tool to 10 calls per minute. Rate limits are tracked per agent session and reset automatically.
Set action: deny in the PolicyLayer policy for updateDiagramInDocument. The AI agent will receive a policy violation error and cannot call the tool. You can also include a reason field to explain why the tool is blocked.
updateDiagramInDocument is provided by the Stable Baseline MCP server (https://api.stablebaseline.io/functions/v1/cloud-serve/mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on Stable Baseline, and thousands of servers like it.
This server
Across the catalogue