Skip to main content
Glama

get_file_components

Extract reusable design components from Figma files to maintain consistency across projects and streamline UI development workflows.

Instructions

Get components from a file

Input Schema

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

Implementation Reference

  • The core handler function that destructures the fileKey from args and calls the Figma API to retrieve components from the specified file.
    async getFileComponents(args: GetFileComponentsArgs) {
      const { fileKey } = args;
      
      return this.api.makeRequest(`/files/${fileKey}/components`);
    }
  • TypeScript interface defining the input parameters for the get_file_components tool, requiring a fileKey string.
    export interface GetFileComponentsArgs {
      fileKey: string;
    }
  • src/index.ts:361-374 (registration)
    Registers the get_file_components tool in the MCP server, including name, description, and input schema specification.
    {
      name: 'get_file_components',
      description: 'Get components from a file',
      inputSchema: {
        type: 'object',
        properties: {
          fileKey: {
            type: 'string',
            description: 'The key of the file to get components from'
          }
        },
        required: ['fileKey']
      },
    },
  • src/index.ts:570-576 (registration)
    Dispatcher in the tool request handler that validates arguments, calls the projectsHandler.getFileComponents method, and returns the result as JSON text.
    case 'get_file_components': {
      const args = this.validateArgs<GetFileComponentsArgs>(request.params.arguments, ['fileKey']);
      const result = await this.projectsHandler.getFileComponents(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