figma_get_file_data
Retrieve detailed Figma file data including nodes, geometry paths, and plugin information using file keys and node IDs. Essential for developers and designers accessing specific file details.
Instructions
Get detailed information about a Figma file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branch_data | No | Specify whether to return branch data | |
| depth | No | Specify the depth of nodes to return | |
| fileKey | Yes | Unique identifier of the Figma file | |
| geometry | No | Specify whether to include geometry path data | |
| ids | Yes | List of node IDs to retrieve, comma separated | |
| personalToken | No | Your Figma personal access token | |
| plugin_data | No | Specify plugin data to return | |
| version | No | Specify the version to return |
Implementation Reference
- src/server/figma/tools/figma.ts:24-35 (handler)The handler function for the figma_get_file_data tool that invokes the api.files helper and formats the response as text or error message.async (o): Promise<CallToolResult> => { try { const data = await api.files(o) return { content: [{type: 'text', text: JSON.stringify(data)}], } } catch (error: any) { return { content: [{type: 'text', text: `Error: ${error.message}`}], } } },
- Zod schema defining the input parameters for the figma_get_file_data tool.{ fileKey: z.string().describe('Unique identifier of the Figma file'), ids: z.string().describe('List of node IDs to retrieve, comma separated'), personalToken: z .string() .optional() .describe('Your Figma personal access token, The parameters are not required when the tool is called.'), version: z.string().optional().describe('Specify the version to return'), depth: z.number().optional().describe('Specify the depth of nodes to return'), geometry: z.enum(['paths']).optional().describe('Specify whether to include geometry path data'), plugin_data: z.string().optional().describe('Specify plugin data to return'), branch_data: z.boolean().optional().describe('Specify whether to return branch data'), },
- src/server/figma/tools/figma.ts:8-36 (registration)Registration of the figma_get_file_data tool on the MCP server using server.tool method.server.tool( 'figma_get_file_data', 'Get detailed information about a Figma file', { fileKey: z.string().describe('Unique identifier of the Figma file'), ids: z.string().describe('List of node IDs to retrieve, comma separated'), personalToken: z .string() .optional() .describe('Your Figma personal access token, The parameters are not required when the tool is called.'), version: z.string().optional().describe('Specify the version to return'), depth: z.number().optional().describe('Specify the depth of nodes to return'), geometry: z.enum(['paths']).optional().describe('Specify whether to include geometry path data'), plugin_data: z.string().optional().describe('Specify plugin data to return'), branch_data: z.boolean().optional().describe('Specify whether to return branch data'), }, async (o): Promise<CallToolResult> => { try { const data = await api.files(o) return { content: [{type: 'text', text: JSON.stringify(data)}], } } catch (error: any) { return { content: [{type: 'text', text: `Error: ${error.message}`}], } } }, )
- src/server/figma/apis/figma.ts:9-18 (helper)Core helper method in FigmaRestApi that constructs the appropriate Figma API URL for file/nodes data and fetches it.async files(o: GetFileParams) { let url: string if (o.ids) { url = this.opToUrl(`${this.figmaHost}/files/${o.fileKey}/nodes`, o) } else { url = this.opToUrl(`${this.figmaHost}/files/${o.fileKey}`, o) } return this.fetch(url) }
- src/server/figma/types/figma.ts:1-10 (schema)TypeScript interface defining the input parameters (GetFileParams) used by the api.files helper.export interface GetFileParams { fileKey: string ids?: string version?: string depth?: number geometry?: 'paths' plugin_data?: string branch_data?: boolean personalToken?: string }