get_local_components
Retrieve all local components from a Figma document to access reusable design elements for AI-assisted design workflows.
Instructions
Get all local components from the Figma document
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/talk_to_figma_mcp/tools/document-tools.ts:166-192 (registration)Registration and handler implementation of the 'get_local_components' MCP tool. The handler forwards the request to the Figma plugin using sendCommandToFigma and formats the response as text content.server.tool( "get_local_components", "Get all local components from the Figma document", {}, async () => { try { const result = await sendCommandToFigma("get_local_components"); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting local components: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );
- Inline handler function that executes the tool logic by calling sendCommandToFigma('get_local_components') and returning the result.async () => { try { const result = await sendCommandToFigma("get_local_components"); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting local components: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }
- The 'get_local_components' command is defined in the FigmaCommand type union, used for type safety in websocket communications.| "get_local_components"