Skip to main content
Glama

Create Comment

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()
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a comment but doesn't mention any behavioral traits such as required permissions, whether it's idempotent, rate limits, or what happens on success/failure. For a creation tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

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 extremely concise—a single sentence that directly states the tool's purpose without any fluff. It's front-loaded and wastes no words, making it easy to parse quickly. Every word earns its place by conveying essential information.

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 tool's complexity (6 parameters, creation operation) and lack of annotations or output schema, the description is incomplete. It doesn't explain what the tool returns, how to handle parameters like 'mentions' or 'docMode', or any error conditions. For a creation tool with multiple parameters, more context is needed to use it effectively.

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?

The description provides no information about parameters, while the schema has 6 parameters with 0% description coverage. Parameters like 'content', 'docMode' (with enum values 'Page' and 'Edgeless'), 'mentions', and 'workspaceId' are entirely undocumented. The description fails to compensate for the schema's lack of parameter explanations.

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 action ('Create') and target ('comment on a doc'), making the purpose immediately understandable. It distinguishes from siblings like 'affine_update_comment' and 'affine_delete_comment' by specifying creation rather than modification or deletion. However, it doesn't explicitly differentiate from all siblings (e.g., 'affine_apply_doc_updates' might also involve doc modifications).

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. For example, it doesn't mention prerequisites like authentication, when to use 'affine_update_comment' instead for edits, or how it relates to 'affine_list_comments' for viewing. The description lacks any context about usage scenarios or exclusions.

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