Document Versions
Append new content to a document and list its saved versions
Overview
A document's body is a series of saved versions. Each new version replaces the whole body, and earlier versions stay in the history. Metadata changes such as title, status, and assignee go through update-document instead.
| Tool | Scope | Purpose |
|---|---|---|
create-document-version | write | Append a new version, optionally creating inline images in the same call |
list-document-versions | read | List a document's saved versions, newest first |
To read a version's body, use get-document with includeContent for the latest version, or get-document-content with version for an exact, chunked read of any version.
Both tools accept a document UUID or slug (PRD-7, PLN-12, ISS-42) as documentId. A failed call returns an MCP result with isError: true and a text block carrying the error's title, description, and any remediation steps.
create-document-version does not detect versions written since you last read the document. Call list-document-versions first and compare the latest version with the one you read, so you do not bury another author's edit.
Create Document Version
Tool: create-document-version
Scope: write
Underlying API: POST /documents/{documentId}/versions
| Name | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Document UUID or slug (e.g. PRD-7, PLN-12, ISS-42). |
content | string | Yes | The full body of the new version. |
inlineImages | array | No | Up to 5 images to create in the same call. |
Each inlineImages entry:
| Field | Type | Required | Description |
|---|---|---|---|
placeholder | string | Yes | 1–200 characters. The exact marker text in content to replace. |
filename | string | Yes | 1–255 characters. |
mimeType | string | Yes | image/jpeg, image/png, image/gif, or image/webp. |
dataBase64 | string | Yes | Raw base64 image bytes with no data: prefix. 1–699052 characters (512 KiB of image data). |
altText | string | No | Up to 500 characters of Markdown alt text. |
Each placeholder must be unique, must appear in content, and must not overlap another placeholder. The server rewrites it to . The API also refuses a version whose content, once the references are expanded, would exceed 1,048,576 characters. The MCP server refuses any request body over 1 MiB, so several large images may not fit in one call. To add an image without writing a new version, use create-inline-image-attachment.
Returns the updated document as both a JSON text block and structuredContent. Fields the API does not return are omitted.
{
"id": "3f8a…",
"slug": "PLN-12",
"title": "Checkout webhook retries",
"type": "IMPLEMENTATION_PLAN",
"status": "DRAFT",
"priority": null,
"latestVersion": 5,
"updatedAt": "2026-10-03T08:30:00.000Z",
"webUrl": "https://app.closedloop.ai/acme/documents/PLN-12",
"versionContent": "## Plan\n…",
"version": {
"id": "c1d2…",
"documentId": "3f8a…",
"version": 5,
"content": "## Plan\n…",
"createdById": "71d0…",
"createdAt": "2026-10-03T08:30:00.000Z"
},
"inlineImages": [
{
"placeholder": "{{diagram}}",
"attachmentId": "a1b2…",
"attachmentRef": "attachment://a1b2…",
"markdownImage": "",
"attachment": {
"id": "a1b2…",
"artifactId": "3f8a…",
"filename": "flow.png",
"mimeType": "image/png",
"sizeBytes": 48211,
"purpose": "inline",
"createdAt": "2026-10-03T08:30:00.000Z",
"createdById": "71d0…"
}
}
]
}- The document fields the tool passes through include
organizationId,projectId,fileName,createdById,createdBy,assigneeId,assignee,approverId,approver,repositorySnapshot,templateForType,sortOrder,createdAt,project,generationStatus,customFields,tags, andlatestVersionContent, each when the API returns it. priority: nullmeans the document has no priority. The key is absent only when the API sent no priority at all.versionContentis the API'sversionContent, falling back tolatestVersionContent.inlineImagesappears only when images were created. An attachment'spreviewUrlis included when the API returns one.- When the API returns an operation receipt, the response also carries an
operationReceiptobject.
Errors: the API refuses placeholders that are missing from content, duplicated, or overlapping, and expanded content over the limit. A document that does not resolve in your organization returns the API's not-found error.
create-document-version(documentId: "PLN-12", content: "## Plan\n\n1. Add retry with backoff\n2. …")List Document Versions
Tool: list-document-versions
Scope: read
Underlying API: GET /documents/{documentId}/versions
Lists a document's saved versions, newest first.
| Name | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Document UUID or slug (e.g. PRD-7, PLN-12, FEA-42). |
limit | integer | No | 1–100. Default 25. |
offset | integer | No | Minimum 0. Default 0. |
The API returns every version, and the tool pages the result itself.
Returns a pagination envelope:
{
"total": 5,
"offset": 0,
"limit": 25,
"returned": 5,
"hasMore": false,
"nextOffset": null,
"items": [
{
"id": "c1d2…",
"version": 5,
"createdAt": "2026-10-03T08:30:00.000Z",
"createdById": "71d0…",
"contentLength": null
}
]
}The versions list the API returns carries no content, so contentLength is null. Read a version's body with get-document-content.
Errors: a document that does not resolve in your organization returns the API's not-found error.
list-document-versions(documentId: "PLN-12", limit: 5)