get_selection
Retrieve details about the currently selected elements in Figma for targeted design analysis and integration via the Talk to Figma MCP server.
Instructions
Get information about the current selection in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/talk_to_figma_mcp/server.ts:125-152 (handler)The MCP tool registration and handler implementation for 'get_selection'. It sends a 'get_selection' command to the Figma plugin via WebSocket (using sendCommandToFigma helper), receives the result, and returns it as a JSON-formatted text content block. Handles errors by returning 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) }`, }, ], }; } } );