Skip to main content
Glama
paragdesai1

Cursor Talk to Figma MCP

by paragdesai1

get_selection

Retrieve details about currently selected elements in Figma designs to enable programmatic reading and modification through Cursor AI integration.

Instructions

Get information about the current selection in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the MCP tool 'get_selection'. The handler is a thin proxy that calls sendCommandToFigma("get_selection") via WebSocket to the Figma plugin and returns the result as text content.
    server.tool( "get_selection", "Get information about the current selection in Figma", {}, async () => { try { const result = await sendCommandToFigma("get_selection"); return { content: [ { type: "text", text: JSON.stringify(result) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting selection: ${error instanceof Error ? error.message : String(error) }`, }, ], }; } } );
  • Core handler implementation in Figma plugin. Returns the count of selected nodes and array of basic info objects (id, name, type, visible) from figma.currentPage.selection.
    async function getSelection() { return { selectionCount: figma.currentPage.selection.length, selection: figma.currentPage.selection.map((node) => ({ id: node.id, name: node.name, type: node.type, visible: node.visible, })), }; }
  • Dispatch in handleCommand switch statement that routes 'get_selection' commands to the getSelection() handler.
    case "get_selection": return await getSelection();

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