Closedloop.ai
MCP Server

Comment Threads

Read and create comment threads on documents

Overview

Comment-thread tools read the discussion on a document and start new threads on it. A thread is either anchored to a passage of the document's text, or artifact-level, meaning it is about the document as a whole.

Both tools take the document as documentId, which accepts a UUID or a slug (PRD-*, PLN-*, ISS-*, DOC-*; legacy FEA-* slugs still resolve). Pass the user's slug verbatim.

ToolScope
get-document-commentsread
create-document-threadwrite

A tool is offered to a session only when the session's credential carries its scope. When a call fails, the tool returns an isError result whose text gives the error title, a description, and, when the API sent them, the error code, message, and timestamp.

These tools cover document threads only. Comments on agent sessions are read with list-session-comments; see Agent Session Reporting.


Get Document Comments

Tool: get-document-comments Scope: read Underlying API: GET /documents/{documentId}/threads (with ?status=<value> when status is given)

NameTypeRequiredDescription
documentIdstringYesDocument UUID or slug (e.g. PRD-7, PLN-12, ISS-42). Blank values, ., and .. are rejected.
status"OPEN" | "RESOLVED"NoReturn only threads with this status. Omit to return all threads.

Returns

A JSON array of threads, each with its comments:

[
  {
    "id": "c3d4e5f6-...",
    "status": "OPEN",
    "source": "LIVEBLOCKS",
    "anchorStatus": "anchored",
    "artifactId": "0b9a8c7d-...",
    "createdAt": "2026-10-01T12:00:00.000Z",
    "comments": [
      {
        "id": "d4e5f6a7-...",
        "plainText": "Should this cover the mobile flow too?",
        "createdAt": "2026-10-01T12:00:00.000Z",
        "author": "a1b2c3d4-..."
      }
    ]
  }
]
FieldMeaning
statusOPEN or RESOLVED.
sourceThe system that holds the thread: NATIVE, LIVEBLOCKS, or GITHUB.
anchorStatusanchored (attached to text in the document), floating (its anchor text is no longer found in the document), artifact-level (about the whole document), or null when the thread carries no anchor information the server can read.
comments[].authorThe author's user UUID. Resolve it with list-users.

The tool returns the whole list in one response; it has no pagination.

Errors

  • The document does not exist in your organization: Artifact not found (404).

Example

get-document-comments(documentId: "PRD-42", status: "OPEN")

Create a Document Thread

Tool: create-document-thread Scope: write Underlying API: POST /documents/{documentId}/threads

Starts a new thread with one comment. With anchorText, the thread is anchored to that text in the document. Without it, the thread is artifact-level.

NameTypeRequiredDescription
documentIdstringYesDocument UUID or slug.
bodystringYesComment text. Minimum 1 character.
anchorTextstringNoExact text in the document to anchor the thread to. Minimum 1 character. Case-sensitive, and it must occur exactly once in the document. It may span inline formatting such as bold or italic within one block (a paragraph, heading, or list item), but it cannot cross from one block into another. Omit for an artifact-level thread.

The whole request body may be at most 32,768 bytes.

Returns

The API response, as JSON:

{
  "commentId": "d4e5f6a7-...",
  "threadId": "c3d4e5f6-..."
}

The response may also carry an operationReceipt object recording the write.

Errors

  • The document does not exist in your organization: Artifact not found (404).
  • anchorText is not found in the document: Anchor text not found in document (400).
  • anchorText occurs more than once in the document: a 400 such as Anchor text "checkout" appears 3 times in the document; use more specific text.
  • An empty body or empty anchorText: a 400 validation error. A request body over 32,768 bytes: Request body too large (413).
  • Other failures, such as the comment store being unavailable, return a generic Failed to create thread error.

Example

create-document-thread(documentId: "PRD-42", body: "Should this cover the mobile flow too?", anchorText: "checkout flow")

On this page