Skip to main content
Glama
ArchimedesCrypto

Figma MCP Server with Chunking

get_components

Extract components from a Figma file using an API tool designed for handling large files efficiently with memory-aware chunking and pagination.

Instructions

Get components from a Figma file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_keyYesFigma file key

Implementation Reference

  • The core handler function in ChunkedFigmaClient class that executes the tool logic: fetches components from Figma API `/files/${fileKey}/components`, checks memory limit via nodeProcessor, returns the response data.
    async getComponents(fileKey: string) {
      try {
        console.debug('[MCP Debug] Getting components for file:', fileKey);
        const response = await this.client.get(`/files/${fileKey}/components`);
        
        if (this.nodeProcessor.hasReachedLimit()) {
          console.debug('[MCP Debug] Memory limit reached while processing components');
          throw new Error('Memory limit exceeded while processing components');
        }
    
        return response.data;
      } catch (error) {
        console.error('[MCP Error] Failed to get components:', error);
        throw error;
      }
    }
  • src/index.ts:192-205 (registration)
    Registers the 'get_components' tool in the MCP server's ListTools response, including name, description, and input schema requiring 'file_key'.
    {
      name: 'get_components',
      description: 'Get components from a Figma file',
      inputSchema: {
        type: 'object',
        properties: {
          file_key: {
            type: 'string',
            description: 'Figma file key'
          }
        },
        required: ['file_key']
      }
    },
  • The MCP server request handler for CallToolRequestSchema that dispatches 'get_components': validates input, calls figmaClient.getComponents, formats response as JSON text content.
    case 'get_components': {
      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 components', {
        fileKey: args.file_key,
      });
      const data = await this.figmaClient.getComponents(args.file_key);
      return {
        content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
      };
    }
  • Input schema definition for the 'get_components' tool, specifying object with required 'file_key' string property.
    inputSchema: {
      type: 'object',
      properties: {
        file_key: {
          type: 'string',
          description: 'Figma file key'
        }
      },
      required: ['file_key']
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

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/ArchimedesCrypto/figma-mcp-chunked'

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