Skip to main content
Glama

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
NameRequiredDescriptionDefault
fileKeyYesThe key of the file to get nodes from
node_idsYesArray of node IDs to get
depthNoOptional. Depth of nodes to return (1-4)
versionNoOptional. A specific version ID to get

Implementation Reference

  • 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) }],
      };
    }
  • TypeScript interface defining the input arguments for the get_file_nodes tool.
    export interface GetFileNodesArgs extends BaseParams {
      fileKey: string;
      node_ids: string[];
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/smithery-ai/mcp-figma'

If you have feedback or need assistance with the MCP directory API, please join our Discord server