Skip to main content
Glama

set_layout_sizing

Configure horizontal and vertical sizing modes for auto-layout frames in Figma to control how elements adapt to content or fill available space.

Instructions

Set horizontal and vertical sizing modes for an auto-layout frame in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the frame to modify
layoutSizingHorizontalNoHorizontal sizing mode (HUG for frames/text only, FILL for auto-layout children only)
layoutSizingVerticalNoVertical sizing mode (HUG for frames/text only, FILL for auto-layout children only)

Implementation Reference

  • MCP tool registration for 'set_layout_sizing'. Includes inline schema (zod validation for params: nodeId (string), layoutSizingHorizontal/FILL (optional enums FIXED/HUG/FILL)) and handler function that forwards the set_layout_sizing command to the underlying Figma plugin via sendCommandToFigma, returning success/error messages.
    server.tool(
      "set_layout_sizing",
      "Set horizontal and vertical sizing modes for an auto-layout frame in Figma",
      {
        nodeId: z.string().describe("The ID of the frame to modify"),
        layoutSizingHorizontal: z
          .enum(["FIXED", "HUG", "FILL"])
          .optional()
          .describe("Horizontal sizing mode (HUG for frames/text only, FILL for auto-layout children only)"),
        layoutSizingVertical: z
          .enum(["FIXED", "HUG", "FILL"])
          .optional()
          .describe("Vertical sizing mode (HUG for frames/text only, FILL for auto-layout children only)")
      },
      async ({ nodeId, layoutSizingHorizontal, layoutSizingVertical }) => {
        try {
          const result = await sendCommandToFigma("set_layout_sizing", {
            nodeId,
            layoutSizingHorizontal,
            layoutSizingVertical
          });
          const typedResult = result as { name: string };
    
          // Create a message about which sizing modes were set
          const sizingMessages = [];
          if (layoutSizingHorizontal !== undefined) sizingMessages.push(`horizontal: ${layoutSizingHorizontal}`);
          if (layoutSizingVertical !== undefined) sizingMessages.push(`vertical: ${layoutSizingVertical}`);
    
          const sizingText = sizingMessages.length > 0
            ? `layout sizing (${sizingMessages.join(', ')})`
            : "layout sizing";
    
          return {
            content: [
              {
                type: "text",
                text: `Set ${sizingText} for frame "${typedResult.name}"`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error setting layout sizing: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv1.0.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / layoutSizingHorizontal
      Added value: +{
      +  "description": "Horizontal sizing mode (HUG for frames/text only, FILL for auto-layout children only)",
      +  "enum": [
      +    "FIXED",
      +    "HUG",
      +    "FILL"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / layoutSizingVertical
      Added value: +{
      +  "description": "Vertical sizing mode (HUG for frames/text only, FILL for auto-layout children only)",
      +  "enum": [
      +    "FIXED",
      +    "HUG",
      +    "FILL"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / nodeId
      Added value: +{
      +  "description": "The ID of the frame to modify",
      +  "type": "string"
      +}
    • addedInput schema / required
      Added value: +[
      +  "nodeId"
      +]
  2. First observed

TDQS

B3.3/5.0
Behavior2/5

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

There are no annotations, so the description carries the burden of disclosing behavioral traits. It does not mention side effects, constraints, error handling, or what happens if the target node is not an auto-layout frame. The only hint is that the target is an auto-layout frame, but this is more a target description than a behavioral disclosure.

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?

A single, compact sentence that conveys the tool's purpose without extraneous details. It is well-structured and front-loaded, making it easy for an agent to quickly understand the action.

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?

The tool is a simple setter with 3 well-described parameters and no output schema. The description is adequate for basic use but lacks details about failure modes, prerequisites (e.g., node must be an auto-layout frame), or interactions with other layout settings. Given the simplicity, it meets the minimum viable threshold.

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%, with each parameter fully described (nodeId, layoutSizingVertical, layoutSizingHorizontal) including enum constraints and special conditions (e.g., HUG for frames/text only, FILL for auto-layout children). The description adds no additional parameter semantics beyond what the schema already provides, so the baseline 3 applies.

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 clearly states the action ('Set') and the resource ('horizontal and vertical sizing modes for an auto-layout frame in Figma'). This distinguishes it from sibling tools like set_layout_mode, which focuses on layout direction rather than sizing modes. The mention of both horizontal and vertical adds specificity.

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 is provided about when to use this tool versus alternatives. It does not mention that this is specifically for auto-layout frames (though implied) or that it complements set_layout_mode or set_padding. No exclusions or alternative tool mentions exist.

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