Skip to main content
Glama

List Comments

list_comments

Retrieve comments and replies from a document in an AFFiNE workspace. Specify the document ID to get threaded discussions.

Instructions

List comments of a doc (with replies).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceIdNo
docIdYes
firstNo
offsetNo
afterNo

Implementation Reference

  • The listCommentsHandler function that executes the tool logic: sends a GraphQL query to list comments of a doc with pagination support (first, offset, after) and returns the workspace's comments.
    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);
    };
  • Input schema for list_comments using Zod: optional workspaceId, required docId, optional first, offset, and after for pagination.
    inputSchema: {
      workspaceId: z.string().optional(),
      docId: z.string(),
      first: z.number().optional(),
      offset: z.number().optional(),
      after: z.string().optional()
    }
  • Registration of the 'list_comments' tool via server.registerTool with the handler, title 'List Comments', and description.
    server.registerTool(
      "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
    );
  • src/index.ts:181-181 (registration)
    Registration call: registerCommentTools(server, gql, { workspaceId }) which wires up the tool in the MCP server.
    registerCommentTools(server, gql, { workspaceId: config.defaultWorkspaceId });
  • Tool groups/permissions mapping for list_comments: requires ['comments', 'comments.read', 'read'] groups.
    list_comments: ["comments", "comments.read", "read"],
Behavior2/5

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

No annotations are present, so the description must disclose behavioral traits. It only mentions that replies are included but says nothing about pagination behavior, ordering, rate limits, or data freshness. The agent is left to infer these from the parameter names.

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

Conciseness3/5

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

The description is very concise, consisting of a single short sentence. However, it sacrifices necessary detail for brevity. It is front-loaded with the core action but lacks structure or additional context.

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

Completeness1/5

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

Given the tool has 5 parameters, no output schema, and no annotations, the description is severely incomplete. It does not explain the return format, pagination mechanism, or relation to other tools. The agent cannot confidently use this tool based solely on this description.

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

Parameters1/5

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

With 0% schema description coverage, the description should explain the parameters. It does not mention workspaceId, first, offset, or after at all. The agent cannot understand how to use pagination or the optional workspaceId parameter from this 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', and notes that replies are included. It distinguishes from sibling tools like create_comment or delete_comment. However, it does not specify whether the list is all comments or paginated, which is implied by the input schema.

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?

The description provides no guidance on when to use this tool versus alternatives such as get_doc or resolve_comment. It does not mention any preconditions, use cases, or when not 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

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