Closedloop.ai
MCP Server

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.

ToolScopePurpose
list-documentsreadPage through documents, filtered by project, type, or assignee
get-documentreadFetch one document's metadata, optionally with its latest content
get-document-contentreadRead an exact document-version body in UTF-8 chunks
create-documentwriteCreate a PRD, implementation plan, issue, or organization-level document
update-documentwriteChange 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:

ValueMeaning
PRDProduct requirements document
IMPLEMENTATION_PLANImplementation plan
FEATUREIssue (the stored name)
ISSUEAlias for FEATURE; it is normalized to FEATURE before the request is sent
DOCOrganization-level document
TEMPLATEInternal 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.

NameTypeRequiredDescription
projectIdstringNoProject UUID or slug (e.g. PRO-7).
assigneeIdstringNoAssignee user ID.
typestringNoOne of the document types. ISSUE and FEATURE select the same documents.
limitintegerNo1–100. Default 25.
offsetintegerNoMinimum 0. Default 0.
includeParentArtifactbooleanNoInclude 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"
    }
  ]
}
  • sortOrder is the document's stack-rank position within its project. Lower sorts first; null means unranked. Reorder with move-artifact.
  • parentArtifact is a convenience projection of one direct parent from PRODUCES lineage, with the fields id, type, subtype, name, slug, externalUrl, linkId, linkType, and linkCreatedAt. It is null when no qualifying direct parent exists. The key is omitted entirely when includeParentArtifact is false, or when the API does not serve the parent-projection endpoint. For full lineage, use list-artifact-links.
  • webUrl is 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 a webUrl as 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.

NameTypeRequiredDescription
documentIdstringYesDocument UUID or slug (e.g. PRD-7, PLN-12, FEA-42).
includeContentbooleanNoInclude the latest version's content. Default false.
contentMaxCharsintegerNo200–120000. Default 4000. Applies only when includeContent is true.
includeParentArtifactbooleanNoInclude the parentArtifact projection. Default true.
resolveInlineImagesbooleanNoResolve attachment:// inline image references when includeContent is true. Default true in that case; false skips the extra API call.
includeImagesbooleanNoAlso 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.contentLength is always present and counts the full body's characters. content, contentTruncated, and returnedChars appear only when includeContent is true. A truncated body ends with ...[truncated].
  • statusMutation appears only when the API returns one.
  • repositorySnapshot is the server-owned record of the repositories the document was created against.
  • When inline images are resolved, the response adds inlineImages, one entry per attachment:// reference in the content: status: "resolved" with url, filename, mimeType, sizeBytes, and expiresAt, or status: "skipped" with a reason (not_found, resolver_unavailable, resolve_failed, or a reason the API supplies). It also adds contentWithResolvedInlineImages: the content with each resolved reference replaced by its URL, truncated to contentMaxChars without cutting through a Markdown image. Resolved URLs are presigned and expire at expiresAt; 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 in inlineImageBlockSkips with a reason of image_block_too_large, image_block_budget_exceeded, image_block_fetch_failed, or image_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.

NameTypeRequiredDescription
documentIdstringYesDocument UUID or slug (e.g. PRD-7, PLN-12, ISS-42).
versionintegerNoPositive version number for the first call. Omit it for the latest version. Cannot be combined with cursor.
cursorstringNoThe nextCursor from a previous call. 1–2048 characters of base64url. Cannot be combined with version.
chunkSizeBytesintegerNo1–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: byteStart is included, byteEndExclusive is not.
  • A chunk never splits a UTF-8 character, so it can be a few bytes shorter than chunkSizeBytes.
  • nextCursor is null on 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.

NameTypeRequiredDescription
titlestringYesDocument title. The API rejects an empty title.
typestringYesPRD, IMPLEMENTATION_PLAN, FEATURE, ISSUE (normalized to FEATURE), or DOC.
projectIdstringConditionalProject UUID or slug (e.g. PRO-7). Required for PRD, IMPLEMENTATION_PLAN, and FEATURE/ISSUE; optional for DOC.
contentstringYesThe initial body.
assigneeIdstring (UUID) or nullNoUser to assign. Find IDs with list-users.
approverIdstring (UUID) or nullNoUser to set as approver.
prioritystringNoLOW, MEDIUM, HIGH, or URGENT.
dueDatestring or nullNoAn ISO 8601 date (YYYY-MM-DD) or a datetime with a timezone offset.
fileNamestringNoFile name for the document.
statusstringNoInitial status. It must belong to the type's vocabulary (see below). When omitted, issues start in TRIAGE and other types in DRAFT.
repositorySelectionobjectNoThe 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.
inlineImagesarrayNoUp to 5 images to create in the same call. See Inline images.

Status vocabularies:

TypesStatuses
PRD, IMPLEMENTATION_PLAN, DOCDRAFT, IN_REVIEW, CHANGES_REQUESTED, APPROVED, EXECUTED, OBSOLETE
FEATURE / ISSUETRIAGE, 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:

FieldTypeRequiredDescription
placeholderstringYes1–200 characters. The exact marker text in content to replace.
filenamestringYes1–255 characters.
mimeTypestringYesimage/jpeg, image/png, image/gif, or image/webp.
dataBase64stringYesRaw base64 image bytes with no data: prefix. 1–699052 characters (512 KiB of image data).
altTextstringNoUp 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 ![alt](attachment://<attachment-id>). 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": "![Flow](attachment://a1b2…)"
    }
  ]
}

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:

  • projectId omitted for a project-bound type returns a message asking for a project UUID or slug and pointing to list-projects.
  • The API rejects a status outside the type's vocabulary, an empty title, an invalid repositorySelection, and placeholders that are missing from content, 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.

NameTypeRequiredDescription
documentIdstringYesDocument UUID or slug (e.g. PRD-7, PLN-12, FEA-42).
projectIdstring or nullNoMove the document to this project (UUID or slug). null clears the project.
titlestringNoNew title. The API rejects an empty title.
statusstringNoNew status from the type's vocabulary (see Create Document). The API rejects a status from the other vocabulary.
expectedStatusstringNoStale-write guard, minimum 1 character. The API refuses the update with HTTP 409 unless the stored status still equals this value.
assigneeIdstring (UUID) or nullNoNew assignee. null unassigns.
approverIdstring (UUID) or nullNoNew approver. null clears it.
prioritystring or nullNoLOW, MEDIUM, HIGH, or URGENT. null clears it.
expectedPrioritystring or nullNoStale-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.
dueDatestring or nullNoAn ISO 8601 date (YYYY-MM-DD) or a datetime with a timezone offset. null clears it.
fileNamestringNoNew 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")

On this page