get_local_components
Retrieve all local components from a Figma document to access reusable design elements for integration or modification.
Instructions
Get all local components from the Figma document
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/cursor_mcp_plugin/code.js:610-623 (handler)The core handler function that retrieves all local COMPONENT nodes from the Figma document root using findAllWithCriteria, and returns a structured list with count, ids, names, and keys.async function getLocalComponents() { const components = figma.root.findAllWithCriteria({ types: ["COMPONENT"], }); return { count: components.length, components: components.map((component) => ({ id: component.id, name: component.name, key: "key" in component ? component.key : null, })), }; }
- src/talk_to_figma_mcp/server.ts:473-499 (registration)MCP server registration of the 'get_local_components' tool, which proxies the command to the Figma plugin via WebSocket and formats the response as MCP 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, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting local components: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- src/cursor_mcp_plugin/code.js:91-92 (handler)Dispatch case in the Figma plugin's handleCommand function that routes 'get_local_components' to the getLocalComponents handler.case "get_local_components": return await getLocalComponents();
- Input schema for the tool (empty object, no parameters required).{},
- src/talk_to_figma_mcp/server.ts:772-772 (registration)Inclusion of 'get_local_components' in the FigmaCommand type union for TypeScript type safety.| 'get_local_components'