superdoc_mutations
All steps succeed or all fail; no partial application. Execute multiple operations atomically in one batch. Use this for any workflow needing 2+ changes. Supported step types: text (text.rewrite, text.insert, text.delete), format (format.apply), create (create.heading, create.paragraph, create.ta...
This record as markdown: /tools/superdoc-mcp/superdoc-mutations.md
What superdoc_mutations does on Superdoc
AI agents call superdoc_mutations to permanently remove resources in Superdoc, typically in cleanup and lifecycle workflows. It does its job in a single call, and there is no undo.
| Parameter | Type | Required | Description |
|---|---|---|---|
in | object | — | Story scope. Defaults to document body when omitted. Use {kind:'story', storyType:'body'} for body, or other storyType values for headers, footers, footnotes, e |
force | boolean | — | Bypass confirmation checks. Only for action 'apply'. Omit for other actions. |
steps | array | Yes | Ordered array of mutation steps. Each step needs 'op' (text.rewrite, text.insert, text.delete, format.apply, or assert) and a 'where' targeting clause. |
action | string | Yes | The action to perform. One of: apply, preview. |
atomic | boolean | Yes | Must be true. All steps execute as one atomic transaction. |
detail | object | — | Only for action 'preview'. Omit for other actions. |
changeMode | string | Yes | Required. Use 'direct' for immediate edits or 'tracked' for suggestions. Must always be provided. |
session_id | string | Yes | Session ID from superdoc_open. |
expectedRevision | string | — | Document revision for optimistic concurrency. Mutation fails if document was modified since this revision. Only for action 'preview'. Omit for other actions. |
Parameters from the server's own tool schema.
Why superdoc_mutations is rated Critical
An AI agent that decides to call superdoc_mutations doesn't hesitate, doesn't double-check, and doesn't stop at one. Whatever it removes from Superdoc is gone. There is no undo for destructive operations.
Risk signalsHigh parameter count (11 properties)
Attacks that exploit this kind of access
The rule that runs superdoc_mutations safely
PolicyLayer is an MCP gateway: it sits between your AI agents and Superdoc, and checks every tool call against a rule you set before the call runs. Nothing changes on the server itself. For superdoc_mutations, this is the rule to start with:
superdoc_mutations is removed from the agent's tool list entirely, so the agent never calls it. The rest of the server keeps working.
The button opens the PolicyLayer dashboard: create your workspace, connect Superdoc, apply this rule, and every superdoc_mutations call is checked against it from then on.
Questions about superdoc_mutations
All steps succeed or all fail; no partial application. Execute multiple operations atomically in one batch. Use this for any workflow needing 2+ changes. Supported step types: text (text.rewrite, text.insert, text.delete), format (format.apply), create (create.heading, create.paragraph, create.table), assert. Each step has an id, an op, a "where" clause for targeting ({by:"select", select:{...}, require:"first"|"exactlyOne"|"all"} or {by:"ref", ref:"..."} or {by:"block", nodeType:"paragraph", nodeId:"..."}), and "args" with operation-specific parameters. Use {by:"block", nodeType, nodeId} when you want to rewrite, delete, format, or anchor against a whole known block from superdoc_get_content action "blocks" without relying on text matching. For full-paragraph or full-clause rewrites, first call superdoc_get_content with action:"blocks" and includeText:true, then rewrite the matching block by nodeId. For a placeholder or name within a tab-separated paragraph, use a text.rewrite where.by:"select" targeting only the exact placeholder; a whole-block plain-text rewrite omitting tabs deletes those controls. Use {by:"select"} only for substring edits, discovery, or insertion relative to a sentence fragment; do NOT use a shortened text selector to replace an entire known block. For create steps, "where" targets an existing anchor block and args.position ("before" or "after") controls placement. Sequential creates targeting the same anchor maintain correct order via internal position mapping. For format.apply with require "all", use a node selector to format every heading or paragraph at once: {by:"select", select:{type:"node", nodeType:"heading"}, require:"all"}. Selectors resolve at compile time (before execution). This means format.apply steps CANNOT target content created by earlier create steps in the same batch. Split creates and formatting into separate batches: first a mutations call with creates, then a mutations call with format.apply. Action "preview" dry-runs the plan. Action "apply" executes it. If a selector matches nothing, the failure reports the step id plus selector details so you can retry with a shorter or more distinctive anchor. Do NOT create two steps that target overlapping text in the same block; combine them into a single text.rewrite step. EXAMPLES: 1. {"action":"apply","atomic":true,"changeMode":"direct","steps":[{"id":"s1","op":"text.rewrite","where":{"by":"select","select":{"type":"text","pattern":"old term"},"require":"all"},"args":{"replacement":{"text":"new term"}}},{"id":"s2","op":"text.delete","where":{"by":"select","select":{"type":"text","pattern":" (deprecated)"},"require":"all"},"args":{}}]} 2. {"action":"apply","steps":[{"id":"r1","op":"text.rewrite","where":{"by":"block","nodeType":"paragraph","nodeId":"<nodeId>"},"args":{"replacement":{"text":"Updated clause text."}}},{"id":"f1","op":"format.apply","where":{"by":"select","select":{"type":"node","nodeType":"heading"},"require":"all"},"args":{"inline":{"color":"#FF0000"}}},{"id":"f2","op":"format.apply","where":{"by":"select","select":{"type":"text","pattern":"Confidential Information"},"require":"all"},"args":{"inline":{"bold":true}}}]}. It is categorised as a Destructive tool in the Superdoc MCP Server, which means it can permanently delete or destroy data. Block by default and require explicit approval.
superdoc_mutations accepts 9 parameters: in, force, steps, action, atomic, detail, changeMode, session_id, expectedRevision. Required: steps, action, atomic, changeMode, session_id. The full parameter table on this page comes from the server's own tool schema.
Register the Superdoc MCP server in PolicyLayer and add a rule for superdoc_mutations: 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 Superdoc. Nothing to install.
superdoc_mutations is a Destructive tool with critical risk. Critical-risk tools should be blocked by default and only enabled with explicit human approval.
Yes. Add a rate_limit block to the superdoc_mutations 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 superdoc_mutations. 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.
superdoc_mutations is provided by the Superdoc MCP server (@superdoc/mcp). PolicyLayer sits as a proxy in front of this server to enforce policies before tool calls reach the server.
More on Superdoc, and thousands of servers like it.
Across the catalogue