Skip to main content
Glama

flatten_node

Flatten Figma nodes to enable boolean operations or convert them to paths for design manipulation.

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

  • Registration of the MCP tool 'flatten_node'. Includes the tool name, description, Zod input schema (nodeId: string), and the handler function which sends the 'flatten_node' command to Figma via sendCommandToFigma and returns a text response with the result or error.
    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)}`
              }
            ]
          };
        }
      }
    );
  • The handler function for the flatten_node tool. It calls sendCommandToFigma with the nodeId, type-asserts the result, and returns a standardized MCP text response indicating success with new node details or an error message.
    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 a single 'nodeId' parameter as string, with description.
    {
      nodeId: z.string().describe("ID of the node to flatten"),
    },
  • 'flatten_node' is included in the FigmaCommand union type, indicating it's a recognized command for sending to Figma.
    | "flatten_node"
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Flatten') but doesn't explain what flattening entails (e.g., whether it's destructive, irreversible, or affects node hierarchy), nor does it mention permissions, rate limits, or response format. This leaves significant gaps for a mutation tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Flatten a node in Figma') and provides clarifying examples in parentheses. Every word earns its place, with no redundancy or unnecessary elaboration, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., destructiveness), error conditions, or what the tool returns. While concise, it doesn't provide enough context for safe and effective use in a Figma design environment.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with 'nodeId' clearly documented. The description adds no additional parameter semantics beyond what the schema provides, such as format requirements or examples. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't need to compensate but also adds no extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Flatten a node') and the target resource ('node in Figma'), with specific examples of use cases ('for boolean operations or converting to path'). It distinguishes from siblings like 'group_nodes' or 'ungroup_nodes' by focusing on transformation rather than grouping. However, it doesn't explicitly differentiate from all siblings (e.g., 'export_node_as_image' also transforms nodes).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions example use cases but doesn't specify prerequisites, constraints, or when other tools might be more appropriate. For instance, it doesn't clarify when flattening is preferred over other node operations like 'clone_node' or 'resize_node'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/agenisea/cc-fig-mcp'

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