Skip to main content
Glama
yhc984

Talk to Figma MCP

by yhc984

create_frame

Create a new frame in Figma designs with customizable position, size, colors, and layout properties to structure UI elements.

Instructions

Create a new frame in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX position
yYesY position
widthYesWidth of the frame
heightYesHeight of the frame
nameNoOptional name for the frame
parentIdNoOptional parent node ID to append the frame to
fillColorNoFill color in RGBA format
strokeColorNoStroke color in RGBA format
strokeWeightNoStroke weight
layoutModeNoAuto-layout mode for the frame
layoutWrapNoWhether the auto-layout frame wraps its children
paddingTopNoTop padding for auto-layout frame
paddingRightNoRight padding for auto-layout frame
paddingBottomNoBottom padding for auto-layout frame
paddingLeftNoLeft padding for auto-layout frame
primaryAxisAlignItemsNoPrimary axis alignment for auto-layout frame. Note: When set to SPACE_BETWEEN, itemSpacing will be ignored as children will be evenly spaced.
counterAxisAlignItemsNoCounter axis alignment for auto-layout frame
layoutSizingHorizontalNoHorizontal sizing mode for auto-layout frame
layoutSizingVerticalNoVertical sizing mode for auto-layout frame
itemSpacingNoDistance between children in auto-layout frame. Note: This value will be ignored if primaryAxisAlignItems is set to SPACE_BETWEEN.

Implementation Reference

  • Core handler function that executes the create_frame logic using the Figma API: creates a frame, sets position/size/name, appends to parent or page, returns node info.
    async function createFrame(params) {
      const {
        x = 0,
        y = 0,
        width = 100,
        height = 100,
        name = "Frame",
        parentId,
      } = params || {};
    
      const frame = figma.createFrame();
      frame.x = x;
      frame.y = y;
      frame.resize(width, height);
      frame.name = name;
    
      // If parentId is provided, append to that node, otherwise append to current page
      if (parentId) {
        const parentNode = await figma.getNodeByIdAsync(parentId);
        if (!parentNode) {
          throw new Error(`Parent node not found with ID: ${parentId}`);
        }
        if (!("appendChild" in parentNode)) {
          throw new Error(`Parent node does not support children: ${parentId}`);
        }
        parentNode.appendChild(frame);
      } else {
        figma.currentPage.appendChild(frame);
      }
    
      return {
        id: frame.id,
        name: frame.name,
        x: frame.x,
        y: frame.y,
        width: frame.width,
        height: frame.height,
        parentId: frame.parent ? frame.parent.id : undefined,
      };
    }
  • Command dispatcher in Figma plugin that routes 'create_frame' requests to the createFrame handler.
    case "create_frame":
      return await createFrame(params);
  • MCP tool registration for 'create_frame', including Zod input schema and proxy handler that forwards to Figma plugin.
    server.tool(
      "create_frame",
      "Create a new frame in Figma",
      {
        x: z.number().describe("X position"),
        y: z.number().describe("Y position"),
        width: z.number().describe("Width of the frame"),
        height: z.number().describe("Height of the frame"),
        name: z.string().optional().describe("Optional name for the frame"),
        parentId: z.string().optional().describe("Optional parent node ID to append the frame to"),
        fillColor: z.object({
          r: z.number().min(0).max(1).describe("Red component (0-1)"),
          g: z.number().min(0).max(1).describe("Green component (0-1)"),
          b: z.number().min(0).max(1).describe("Blue component (0-1)"),
          a: z.number().min(0).max(1).optional().describe("Alpha component (0-1)")
        }).optional().describe("Fill color in RGBA format"),
        strokeColor: z.object({
          r: z.number().min(0).max(1).describe("Red component (0-1)"),
          g: z.number().min(0).max(1).describe("Green component (0-1)"),
          b: z.number().min(0).max(1).describe("Blue component (0-1)"),
          a: z.number().min(0).max(1).optional().describe("Alpha component (0-1)")
        }).optional().describe("Stroke color in RGBA format"),
        strokeWeight: z.number().positive().optional().describe("Stroke weight")
      },
      async ({ x, y, width, height, name, parentId, fillColor, strokeColor, strokeWeight }) => {
        try {
          const result = await sendCommandToFigma('create_frame', {
            x, y, width, height, name: name || 'Frame', parentId,
            fillColor: fillColor || { r: 1, g: 1, b: 1, a: 1 },
            strokeColor: strokeColor,
            strokeWeight: strokeWeight
          });
          const typedResult = result as { name: string, id: string };
          return {
            content: [
              {
                type: "text",
                text: `Created frame "${typedResult.name}" with ID: ${typedResult.id}. Use the ID as the parentId to appendChild inside this frame.`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error creating frame: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Zod schema defining input parameters for the create_frame tool.
    {
      x: z.number().describe("X position"),
      y: z.number().describe("Y position"),
      width: z.number().describe("Width of the frame"),
      height: z.number().describe("Height of the frame"),
      name: z.string().optional().describe("Optional name for the frame"),
      parentId: z.string().optional().describe("Optional parent node ID to append the frame to"),
      fillColor: z.object({
        r: z.number().min(0).max(1).describe("Red component (0-1)"),
        g: z.number().min(0).max(1).describe("Green component (0-1)"),
        b: z.number().min(0).max(1).describe("Blue component (0-1)"),
        a: z.number().min(0).max(1).optional().describe("Alpha component (0-1)")
      }).optional().describe("Fill color in RGBA format"),
      strokeColor: z.object({
        r: z.number().min(0).max(1).describe("Red component (0-1)"),
        g: z.number().min(0).max(1).describe("Green component (0-1)"),
        b: z.number().min(0).max(1).describe("Blue component (0-1)"),
        a: z.number().min(0).max(1).optional().describe("Alpha component (0-1)")
      }).optional().describe("Stroke color in RGBA format"),
      strokeWeight: z.number().positive().optional().describe("Stroke weight")
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Create a new frame' implies a write/mutation operation, but it doesn't specify permissions needed, whether it's destructive to existing content, rate limits, or what happens on success/failure. For a mutation tool with 20 parameters, this is a significant gap.

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 states the core purpose without unnecessary words. It's appropriately sized and front-loaded with the essential information.

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 complex mutation tool with 20 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what a frame is in Figma context, doesn't mention return values or error conditions, and provides no behavioral context beyond the basic action.

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 20 parameters thoroughly. The description adds no parameter information beyond what's in the schema, which is acceptable given the comprehensive schema documentation. 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 ('Create') and resource ('new frame in Figma'), making the purpose immediately understandable. It doesn't differentiate from sibling tools like create_rectangle or create_component_instance, which would require mentioning what distinguishes a frame from other node types.

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 on when to use this tool versus alternatives like create_rectangle or create_component_instance. The description doesn't mention prerequisites, context, or typical use cases for creating frames versus other node types.

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/yhc984/cursor-talk-to-figma-mcp-main'

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