get_selection
Retrieve details about currently selected elements in Figma to inspect properties, manage components, or sync design data with code.
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/tools/document-tools.ts:20-46 (registration)Registration of the MCP 'get_selection' tool, including description, empty input schema ({}), and inline handler function that executes sendCommandToFigma('get_selection') to retrieve Figma selection info and returns it as JSON text content, with error handling.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 core handler function for the 'get_selection' tool. Sends 'get_selection' command to Figma plugin via websocket, stringifies the result as text content, or returns error message if failed.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)}`, }, ], }; } }