Skip to main content
Glama

List Comments

affine_list_comments

Retrieve and organize comments with replies for a specific document in AFFiNE workspaces using workspace and document IDs to manage discussions effectively.

Instructions

List comments of a doc (with replies).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
afterNo
docIdYes
firstNo
offsetNo
workspaceIdNo

Implementation Reference

  • The async handler function that implements the core logic of listing comments for a document using a GraphQL query.
    const listCommentsHandler = async (parsed: { workspaceId?: string; docId: string; first?: number; offset?: number; after?: string }) => {
      const workspaceId = parsed.workspaceId || defaults.workspaceId || parsed.workspaceId;
      if (!workspaceId) throw new Error("workspaceId required (or set AFFINE_WORKSPACE_ID)");
      const query = `query ListComments($workspaceId:String!,$docId:String!,$first:Int,$offset:Int,$after:String){ workspace(id:$workspaceId){ comments(docId:$docId, pagination:{first:$first, offset:$offset, after:$after}){ totalCount pageInfo{ hasNextPage endCursor } edges{ cursor node{ id content createdAt updatedAt resolved user{ id name avatarUrl } replies{ id content createdAt updatedAt user{ id name avatarUrl } } } } } } }`;
      const data = await gql.request<{ workspace: any }>(query, { workspaceId, docId: parsed.docId, first: parsed.first, offset: parsed.offset, after: parsed.after });
      return text(data.workspace.comments);
  • Registers the 'affine_list_comments' tool with the MCP server, including schema and handler reference.
    server.registerTool(
      "affine_list_comments",
      {
        title: "List Comments",
        description: "List comments of a doc (with replies).",
        inputSchema: {
          workspaceId: z.string().optional(),
          docId: z.string(),
          first: z.number().optional(),
          offset: z.number().optional(),
          after: z.string().optional()
        }
      },
      listCommentsHandler as any
    );
  • Zod-based input schema for the tool parameters: workspaceId (optional), docId (required), pagination options.
    inputSchema: {
      workspaceId: z.string().optional(),
      docId: z.string(),
      first: z.number().optional(),
      offset: z.number().optional(),
      after: z.string().optional()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions that replies are included, which adds some context beyond the basic 'list' action. However, it lacks critical details such as pagination behavior (implied by parameters like 'after', 'first', 'offset'), permissions required, rate limits, or output format. For a read operation with multiple parameters, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It is front-loaded with the core action ('List comments') and includes a clarifying detail ('with replies') without unnecessary elaboration. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (5 parameters, 1 required), lack of annotations, and no output schema, the description is incomplete. It adequately states the purpose but fails to provide usage guidelines, parameter semantics, or behavioral details needed for effective tool invocation. For a list operation with pagination parameters, this leaves significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the schema provides no parameter details. The description does not mention any parameters, failing to compensate for the coverage gap. It doesn't explain what 'docId', 'workspaceId', 'after', 'first', or 'offset' mean or how they affect the listing, leaving all 5 parameters undocumented in both schema and description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('List') and resource ('comments of a doc'), specifying that replies are included. It distinguishes from siblings like 'affine_create_comment' (create) and 'affine_update_comment' (update), but doesn't explicitly differentiate from other list tools like 'affine_list_access_tokens' or 'affine_list_notifications' beyond the resource type.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., authentication), context (e.g., for reviewing feedback), or exclusions (e.g., not for editing comments). The description only states what it does, not when or why to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DAWNCR0W/affine-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server