Skip to main content
Glama
yhc984
by yhc984

get_local_components

Retrieve all local components from a Figma document to access and manage design elements programmatically using the Talk to Figma MCP server.

Instructions

Get all local components from the Figma document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that executes the 'get_local_components' tool logic: finds all COMPONENT nodes in the Figma document root and returns a 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, })), }; }
  • MCP server registration of the 'get_local_components' tool, which has no input schema and proxies the command to the Figma plugin via sendCommandToFigma, formatting the result 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)}` } ] }; } } );
  • Dispatch handler in the plugin's command switch statement that routes 'get_local_components' calls to the getLocalComponents function.
    case "get_local_components": return await getLocalComponents();

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/yhc984/cursor-talk-to-figma-mcp-main'

If you have feedback or need assistance with the MCP directory API, please join our Discord server