flatten_node
Flatten nodes in Figma for boolean operations or converting to paths, enabling streamlined design adjustments through AI-assisted commands in the Claude Talk to Figma MCP server.
Instructions
Flatten a node in Figma (e.g., for boolean operations or converting to path)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- src/talk_to_figma_mcp/tools/creation-tools.ts:584-619 (registration)Registration of the MCP 'flatten_node' tool, including description, input schema (nodeId), and handler that forwards the flatten_node command to Figma via sendCommandToFigma 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)}` } ] }; } } );
- Zod input schema for the flatten_node tool: requires nodeId string.{ nodeId: z.string().describe("ID of the node to flatten"), },
- FigmaCommand type union includes "flatten_node" as a valid command type.| "flatten_node" | "insert_child";