Skip to main content
Glama
ArchimedesCrypto

Figma MCP Server with Chunking

get_styles

Extract styles from a Figma file using a memory-efficient MCP server, enabling handling of large files with chunking and pagination for optimized performance.

Instructions

Get styles from a Figma file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_keyYesFigma file key

Implementation Reference

  • src/index.ts:206-219 (registration)
    Registration of the 'get_styles' tool in the ListTools handler, including name, description, and input schema definition.
    {
      name: 'get_styles',
      description: 'Get styles from a Figma file',
      inputSchema: {
        type: 'object',
        properties: {
          file_key: {
            type: 'string',
            description: 'Figma file key'
          }
        },
        required: ['file_key']
      }
    },
  • MCP tool handler for 'get_styles': validates file_key argument, calls figmaClient.getStyles(), and returns JSON response.
    case 'get_styles': {
      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 styles', {
        fileKey: args.file_key,
      });
      const data = await this.figmaClient.getStyles(args.file_key);
      return {
        content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
      };
    }
  • Core implementation of getStyles in ChunkedFigmaClient: makes API call to Figma /files/{fileKey}/styles endpoint and returns the data.
    async getStyles(fileKey: string) {
      try {
        console.debug('[MCP Debug] Getting styles for file:', fileKey);
        const response = await this.client.get(`/files/${fileKey}/styles`);
        
        if (this.nodeProcessor.hasReachedLimit()) {
          console.debug('[MCP Debug] Memory limit reached while processing styles');
          throw new Error('Memory limit exceeded while processing styles');
        }
    
        return response.data;
      } catch (error) {
        console.error('[MCP Error] Failed to get styles:', error);
        throw error;
      }
    }
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