Skip to main content
Glama
andreycretsu

Cursor Talk to Figma MCP

by andreycretsu

set_layout_mode

Configure auto-layout settings for Figma frames by setting layout direction and wrap behavior to organize design elements systematically.

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

  • Handler function for the 'set_layout_mode' MCP tool. Forwards the request to the Figma plugin via 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 defining parameters for the 'set_layout_mode' tool: nodeId (required string), layoutMode (enum: NONE/HORIZONTAL/VERTICAL), layoutWrap (optional enum: NO_WRAP/WRAP).
      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")
    },
  • MCP tool registration via server.tool call, including name, description, schema, and handler function.
    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)}`,
              },
            ],
          };
        }
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states this is a mutation ('Set'), implying it modifies data, but doesn't disclose behavioral traits like whether changes are reversible, permission requirements, side effects on child elements, or error conditions. This is inadequate 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 with zero waste. It's front-loaded with the core purpose and appropriately sized for the tool's complexity.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It lacks critical context like what the tool returns, error handling, or how it interacts with other layout tools. The high schema coverage helps, but doesn't compensate for missing behavioral and output information.

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 fully documents all parameters. The description adds no additional meaning beyond what's in the schema—it doesn't explain parameter interactions, default behaviors, or practical examples. Baseline 3 is appropriate when the schema does the heavy lifting.

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 target ('layout mode and wrap behavior of a frame in Figma'), providing a specific verb+resource combination. However, it doesn't explicitly distinguish this tool from similar sibling tools like 'set_layout_sizing' or 'set_item_spacing', which also configure layout properties.

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 doesn't mention prerequisites (e.g., requires a frame node), exclusions, or compare it to related tools like 'set_layout_sizing' for sizing behavior or 'create_frame' for initial setup.

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