New Your team’s decisions, in one playbook every coding agent works from. Never answer your agent twice

editDocument

Edit a document: the PREFERRED tool for small targeted changes. Two patch dialects — do NOT mix them in one call. (1) ANCHOR patches {oldText, newText, before?, after?} — RECOMMENDED: replace an exact snippet of existing text with new text. oldText must match the document byte-for-byte AND be uni...

SERVERStable Baseline SOURCEhttps://api.stablebaseline.io/functions/v1/cloud-serve/mcp
Medium RISK CLASS
Category Write
Parameters 101 required
Recommended Rate-limitedsee the rule below
Registry record Grade F, identity unverified Pull the record →

This record as markdown: /tools/io-stablebaseline-sb/editdocument.md

What editDocument does on Stable Baseline

AI agents use editDocument 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.

ParameterTypeRequiredDescription
title string — New title.
dryRun boolean — If true, apply the patches and RETURN the resulting document text without saving — no version bump, no lock required. Use to preview/verify a patch before commi
patches array — Patches to apply. Use EITHER anchor patches OR line patches, not both in the same call. May be empty if only updating title, folderId, or position.
folderId string | null — MOVE the document into this folder (null moves it to the project root). Send it with patches:[] to file the document without touching its content — a folder-onl
position number — Sort position within the parent folder. Use to reposition a single document; like folderId, a position-only change creates no version. For batch sibling reorder
projectId string — Optional. Narrows a friendly-id lookup to one project. Only needed when a friendly id is ambiguous — TAS-/IMP-/PLN- ids are numbered per PROJECT, so the same id
documentId string Yes
changeSummary string — Version history summary.
expectedVersion number — Legacy integer version guard, checked in addition to versionTimestamp. Prefer versionTimestamp — this exists for older clients and is optional.
versionTimestamp number — Optimistic-lock token from getDocument() or any mutating tool's response. Required unless dryRun:true. (Alias accepted: documentVersionTimestamp.)

Parameters from the server's own tool schema.

Why editDocument is rated Medium

An AI agent can call editDocument 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)

Questions about editDocument

What does the editDocument tool do? +

Edit a document: the PREFERRED tool for small targeted changes. Two patch dialects — do NOT mix them in one call. (1) ANCHOR patches {oldText, newText, before?, after?} — RECOMMENDED: replace an exact snippet of existing text with new text. oldText must match the document byte-for-byte AND be unique; if it occurs more than once, either expand oldText until it is unique, or add before/after (the EXACT text immediately before/after the match) to disambiguate. A no-match returns nearby context; an ambiguous match returns the occurrence count. Anchors do NOT drift, so you don't need fresh line numbers and they survive concurrent edits. Use newText:"" to delete. (2) LINE patches {startLine, endLine, replacement} — 1-based and INCLUSIVE: call getDocument first for line numbers; replace line 5 with {startLine:5,endLine:5}; INSERT before line N (deleting nothing) with {startLine:N,endLine:N-1}; append to an L-line document with {startLine:L+1,endLine:L}. Line numbers are ABSOLUTE and GO STALE after ANY edit — re-call getDocument before further line patches; out-of-range patches are rejected with the current line count. versionTimestamp from getDocument (or from any mutating tool's response — they all return the fresh token) is required for optimistic locking, EXCEPT when dryRun:true. If your token is stale, the error tells you who changed the document, when, and the currentVersionTimestamp — anchor patches survive concurrent edits, so retrying with that token is usually safe. Set dryRun:true to apply the patches and get the resulting text back WITHOUT saving (verify before committing — kills retry loops). IMPORTANT: getDocument displays lines as NNNNN<TAB>content; that prefix is display-only — oldText/before/after must contain only the content AFTER the tab. Do not edit or delete DIAGRAM/IMAGE marker lines (rejected with guidance) — use dedicated diagram/image tools. To @-mention a person, insert <!-- REFERENCE: {"type":"user","id":"<user_uuid>","label":"Name"} -->; look up the user_id via listAssignablePrincipals. Mentioned users are notified automatically. 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.

What parameters does editDocument accept? +

editDocument accepts 10 parameters: title, dryRun, patches, folderId, position, projectId, documentId, changeSummary, expectedVersion, versionTimestamp. Required: documentId. The full parameter table on this page comes from the server's own tool schema.

How do I enforce a policy on editDocument? +

Register the Stable Baseline MCP server in PolicyLayer and add a rule for editDocument: 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.

What risk level is editDocument? +

editDocument is a Write tool with medium risk. Write tools should be rate-limited to prevent accidental bulk modifications.

Can I rate-limit editDocument? +

Yes. Add a rate_limit block to the editDocument 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.

How do I block editDocument completely? +

Set action: deny in the PolicyLayer policy for editDocument. 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.

What MCP server provides editDocument? +

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

Across the catalogue

// THE MCP REGISTRY

PolicyLayer tracks 44,603 MCP servers and 515,000+ tools.

Every server has a live record: who publishes it, whether it answers without auth, its risk grade, every tool classified, the recommended policy. This page is one line of Stable Baseline's. Pull the full record:

Teams ship this data inside their own products. See what a licence covers →

// GET IN TOUCH

Have a question or want to learn more? Send us a message.

Message sent.

We'll get back to you soon.