Skip to main content
Glama

set_layout_mode

Configure auto-layout settings for Figma frames to control child element arrangement and wrapping behavior.

Instructions

Set the layout mode and wrap behavior of a frame in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the frame to modify
layoutModeYesLayout mode for the frame
layoutWrapNoWhether the auto-layout frame wraps its children

Implementation Reference

  • Registration of the 'set_layout_mode' MCP tool, including schema definition and handler function that proxies the command to the Figma plugin.
    server.tool(
      "set_layout_mode",
      "Set the layout mode and wrap behavior of a frame in Figma",
      {
        nodeId: z.string().describe("The ID of the frame to modify"),
        layoutMode: z.enum(["NONE", "HORIZONTAL", "VERTICAL"]).describe("Layout mode for the frame"),
        layoutWrap: z.enum(["NO_WRAP", "WRAP"]).optional().describe("Whether the auto-layout frame wraps its children")
      },
      async ({ nodeId, layoutMode, layoutWrap }) => {
        try {
          const result = await sendCommandToFigma("set_layout_mode", {
            nodeId,
            layoutMode,
            layoutWrap: layoutWrap || "NO_WRAP"
          });
          const typedResult = result as { name: string };
          return {
            content: [
              {
                type: "text",
                text: `Set layout mode of frame "${typedResult.name}" to ${layoutMode}${layoutWrap ? ` with ${layoutWrap}` : ''}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error setting layout mode: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
  • The handler function for the set_layout_mode tool. It sends the parameters to the Figma plugin using sendCommandToFigma and formats the response.
    async ({ nodeId, layoutMode, layoutWrap }) => {
      try {
        const result = await sendCommandToFigma("set_layout_mode", {
          nodeId,
          layoutMode,
          layoutWrap: layoutWrap || "NO_WRAP"
        });
        const typedResult = result as { name: string };
        return {
          content: [
            {
              type: "text",
              text: `Set layout mode of frame "${typedResult.name}" to ${layoutMode}${layoutWrap ? ` with ${layoutWrap}` : ''}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error setting layout mode: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • Zod input schema for the set_layout_mode tool defining parameters: nodeId (required), layoutMode (enum: NONE/HORIZONTAL/VERTICAL), layoutWrap (optional enum).
    {
      nodeId: z.string().describe("The ID of the frame to modify"),
      layoutMode: z.enum(["NONE", "HORIZONTAL", "VERTICAL"]).describe("Layout mode for the frame"),
      layoutWrap: z.enum(["NO_WRAP", "WRAP"]).optional().describe("Whether the auto-layout frame wraps its children")

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv1.0.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / layoutMode
      Added value: +{
      +  "description": "Layout mode for the frame",
      +  "enum": [
      +    "NONE",
      +    "HORIZONTAL",
      +    "VERTICAL"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / layoutWrap
      Added value: +{
      +  "description": "Whether the auto-layout frame wraps its children",
      +  "enum": [
      +    "NO_WRAP",
      +    "WRAP"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / nodeId
      Added value: +{
      +  "description": "The ID of the frame to modify",
      +  "type": "string"
      +}
    • addedInput schema / required
      Added value: +[
      +  "nodeId",
      +  "layoutMode"
      +]
  2. First observed

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations provided, the description carries full responsibility for disclosing behavioral traits. It states what is changed (layout mode and wrap) but omits side effects, such as whether existing children are rearranged, whether the frame must already be a frame/auto-layout, or whether setting NONE disables auto-layout entirely. The optional layoutWrap behavior is also left implicit.

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, concise sentence that immediately states the verb and target. No wasted words or redundant information. Front-loaded and easy to scan.

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

Completeness3/5

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

For a simple setter tool with a fully self-explanatory schema, the description covers the basics. However, it lacks usage context and behavioral caveats (e.g., what 'wrap behavior' means visually or how layoutMode NONE interacts with children). Given no annotations or output schema, the description could have added a bit more context to reach full completeness.

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?

Schema description coverage is 100%, so the schema already documents all three parameters (nodeId, layoutMode, layoutWrap) with meaningful descriptions and enums. The description adds no extra semantic meaning beyond what the schema provides, but it also does not need to, hence baseline 3.

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

Purpose5/5

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

The description uses a specific verb ('Set') and names the exact resource ('layout mode and wrap behavior of a frame'). It clearly distinguishes from sibling tools like set_layout_sizing or set_item_spacing, which target different aspects of layout.

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?

No guidance on when to use this tool vs. alternatives. The description merely states the action without providing context, prerequisites, or exclusions. For example, it does not mention that this is for frames with auto-layout enabled or that set_layout_sizing handles sizing dimensions.

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