reply_to_comment
Respond to comments in Figma files directly via the Figma MCP Server. Input the file key, comment ID, and reply message to engage in design discussions efficiently.
Instructions
Reply to an existing comment in a Figma file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| comment_id | Yes | The ID of the comment to reply to. Comment ids have the format `<number>` | |
| file_key | Yes | The key of the Figma file | |
| message | Yes | The reply message |
Implementation Reference
- index.ts:115-136 (schema)Defines the Tool object for reply_to_comment, including name, description, and input schema.const REPLY_TO_COMMENT: Tool = { name: "reply_to_comment", description: "Reply to an existing comment in a Figma file", inputSchema: { type: "object", properties: { file_key: { type: "string", description: "The key of the Figma file", }, comment_id: { type: "string", description: "The ID of the comment to reply to. Comment ids have the format `<number>`", }, message: { type: "string", description: "The reply message", }, }, required: ["file_key", "comment_id", "message"], }, };
- index.ts:138-140 (registration)Registers the reply_to_comment tool (as REPLY_TO_COMMENT) in the list of available tools returned by listTools.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ADD_FIGMA_FILE, VIEW_NODE, READ_COMMENTS, POST_COMMENT, REPLY_TO_COMMENT], }));
- index.ts:247-261 (handler)The main handler function that executes the tool logic: calls the Figma API helper and formats the response.async function doReplyToComment( fileKey: string, commentId: string, message: string ): Promise<CallToolResult> { const data = await replyToComment(fileKey, commentId, message); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
- index.ts:291-298 (registration)Dispatch logic in callToolRequest handler that routes requests for reply_to_comment to the doReplyToComment function.if (request.params.name === "reply_to_comment") { const input = request.params.arguments as { file_key: string; comment_id: string; message: string; }; return doReplyToComment(input.file_key, input.comment_id, input.message); }
- figma_api.ts:133-148 (helper)Core helper function that performs the HTTP POST request to the Figma API to reply to a comment.export async function replyToComment(fileKey: string, commentId: string, message: string) { const response = await axios.post( `https://api.figma.com/v1/files/${fileKey}/comments`, { message, comment_id: commentId, }, { headers: { "X-FIGMA-TOKEN": getFigmaApiKey(), "Content-Type": "application/json", }, } ); return response.data; }