Skip to main content
Glama

Create Comment

create_comment

Add comments to any document in your AFFiNE workspace to provide feedback or collaborate.

Instructions

Create a comment on a doc.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspaceIdNo
docIdYes
docTitleNo
docModeNo
contentNo
mentionsNo

Implementation Reference

  • The handler function that executes the create_comment tool logic: builds a GraphQL mutation to create a comment, normalizes input content and docMode, and returns a receipt.
    const createCommentHandler = async (parsed: { workspaceId?: string; docId: string; docTitle?: string; docMode?: "Page"|"Edgeless"|"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 normalizedDocMode = (parsed.docMode || 'page').toLowerCase() === 'edgeless' ? 'edgeless' : 'page';
      const normalizedContent = typeof parsed.content === 'string' ? { text: parsed.content } : parsed.content;
      const input = { content: normalizedContent, docId: parsed.docId, workspaceId, docTitle: parsed.docTitle || "", docMode: normalizedDocMode, mentions: parsed.mentions };
      const data = await gql.request<{ createComment: any }>(mutation, { input });
      return receipt("comment.create", {
        workspaceId,
        docId: parsed.docId,
        commentId: data.createComment.id,
        id: data.createComment.id,
        ...data.createComment,
        comment: data.createComment,
      });
    };
  • Input schema for create_comment: accepts optional workspaceId, required docId, optional docTitle, optional docMode (Page/Edgeless/page/edgeless), required content (any type), and optional mentions array.
    inputSchema: {
      workspaceId: z.string().optional(),
      docId: z.string(),
      docTitle: z.string().optional(),
      docMode: z.enum(["Page","Edgeless","page","edgeless"]).optional(),
      content: z.any(),
      mentions: z.array(z.string()).optional()
    }
  • Registration of the 'create_comment' tool via server.registerTool, with title 'Create Comment' and description 'Create a comment on a doc.'
    server.registerTool(
      "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","page","edgeless"]).optional(),
          content: z.any(),
          mentions: z.array(z.string()).optional()
        }
      },
      createCommentHandler as any
    );
  • src/index.ts:181-181 (registration)
    Top-level registration call that wires registerCommentTools into the MCP server at startup.
    registerCommentTools(server, gql, { workspaceId: config.defaultWorkspaceId });
  • The 'receipt' helper function used by the handler to format the response with a kind, ok status, and data payload.
    export function receipt(kind: string, data: Record<string, unknown>) {
      return text({
        kind,
        ok: true,
        ...data,
      });
    }
Behavior2/5

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

No annotations are present, so the description must convey behavioral traits. However, it only states the action without disclosing side effects, permissions, or what happens if the doc doesn't exist. Minimal transparency.

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

Conciseness2/5

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

The description is extremely concise (one short sentence) but at the expense of necessary detail. It lacks structure and depth, failing to provide useful information.

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?

With no output schema, no annotations, and a 6-parameter schema, the description is severely incomplete. The agent cannot determine required inputs, behavior, or return values.

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?

Schema description coverage is 0%, and the description does not explain any of the 6 parameters. The agent gets no additional meaning beyond parameter names like 'workspaceId' or 'content'.

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

Purpose3/5

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

The description states the verb 'Create' and the resource 'comment on a doc', which is clear but vague. It does not specify the type of comment or any unique behavior that distinguishes it from sibling tools like 'resolve_comment' or 'update_comment'.

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 (e.g., when to update vs create). There are no prerequisites or context for when this tool is appropriate.

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