get_local_components
Extract all local components from a Figma document to support AI-assisted design workflows, enabling efficient organization and reuse of design elements.
Instructions
Get all local components from the Figma document
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function for the 'get_local_components' tool. It sends a 'get_local_components' command to the Figma plugin via WebSocket and returns the result as JSON text content, with error handling.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)}`, }, ], }; } } );
- src/talk_to_figma_mcp/tools/document-tools.ts:166-192 (registration)The 'get_local_components' tool is registered here on the MCP server using server.tool(), with no input parameters ({} schema). The registration includes the inline handler.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)}`, }, ], }; } } );
- The tool command 'get_local_components' is included in the FigmaCommand type union, defining supported Figma plugin commands.| "get_local_components"