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")
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 tool modifies a frame, implying a mutation, but does not cover critical aspects like permissions needed, whether changes are reversible, error conditions, or what happens to existing settings. This is a significant gap for a mutation tool with zero 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 directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured.

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 that this is a mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits, error handling, and output expectations, which are crucial for an agent to use the tool effectively. The high schema coverage does not compensate for these gaps in context.

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 description mentions 'layout mode and wrap behavior', which aligns with the parameters 'layoutMode' and 'layoutWrap' in the schema. However, schema description coverage is 100%, so the schema already fully documents all parameters. The description adds minimal value beyond what the schema provides, justifying the baseline score of 3.

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 ('Set') and the target ('layout mode and wrap behavior of a frame in Figma'), making the purpose understandable. However, it does not explicitly differentiate this tool from sibling tools like 'set_layout_sizing' or 'set_item_spacing', which also modify layout properties, so it lacks sibling distinction.

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, such as other layout-related tools in the sibling list (e.g., 'set_layout_sizing' or 'set_item_spacing'). It also does not mention prerequisites, exclusions, or specific contexts for usage, leaving the agent without clear direction.

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/pipethedev/Talk-to-Figma-MCP'

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