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
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | The component key |
Implementation Reference
- src/handlers/projects.ts:44-48 (handler)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}`); }
- src/types/projects.ts:20-22 (schema)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) }], }; }