Skip to main content
Glama

Cursor Talk to Figma MCP

by paragdesai1

get_selection

Retrieve details about the currently selected elements in Figma, enabling efficient design workflow integration between Cursor AI and Figma.

Instructions

Get information about the current selection in Figma

Input Schema

NameRequiredDescriptionDefault

No arguments

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": {}, "type": "object" }

Implementation Reference

  • The core handler function for the 'get_selection' tool. It retrieves the current page selection in Figma and returns the count along with basic details (id, name, type, visible) for each selected node.
    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, })), }; }
  • MCP server registration of the 'get_selection' tool. Defines the tool name, description, empty input schema, and handler that proxies the command to the Figma plugin via WebSocket.
    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) }`, }, ], }; } } );
  • Dispatch case in handleCommand function that routes 'get_selection' commands to the getSelection handler.
    case "get_selection": return await getSelection();
  • Empty input schema for the 'get_selection' tool (no parameters required).
    {},

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