Skip to main content
Glama

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()

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