Skip to main content
Glama
arinspunk

Claude Talk to Figma MCP

by arinspunk

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
NameRequiredDescriptionDefault
nodeIdYesID 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)}`
              }
            ]
          };
        }
      }
    );
  • 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"

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/arinspunk/claude-talk-to-figma-mcp'

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