get_file_comments
Retrieve comments from Figma files using the Figma MCP Server with Chunking, enabling efficient handling of large files through memory-aware chunking and pagination.
Instructions
Get comments on a Figma file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_key | Yes | Figma file key |
Implementation Reference
- src/index.ts:178-191 (registration)Tool registration including name, description, and input schema for get_file_comments{ name: 'get_file_comments', description: 'Get comments on a Figma file', inputSchema: { type: 'object', properties: { file_key: { type: 'string', description: 'Figma file key' } }, required: ['file_key'] } },
- src/index.ts:370-382 (handler)MCP tool handler for get_file_comments: validates args, calls figmaClient.getFileComments, returns JSON stringified responsecase 'get_file_comments': { const args = request.params.arguments as unknown as FileKeyArgs; if (!args.file_key) { throw new McpError(ErrorCode.InvalidParams, 'file_key is required'); } console.debug('[MCP Debug] Fetching file comments', { fileKey: args.file_key, }); const data = await this.figmaClient.getFileComments(args.file_key); return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }], }; }
- src/client.ts:344-359 (helper)Core implementation: makes API call to Figma /files/{fileKey}/comments endpoint and returns the dataasync getFileComments(fileKey: string) { try { console.debug('[MCP Debug] Getting comments for file:', fileKey); const response = await this.client.get(`/files/${fileKey}/comments`); if (this.nodeProcessor.hasReachedLimit()) { console.debug('[MCP Debug] Memory limit reached while processing comments'); throw new Error('Memory limit exceeded while processing comments'); } return response.data; } catch (error) { console.error('[MCP Error] Failed to get file comments:', error); throw error; } }