get_file_nodes
Retrieve specific design elements from a Figma file using node IDs to access components, layers, or frames for analysis or integration.
Instructions
Get specific nodes from a Figma file
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fileKey | Yes | The key of the file to get nodes from | |
| node_ids | Yes | Array of node IDs to get | |
| depth | No | Optional. Depth of nodes to return (1-4) | |
| version | No | Optional. A specific version ID to get |
Implementation Reference
- src/handlers/files.ts:28-37 (handler)The core handler function getFileNodes that executes the tool logic by calling the Figma API /files/{fileKey}/nodes endpoint with joined node_ids.async getFileNodes(args: GetFileNodesArgs) { const { fileKey, node_ids, ...otherParams } = args; const params: Record<string, string | number | boolean | undefined> = { ...otherParams, ids: node_ids.join(',') }; return this.api.makeRequest(`/files/${fileKey}/nodes${this.api.buildQueryString(params)}`); }
- src/index.ts:141-166 (registration)Tool registration in the list of tools provided by the MCP server, including name, description, and input schema.name: 'get_file_nodes', description: 'Get specific nodes from a Figma file', inputSchema: { type: 'object', properties: { fileKey: { type: 'string', description: 'The key of the file to get nodes from' }, node_ids: { type: 'array', items: { type: 'string' }, description: 'Array of node IDs to get' }, depth: { type: 'number', description: 'Optional. Depth of nodes to return (1-4)' }, version: { type: 'string', description: 'Optional. A specific version ID to get' } }, required: ['fileKey', 'node_ids'] }, },
- src/index.ts:498-504 (registration)Dispatch logic in the CallToolRequestHandler switch statement that handles 'get_file_nodes' tool calls by validating args and invoking the filesHandler.case 'get_file_nodes': { const args = this.validateArgs<GetFileNodesArgs>(request.params.arguments, ['fileKey', 'node_ids']); const result = await this.filesHandler.getFileNodes(args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- src/types/files.ts:8-11 (schema)TypeScript interface defining the input arguments for the get_file_nodes tool.export interface GetFileNodesArgs extends BaseParams { fileKey: string; node_ids: string[]; }