Documents
List, read, create, and update PRDs, implementation plans, issues, and organization-level documents
Overview
Documents are the deliverables Closedloop tracks: PRDs (PRD-*), implementation plans (PLN-*), issues (ISS-*; legacy FEA-* slugs still resolve to the same issue), and organization-level documents (DOC-*). Templates exist too, but they are internal blueprints with no user-facing slug.
| Tool | Scope | Purpose |
|---|---|---|
list-documents | read | Page through documents, filtered by project, type, or assignee |
get-document | read | Fetch one document's metadata, optionally with its latest content |
get-document-content | read | Read an exact document-version body in UTF-8 chunks |
create-document | write | Create a PRD, implementation plan, issue, or organization-level document |
update-document | write | Change a document's editable fields |
The server only offers a tool when the session's grant carries the scope in the table. A key without write never sees create-document or update-document. Content edits are a separate operation: see Document versions.
Every document tool that takes a documentId accepts either the document's UUID or its slug (PRD-7, PLN-12, ISS-42, FEA-42). Pass the slug verbatim; the API resolves it inside your organization. A blank value, or . / .., is rejected before any request is sent.
Document types
The type filter and the create-document type field use these values:
| Value | Meaning |
|---|---|
PRD | Product requirements document |
IMPLEMENTATION_PLAN | Implementation plan |
FEATURE | Issue (the stored name) |
ISSUE | Alias for FEATURE; it is normalized to FEATURE before the request is sent |
DOC | Organization-level document |
TEMPLATE | Internal template (filter only; it cannot be created through MCP) |
Errors
A failed call returns an MCP result with isError: true and a single text block. The text carries a title, a description, an optional Remediation: list, and, where available, a Technical details: object limited to the error's code, message, and timestamp. Argument-schema failures (a wrong type, a value out of range) are rejected by the MCP SDK before the tool runs.
List Documents
Tool: list-documents
Scope: read
Underlying API: GET /documents (plus GET /artifact-links/parents for the parent projection)
Returns one page of documents in your organization. The page is bounded by the server: the tool sends limit, offset, and includeTotal=true, and reports the counts the server returns.
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | No | Project UUID or slug (e.g. PRO-7). |
assigneeId | string | No | Assignee user ID. |
type | string | No | One of the document types. ISSUE and FEATURE select the same documents. |
limit | integer | No | 1–100. Default 25. |
offset | integer | No | Minimum 0. Default 0. |
includeParentArtifact | boolean | No | Include each document's parentArtifact projection. Default true. |
Returns a pagination envelope. Advance with nextOffset until hasMore is false.
{
"total": 42,
"offset": 0,
"limit": 25,
"returned": 25,
"hasMore": true,
"nextOffset": 25,
"items": [
{
"id": "3f8a…",
"title": "Checkout redesign",
"slug": "ISS-1035",
"type": "FEATURE",
"status": "IN_PROGRESS",
"projectId": "9b2c…",
"dueDate": null,
"priority": "HIGH",
"sortOrder": 3,
"assigneeId": "71d0…",
"createdAt": "2026-10-01T12:00:00.000Z",
"updatedAt": "2026-10-03T08:30:00.000Z",
"tags": [{ "id": "…", "name": "DSP", "color": "blue" }],
"assignee": { "id": "71d0…", "email": "dev@example.com", "firstName": "Ada", "lastName": "Lovelace", "avatarUrl": null },
"project": { "name": "Enterprise" },
"parentArtifact": null,
"webUrl": "https://app.closedloop.ai/acme/documents/ISS-1035"
}
]
}sortOrderis the document's stack-rank position within its project. Lower sorts first;nullmeans unranked. Reorder withmove-artifact.parentArtifactis a convenience projection of one direct parent fromPRODUCESlineage, with the fieldsid,type,subtype,name,slug,externalUrl,linkId,linkType, andlinkCreatedAt. It isnullwhen no qualifying direct parent exists. The key is omitted entirely whenincludeParentArtifactisfalse, or when the API does not serve the parent-projection endpoint. For full lineage, uselist-artifact-links.webUrlis the web-app link for the document. The org slug is omitted when the server cannot confirm it for the current session, leaving an org-less path such as/documents/ISS-1035. The browser resolves that against whichever org the reader is signed into, so do not read an org segment out of awebUrlas a tenant identifier.
Errors: an API refusal (for example an unknown projectId) is returned as a tool error.
list-documents(projectId: "PRO-25", type: "ISSUE", limit: 50)Get Document
Tool: get-document
Scope: read
Underlying API: GET /documents/{documentId}; GET /artifact-links/parents for the parent projection; POST /documents/{id}/attachments/resolve when inline images are resolved
Fetches one document's metadata. Content is excluded by default; set includeContent to include the latest version's body, truncated to contentMaxChars.
| Name | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Document UUID or slug (e.g. PRD-7, PLN-12, FEA-42). |
includeContent | boolean | No | Include the latest version's content. Default false. |
contentMaxChars | integer | No | 200–120000. Default 4000. Applies only when includeContent is true. |
includeParentArtifact | boolean | No | Include the parentArtifact projection. Default true. |
resolveInlineImages | boolean | No | Resolve attachment:// inline image references when includeContent is true. Default true in that case; false skips the extra API call. |
includeImages | boolean | No | Also fetch the resolved inline images and return them as MCP image content blocks. Default false. Has an effect only with includeContent: true and resolveInlineImages not set to false. |
Returns one text block holding a JSON object:
{
"id": "3f8a…",
"title": "Checkout redesign",
"slug": "PRD-42",
"type": "PRD",
"status": "IN_REVIEW",
"projectId": "9b2c…",
"priority": "MEDIUM",
"dueDate": null,
"fileName": null,
"assigneeId": null,
"assignee": null,
"approverId": null,
"approver": null,
"tags": [],
"repositorySnapshot": null,
"sortOrder": null,
"latestVersion": 4,
"updatedAt": "2026-10-03T08:30:00.000Z",
"version": {
"id": "c1d2…",
"version": 4,
"createdAt": "2026-10-03T08:30:00.000Z",
"createdById": "71d0…",
"contentLength": 18234,
"content": "## Overview\n…...[truncated]",
"contentTruncated": true,
"returnedChars": 4000
},
"parentArtifact": null,
"webUrl": "https://app.closedloop.ai/acme/documents/PRD-42"
}version.contentLengthis always present and counts the full body's characters.content,contentTruncated, andreturnedCharsappear only whenincludeContentistrue. A truncated body ends with...[truncated].statusMutationappears only when the API returns one.repositorySnapshotis the server-owned record of the repositories the document was created against.- When inline images are resolved, the response adds
inlineImages, one entry perattachment://reference in the content:status: "resolved"withurl,filename,mimeType,sizeBytes, andexpiresAt, orstatus: "skipped"with areason(not_found,resolver_unavailable,resolve_failed, or a reason the API supplies). It also addscontentWithResolvedInlineImages: the content with each resolved reference replaced by its URL, truncated tocontentMaxCharswithout cutting through a Markdown image. Resolved URLs are presigned and expire atexpiresAt; fetch the document again to refresh them. - With
includeImages, up to 10 images follow the JSON as image content blocks. An image over 2 MiB, or one that would take the total past 6 MiB, is skipped, and each fetch times out after 10 seconds. Skipped images are listed ininlineImageBlockSkipswith areasonofimage_block_too_large,image_block_budget_exceeded,image_block_fetch_failed, orimage_block_count_exceeded.
Errors: a missing or blank documentId returns a message naming the expected document UUID or slug. A document that does not resolve in your organization returns the API's not-found error.
get-document(documentId: "PRD-42", includeContent: true, contentMaxChars: 20000)Get Document Content
Tool: get-document-content
Scope: read
Underlying API: GET /documents/{documentId} (with ?version=N when a version is pinned)
Returns an exact document-version body as UTF-8 text, in chunks of at most 64 KiB, with a SHA-256 digest of the whole body. Use it when get-document's character truncation is not enough. The first call names the document and, optionally, a version. Every later call passes the same documentId and the nextCursor it was given.
| Name | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Document UUID or slug (e.g. PRD-7, PLN-12, ISS-42). |
version | integer | No | Positive version number for the first call. Omit it for the latest version. Cannot be combined with cursor. |
cursor | string | No | The nextCursor from a previous call. 1–2048 characters of base64url. Cannot be combined with version. |
chunkSizeBytes | integer | No | 1–65536. Default 65536. The maximum UTF-8 bytes in this chunk. |
Returns the payload as both a JSON text block and structuredContent:
{
"documentId": "3f8a…",
"resolvedVersion": 4,
"content": "## Overview\n…",
"byteStart": 0,
"byteEndExclusive": 65530,
"returnedBytes": 65530,
"totalBytes": 182340,
"contentSha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"nextCursor": "eyJzY2hlbWFWZXJzaW9uIjox…"
}- The byte range is half-open:
byteStartis included,byteEndExclusiveis not. - A chunk never splits a UTF-8 character, so it can be a few bytes shorter than
chunkSizeBytes. nextCursorisnullon the last chunk.- The cursor pins the document, the version, the next byte offset, and the body's digest. It is an unsigned convenience, not an authorization token, and it does not detect a tampered offset that is still valid.
Errors:
cursor and version cannot be supplied together.- A malformed, oversized, non-canonical, or wrong-schema cursor is rejected.
- The cursor's digest or document id does not match the freshly read document.
- The API resolved a different version than the one requested or pinned.
- The cursor's offset is outside the body or not on a UTF-8 character boundary.
chunkSizeBytes is too small to include the next complete UTF-8 scalar.- A missing version returns the API's not-found error.
get-document-content(documentId: "PLN-12", version: 3)
get-document-content(documentId: "PLN-12", cursor: "eyJzY2hlbWFWZXJzaW9uIjox…")Create Document
Tool: create-document
Scope: write
Underlying API: POST /documents
Creates a PRD, implementation plan, or issue inside a project, or an organization-level document (DOC), which needs no project. Templates cannot be created through this tool. You can set editable fields and create inline images in the same call.
| Name | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Document title. The API rejects an empty title. |
type | string | Yes | PRD, IMPLEMENTATION_PLAN, FEATURE, ISSUE (normalized to FEATURE), or DOC. |
projectId | string | Conditional | Project UUID or slug (e.g. PRO-7). Required for PRD, IMPLEMENTATION_PLAN, and FEATURE/ISSUE; optional for DOC. |
content | string | Yes | The initial body. |
assigneeId | string (UUID) or null | No | User to assign. Find IDs with list-users. |
approverId | string (UUID) or null | No | User to set as approver. |
priority | string | No | LOW, MEDIUM, HIGH, or URGENT. |
dueDate | string or null | No | An ISO 8601 date (YYYY-MM-DD) or a datetime with a timezone offset. |
fileName | string | No | File name for the document. |
status | string | No | Initial status. It must belong to the type's vocabulary (see below). When omitted, issues start in TRIAGE and other types in DRAFT. |
repositorySelection | object | No | The repositories the document is created against: primary (fullName, optional branch) and an optional additional array of the same shape. The API allows at most 5 additional repositories and validates names and branches. |
inlineImages | array | No | Up to 5 images to create in the same call. See Inline images. |
Status vocabularies:
| Types | Statuses |
|---|---|
PRD, IMPLEMENTATION_PLAN, DOC | DRAFT, IN_REVIEW, CHANGES_REQUESTED, APPROVED, EXECUTED, OBSOLETE |
FEATURE / ISSUE | TRIAGE, BACKLOG, TODO, IN_PROGRESS, IN_REVIEW, BLOCKED, DONE, CANCELED |
The repository context is stored as a server-owned snapshot when the document is created. You cannot edit it afterwards.
Inline images
Each inlineImages entry turns a marker in content into a stored image:
| 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 MCP server also refuses any request body over 1 MiB, so several large images may not fit in one call.
Returns the created document as both a JSON text block and structuredContent:
{
"id": "3f8a…",
"organizationId": "…",
"projectId": "9b2c…",
"slug": "ISS-1036",
"title": "Add retry to checkout webhook",
"type": "FEATURE",
"status": "TRIAGE",
"priority": "HIGH",
"dueDate": null,
"latestVersion": 1,
"createdById": "71d0…",
"assigneeId": null,
"approverId": null,
"sortOrder": null,
"createdAt": "2026-10-03T08:30:00.000Z",
"updatedAt": "2026-10-03T08:30:00.000Z",
"webUrl": "https://app.closedloop.ai/acme/documents/ISS-1036",
"versionContent": "…",
"inlineImages": [
{
"placeholder": "{{diagram}}",
"attachmentId": "a1b2…",
"attachmentRef": "attachment://a1b2…",
"markdownImage": ""
}
]
}Fields the API does not return are omitted. createdBy, assignee, and approver carry id, email, firstName, lastName, and avatarUrl when present. repositorySnapshot carries repositories (each with fullName, role, position, branch), source, and createdAt. inlineImages appears only when images were created. When the API returns an operation receipt, the response also carries an operationReceipt object.
Errors:
projectIdomitted for a project-bound type returns a message asking for a project UUID or slug and pointing tolist-projects.- The API rejects a
statusoutside the type's vocabulary, an empty title, an invalidrepositorySelection, and placeholders that are missing fromcontent, duplicated, or overlapping. - In error text from this tool, base64 data, storage keys, and presigned URLs are redacted.
create-document(type: "ISSUE", title: "Add retry to checkout webhook", projectId: "PRO-25", content: "## Problem\n…", priority: "HIGH")Update Document
Tool: update-document
Scope: write
Underlying API: PUT /documents/{documentId}
Changes a document's editable fields. Only the fields you pass are sent. Where a field accepts null, null clears it, and omitting the field leaves it unchanged. To change the body, use create-document-version. To change tags, use tag-artifact.
| Name | Type | Required | Description |
|---|---|---|---|
documentId | string | Yes | Document UUID or slug (e.g. PRD-7, PLN-12, FEA-42). |
projectId | string or null | No | Move the document to this project (UUID or slug). null clears the project. |
title | string | No | New title. The API rejects an empty title. |
status | string | No | New status from the type's vocabulary (see Create Document). The API rejects a status from the other vocabulary. |
expectedStatus | string | No | Stale-write guard, minimum 1 character. The API refuses the update with HTTP 409 unless the stored status still equals this value. |
assigneeId | string (UUID) or null | No | New assignee. null unassigns. |
approverId | string (UUID) or null | No | New approver. null clears it. |
priority | string or null | No | LOW, MEDIUM, HIGH, or URGENT. null clears it. |
expectedPriority | string or null | No | Stale-write guard for priority. The API refuses with HTTP 409 unless the stored priority still equals this value. null asserts the document currently has no priority. |
dueDate | string or null | No | An ISO 8601 date (YYYY-MM-DD) or a datetime with a timezone offset. null clears it. |
fileName | string | No | New file name. |
Read-only fields such as id, slug, timestamps, latestVersion, and repositorySnapshot are not parameters of this tool and cannot be changed.
Returns the API's updated document object with a webUrl added. The tool passes the API's fields through without reshaping them.
Errors: HTTP 409 when an expectedStatus or expectedPriority guard does not match the stored value. HTTP 400 for a status outside the document's vocabulary or another invalid field. The API's not-found error when the document or the target project does not resolve.
update-document(documentId: "ISS-1035", status: "IN_REVIEW", expectedStatus: "IN_PROGRESS")