Skip to main content
Glama

get_component

Retrieve Figma components by key to access design elements from files, enabling integration and reuse in projects.

Instructions

Get a component by key

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesThe component key

Implementation Reference

  • The core handler function for the 'get_component' tool. It extracts the component key from args and makes a GET request to Figma API endpoint `/components/${key}`.
    async getComponent(args: GetComponentArgs) {
      const { key } = args;
      
      return this.api.makeRequest(`/components/${key}`);
    }
  • TypeScript interface defining the input schema for the get_component tool, requiring a 'key' string.
    export interface GetComponentArgs {
      key: string;
    }
  • src/index.ts:376-388 (registration)
    Tool registration in the listTools response, including name, description, and input schema matching GetComponentArgs.
      name: 'get_component',
      description: 'Get a component by key',
      inputSchema: {
        type: 'object',
        properties: {
          key: {
            type: 'string',
            description: 'The component key'
          }
        },
        required: ['key']
      },
    },
  • src/index.ts:578-584 (registration)
    Dispatch logic in the CallToolRequest handler switch statement that validates args and calls the projectsHandler.getComponent method.
    case 'get_component': {
      const args = this.validateArgs<GetComponentArgs>(request.params.arguments, ['key']);
      const result = await this.projectsHandler.getComponent(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