flatten_node
Flatten Figma nodes to prepare them for boolean operations or convert them to paths, enabling advanced design modifications.
Instructions
Flatten a node in Figma (e.g., for boolean operations or converting to path)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | ID of the node to flatten |
Implementation Reference
- Full MCP tool registration including schema, description, and handler function for 'flatten_node'. The handler sends a 'flatten_node' command to the Figma plugin via websocket and formats the response.server.tool( "flatten_node", "Flatten a node in Figma (e.g., for boolean operations or converting to path)", { nodeId: z.string().describe("ID of the node to flatten"), }, async ({ nodeId }) => { try { const result = await sendCommandToFigma("flatten_node", { nodeId }); const typedResult = result as { id: string, name: string, type: string }; return { content: [ { type: "text", text: `Node "${typedResult.name}" flattened successfully. The new node has ID: ${typedResult.id} and is of type ${typedResult.type}.` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error flattening node: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- src/talk_to_figma_mcp/tools/index.ts:15-15 (registration)Calls registerCreationTools which registers the flatten_node tool among others.registerCreationTools(server);
- Includes 'flatten_node' in the FigmaCommand type union for type safety in websocket communications.| "flatten_node"