get_file_versions
Retrieve version history of a Figma file using the Figma MCP Server, which efficiently manages large files with chunking and pagination capabilities.
Instructions
Get version history of a Figma file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_key | Yes | Figma file key |
Implementation Reference
- src/index.ts:356-368 (handler)MCP tool handler for 'get_file_versions' that validates the file_key argument, calls the figmaClient.getFileVersions method, and returns the result as a JSON-formatted text content block.case 'get_file_versions': { 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 versions', { fileKey: args.file_key, }); const data = await this.figmaClient.getFileVersions(args.file_key); return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }], }; }
- src/index.ts:164-177 (registration)Registration of the 'get_file_versions' tool in the ListTools response, including name, description, and input schema.{ name: 'get_file_versions', description: 'Get version history of a Figma file', inputSchema: { type: 'object', properties: { file_key: { type: 'string', description: 'Figma file key' } }, required: ['file_key'] } },
- src/client.ts:327-342 (helper)Implementation of getFileVersions in ChunkedFigmaClient that makes the Figma API request to retrieve file version history and returns the response data, with memory limit check.async getFileVersions(fileKey: string) { try { console.debug('[MCP Debug] Getting versions for file:', fileKey); const response = await this.client.get(`/files/${fileKey}/versions`); if (this.nodeProcessor.hasReachedLimit()) { console.debug('[MCP Debug] Memory limit reached while processing versions'); throw new Error('Memory limit exceeded while processing versions'); } return response.data; } catch (error) { console.error('[MCP Error] Failed to get file versions:', error); throw error; } }