# 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.

Agent View of the PolicyLayer registry record for `updateDiagramInDocument`. HTML page: https://policylayer.com/tools/io-stablebaseline-sb/updatediagramindocument

## Facts

- Tool: `updateDiagramInDocument`
- Server: Stable Baseline (`https://api.stablebaseline.io/functions/v1/cloud-serve/mcp`) — https://policylayer.com/tools/io-stablebaseline-sb.md
- Homepage: https://github.com/stablebaseline/mcp
- Risk category: Write (Medium risk)
- Registry record: grade F, identity unverified
- Server auth posture: open
- Server CORS policy: https://app.stablebaseline.io
- Server rate-limited: no
- Parameters: 9 (1 required)
- Recommended policy verdict: Rate-limited

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `align` | string | no | Alignment. |
| `prompt` | string | no | New short description (metadata only — does NOT change the rendered diagram). |
| `caption` | string | no | New caption. |
| `colorPlan` | object | no | BPMN only. Updated color plan. Set to null to remove. |
| `diagramId` | string | yes | Diagram ID from DIAGRAM_OMITTED markers. |
| `diagramCode` | string | no | 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 | no | New extended description (metadata only — does NOT change the rendered diagram). |
| `diagramVersionTimestamp` | number | no | Diagram-level optimistic lock: versionTimestamp of THIS diagram (from getDiagramInDocument, getDocument with includeDiagramDsl:true, or a previous write's respo |
| `documentVersionTimestamp` | number | no | 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.

## Example call (MCP tools/call, JSON-RPC 2.0)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "updateDiagramInDocument",
    "arguments": {
      "diagramId": "<diagramId>"
    }
  }
}
```

## 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 signals: High parameter count (10 properties)

## Use case

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.

## Recommended policy (PolicyLayer)

Verdict: **Rate-limited**. Enforced by the PolicyLayer MCP gateway (https://policylayer.com/mcp-gateway) before a call reaches Stable Baseline:

```json
{
  "version": "1",
  "default": "deny",
  "tools": {
    "updateDiagramInDocument": {
      "limits": [
        {
          "counter": "updatediagramindocument_rate",
          "window": "minute",
          "max": 30,
          "scope": "grant"
        }
      ]
    }
  }
}
```

## Other tools on Stable Baseline (195)

- `cancelAllKgInScope` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/cancelallkginscope.md
- `cancelKgBuildBatch` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/cancelkgbuildbatch.md
- `deleteDiagramInDocument` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deletediagramindocument.md
- `deleteDocument` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deletedocument.md
- `deleteFolder` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deletefolder.md
- `deleteImageInDocument` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deleteimageindocument.md
- `deleteImprovement` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deleteimprovement.md
- `deleteImprovementCategory` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deleteimprovementcategory.md
- `deleteImprovementComment` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deleteimprovementcomment.md
- `deletePlan` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deleteplan.md
- `deletePlanComment` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deleteplancomment.md
- `deletePlanPhase` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deleteplanphase.md
- `deleteResourcePermission` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deleteresourcepermission.md
- `deleteTaskDependency` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deletetaskdependency.md
- `deleteTeam` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deleteteam.md
- `deleteVegaDataFile` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deletevegadatafile.md
- `deleteWhiteboard` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/deletewhiteboard.md
- `removeMember` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/removemember.md
- `removeTeamMember` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/removeteammember.md
- `removeWorkspaceMember` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/removeworkspacemember.md
- `resetDocumentInBrain` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/resetdocumentinbrain.md
- `revokeTeamWorkspaceAccess` — Destructive — https://policylayer.com/tools/io-stablebaseline-sb/revoketeamworkspaceaccess.md
- `autoDesignWhiteboard` — Execute — https://policylayer.com/tools/io-stablebaseline-sb/autodesignwhiteboard.md
- `renderDiagram` — Execute — https://policylayer.com/tools/io-stablebaseline-sb/renderdiagram.md
- `startMeetingScribe` — Execute — https://policylayer.com/tools/io-stablebaseline-sb/startmeetingscribe.md
- `stopMeetingScribe` — Execute — https://policylayer.com/tools/io-stablebaseline-sb/stopmeetingscribe.md
- `triggerKgRebuild` — Execute — https://policylayer.com/tools/io-stablebaseline-sb/triggerkgrebuild.md
- `applySubscriptionChange` — Financial — https://policylayer.com/tools/io-stablebaseline-sb/applysubscriptionchange.md
- `cancelSubscription` — Financial — https://policylayer.com/tools/io-stablebaseline-sb/cancelsubscription.md
- `getCustomerPortalLink` — Financial — https://policylayer.com/tools/io-stablebaseline-sb/getcustomerportallink.md
- …and 165 more: https://policylayer.com/tools/io-stablebaseline-sb.md

## For agents

This record is a snapshot. Live verdicts and the full registry:

- Check every server in your MCP config at once: `npx -y policylayer stack`
- Vet a server before you add it: install the mcp-precheck skill — `npx skills add https://policylayer.com` (skill text: https://policylayer.com/skill.md)
- Query the registry over MCP: endpoint `https://api.policylayer.com/mcp` — tools `check_mcp_server`, `check_mcp_stack`, `check_tool`, `search_registry`, `get_change_events`

---

Source: the PolicyLayer MCP registry — one continuously verified record per MCP server. Full record: https://policylayer.com/registry?q=io-stablebaseline-sb · API: https://policylayer.com/registry/api · Policy library: https://policylayer.com/policies/io-stablebaseline-sb
