Skip to main content
Glama

get_file_styles

Retrieve style definitions from Figma files to access color palettes, typography settings, and design tokens for consistent implementation.

Instructions

Get styles from a file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileKeyYesThe key of the file to get styles from

Implementation Reference

  • The core handler function implementing the get_file_styles tool. It extracts the fileKey from args and makes an API request to Figma's /files/{fileKey}/styles endpoint.
    async getFileStyles(args: GetFileStylesArgs) {
      const { fileKey } = args;
      
      return this.api.makeRequest(`/files/${fileKey}/styles`);
    }
  • TypeScript interface defining the input arguments for the get_file_styles tool: requires a fileKey string.
    export interface GetFileStylesArgs {
      fileKey: string;
    }
  • src/index.ts:433-446 (registration)
    MCP tool registration including name, description, and input schema matching GetFileStylesArgs.
    {
      name: 'get_file_styles',
      description: 'Get styles from a file',
      inputSchema: {
        type: 'object',
        properties: {
          fileKey: {
            type: 'string',
            description: 'The key of the file to get styles from'
          }
        },
        required: ['fileKey']
      },
    },
  • Dispatch handler in the main CallToolRequestHandler switch statement that validates args and delegates to projectsHandler.getFileStyles.
    case 'get_file_styles': {
      const args = this.validateArgs<GetFileStylesArgs>(request.params.arguments, ['fileKey']);
      const result = await this.projectsHandler.getFileStyles(args);
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }

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