Skip to main content
Glama
paragdesai1

Cursor Talk to Figma MCP

by paragdesai1

get_local_components

Retrieve all local components from a Figma document to access reusable design elements within the Cursor AI and Figma integration.

Instructions

Get all local components from the Figma document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP server tool registration. Defines the tool schema (empty params) and handler function that forwards the request to the Figma plugin via sendCommandToFigma WebSocket proxy.
    // Get Local Components Tool 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) }`, }, ], }; } } );
  • Core implementation of get_local_components in the Figma plugin. Loads all pages and finds all COMPONENT nodes using figma.root.findAllWithCriteria, returns count and list with id, name, key.
    async function getLocalComponents() { await figma.loadAllPagesAsync(); 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, })), }; }
  • Dispatch registration in Figma plugin's handleCommand switch that calls the getLocalComponents handler.
    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/paragdesai1/parag-Figma-MCP'

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