Skip to main content
Glama

get_selection

Retrieve details about currently selected elements in Figma designs to analyze or process them programmatically.

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 function proxies the call to Figma by invoking sendCommandToFigma('get_selection'), which sends the command over WebSocket to the Figma plugin. Returns the selection information as text content or an error message.
    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) }`, }, ], }; } } );
  • The handler is the inline async function that executes when the 'get_selection' tool is called. It sends the 'get_selection' command to the Figma plugin via sendCommandToFigma and formats the result as MCP content (JSON string of the selection data).
    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) }`, }, ], }; } } );

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/pipethedev/Talk-to-Figma-MCP'

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