Skip to main content
Glama

affine_create_comment

Add and manage comments on AFFiNE documents by specifying workspace, document ID, content, and mentions. Streamline collaborative feedback directly within the MCP server.

Instructions

Create a comment on a doc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNo
docIdYes
docModeNo
docTitleNo
mentionsNo
workspaceIdNo

Implementation Reference

  • The asynchronous handler function that implements the logic for creating a comment via GraphQL mutation to the Affine server.
    const createCommentHandler = async (parsed: { workspaceId?: string; docId: string; docTitle?: string; docMode?: "Page"|"Edgeless"; content: any; mentions?: string[] }) => { const workspaceId = parsed.workspaceId || defaults.workspaceId || parsed.workspaceId; if (!workspaceId) throw new Error("workspaceId required (or set AFFINE_WORKSPACE_ID)"); const mutation = `mutation CreateComment($input: CommentCreateInput!){ createComment(input:$input){ id content createdAt updatedAt resolved } }`; const input = { content: parsed.content, docId: parsed.docId, workspaceId, docTitle: parsed.docTitle || "", docMode: parsed.docMode || "Page", mentions: parsed.mentions }; const data = await gql.request<{ createComment: any }>(mutation, { input }); return text(data.createComment); };
  • Registers the 'affine_create_comment' tool with the MCP server, including input schema validation using Zod and the handler function.
    server.registerTool( "affine_create_comment", { title: "Create Comment", description: "Create a comment on a doc.", inputSchema: { workspaceId: z.string().optional(), docId: z.string(), docTitle: z.string().optional(), docMode: z.enum(["Page","Edgeless"]).optional(), content: z.any(), mentions: z.array(z.string()).optional() } }, createCommentHandler as any );
  • Input schema definition for the 'affine_create_comment' tool using Zod validators.
    inputSchema: { workspaceId: z.string().optional(), docId: z.string(), docTitle: z.string().optional(), docMode: z.enum(["Page","Edgeless"]).optional(), content: z.any(), mentions: z.array(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