post_comment
Add comments to specific nodes in Figma files by specifying the file key, node ID, message, and pin coordinates. Facilitates precise feedback and collaboration within Figma workflows.
Instructions
Post a comment on a node in a Figma file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_key | Yes | The key of the Figma file | |
| message | Yes | The comment message | |
| node_id | No | The ID of the node to comment on. Node ids have the format `<number>:<number>` | |
| x | Yes | The x coordinate of the comment pin | |
| y | Yes | The y coordinate of the comment pin |
Implementation Reference
- src/index.ts:316-328 (handler)The handler function that executes the post_comment tool by making a POST request to the Figma API to add a comment to a file.private async postComment(args: any) { const response = await this.axiosInstance.post(`/files/${args.file_key}/comments`, { message: args.message, }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; }
- src/index.ts:135-148 (schema)Input schema defining the parameters for the post_comment tool: file_key (string) and message (string), both required.inputSchema: { type: 'object', properties: { file_key: { type: 'string', description: 'The Figma file key', }, message: { type: 'string', description: 'The comment message', }, }, required: ['file_key', 'message'], },
- src/index.ts:132-149 (registration)Registration of the post_comment tool in the ListToolsRequestSchema handler, including name, description, and input schema.{ name: 'post_comment', description: 'Post a comment to a Figma file', inputSchema: { type: 'object', properties: { file_key: { type: 'string', description: 'The Figma file key', }, message: { type: 'string', description: 'The comment message', }, }, required: ['file_key', 'message'], }, },
- src/index.ts:58-59 (registration)Tool dispatch in the CallToolRequestSchema handler switch statement, routing post_comment calls to the postComment method.case 'post_comment': return await this.postComment(request.params.arguments);