Skip to main content
Glama
andreycretsu

Cursor Talk to Figma MCP

by andreycretsu

set_layout_sizing

Configure horizontal and vertical sizing modes for auto-layout frames in Figma designs, enabling precise control over 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', including schema definition (zod input validation) and handler function that proxies the command to the Figma plugin via sendCommandToFigma.
    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)}`,
              },
            ],
          };
        }
      }
    );
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 'Set[s]' modes, implying a mutation operation, but does not cover critical aspects like whether this requires specific permissions, if changes are reversible, potential side effects, or error handling. This leaves significant gaps in understanding the tool's behavior beyond the basic action.

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 with the core action and target, making it easy to parse quickly, which is ideal for conciseness in tool descriptions.

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 insufficient. It lacks details on behavioral traits, error conditions, return values, or how it integrates with sibling tools. For a tool that modifies layout settings, more context is needed to ensure safe and effective use by an agent.

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 clear documentation for all parameters, including enums and constraints. The description does not add any semantic details beyond what the schema provides, such as explaining the practical implications of 'HUG' vs 'FILL' modes. Thus, it meets the baseline for adequate but not enhanced parameter understanding.

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 ('horizontal and vertical sizing modes for an auto-layout frame in Figma'), making the purpose evident. However, it does not explicitly differentiate this tool from sibling tools like 'set_layout_mode' or 'resize_node', which might also involve layout adjustments, leaving some ambiguity about its unique role.

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. With siblings like 'set_layout_mode' and 'resize_node' that could relate to layout changes, there is no mention of specific contexts, prerequisites, or exclusions, leaving the agent to infer usage without explicit 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/andreycretsu/cursor-talk-to-figma-mcp-main'

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