read_comments
Retrieve all comments from a Figma file by providing the file key. Integrates with the Figma MCP Server to enable AI assistants to analyze and interact with design feedback in chat interfaces.
Instructions
Get all comments on a Figma file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_key | Yes | The key of the Figma file |
Implementation Reference
- index.ts:217-227 (handler)MCP tool handler for 'read_comments': calls readComments helper and returns JSON stringified comments as text content.async function doReadComments(fileKey: string): Promise<CallToolResult> { const data = await readComments(fileKey); return { content: [ { type: "text", text: JSON.stringify(data, null, 2), }, ], }; }
- figma_api.ts:101-108 (helper)Core helper function that makes the Figma API call to retrieve comments for a file.export async function readComments(fileKey: string) { const response = await axios.get(`https://api.figma.com/v1/files/${fileKey}/comments`, { headers: { "X-FIGMA-TOKEN": getFigmaApiKey(), }, }); return response.data; }
- index.ts:68-81 (schema)Tool schema definition for 'read_comments', including name, description, and input schema requiring 'file_key'.const READ_COMMENTS: Tool = { name: "read_comments", description: "Get all comments on a Figma file", inputSchema: { type: "object", properties: { file_key: { type: "string", description: "The key of the Figma file", }, }, required: ["file_key"], }, };
- index.ts:275-277 (registration)Dispatch registration in CallToolRequestHandler: routes 'read_comments' calls to doReadComments handler.if (request.params.name === "read_comments") { const input = request.params.arguments as { file_key: string }; return doReadComments(input.file_key);
- index.ts:138-140 (registration)Registers 'read_comments' tool (via READ_COMMENTS) in the list of available tools.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ADD_FIGMA_FILE, VIEW_NODE, READ_COMMENTS, POST_COMMENT, REPLY_TO_COMMENT], }));