Skip to main content
Glama
andreycretsu

Cursor Talk to Figma MCP

by andreycretsu

create_rectangle

Add a rectangle to Figma designs by specifying position, dimensions, and optional parent node for automated design creation.

Instructions

Create a new rectangle in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX position
yYesY position
widthYesWidth of the rectangle
heightYesHeight of the rectangle
nameNoOptional name for the rectangle
parentIdNoOptional parent node ID to append the rectangle to

Implementation Reference

  • The handler function for the 'create_rectangle' MCP tool. It forwards the parameters to the Figma plugin via sendCommandToFigma and returns a success or error message with the result.
      async ({ x, y, width, height, name, parentId }) => {
        try {
          const result = await sendCommandToFigma("create_rectangle", {
            x,
            y,
            width,
            height,
            name: name || "Rectangle",
            parentId,
          });
          return {
            content: [
              {
                type: "text",
                text: `Created rectangle "${JSON.stringify(result)}"`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error creating rectangle: ${error instanceof Error ? error.message : String(error)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Zod schema defining the input parameters for the 'create_rectangle' tool: x, y, width, height, optional name and parentId.
      x: z.number().describe("X position"),
      y: z.number().describe("Y position"),
      width: z.number().describe("Width of the rectangle"),
      height: z.number().describe("Height of the rectangle"),
      name: z.string().optional().describe("Optional name for the rectangle"),
      parentId: z
        .string()
        .optional()
        .describe("Optional parent node ID to append the rectangle to"),
    },
  • Registration of the 'create_rectangle' MCP tool using server.tool(), including name, description, schema, and inline handler.
    server.tool(
      "create_rectangle",
      "Create a new rectangle in Figma",
      {
        x: z.number().describe("X position"),
        y: z.number().describe("Y position"),
        width: z.number().describe("Width of the rectangle"),
        height: z.number().describe("Height of the rectangle"),
        name: z.string().optional().describe("Optional name for the rectangle"),
        parentId: z
          .string()
          .optional()
          .describe("Optional parent node ID to append the rectangle to"),
      },
      async ({ x, y, width, height, name, parentId }) => {
        try {
          const result = await sendCommandToFigma("create_rectangle", {
            x,
            y,
            width,
            height,
            name: name || "Rectangle",
            parentId,
          });
          return {
            content: [
              {
                type: "text",
                text: `Created rectangle "${JSON.stringify(result)}"`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error creating rectangle: ${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. 'Create a new rectangle' implies a write operation, but it doesn't specify permissions needed, whether the creation is reversible, how it interacts with the Figma document (e.g., layer ordering), or what happens on success/failure. This leaves significant gaps for a mutation tool with no 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 front-loads the core purpose without unnecessary words. It's appropriately sized for a straightforward tool, with zero waste or redundancy.

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 incomplete. It lacks details on behavioral traits (e.g., effects, permissions), usage context relative to siblings, and expected return values, leaving the agent with insufficient information for reliable invocation.

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 parameters (x, y, width, height, name, parentId) with basic descriptions. The description adds no additional meaning beyond implying creation occurs in Figma, which is redundant with the schema's context. Baseline 3 is appropriate when the schema handles parameter documentation adequately.

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 a new rectangle') and resource ('in Figma'), making the purpose immediately understandable. However, it doesn't differentiate this tool from similar creation tools like 'create_frame' or 'create_component_instance' among the siblings, which would require more specific context about what makes a rectangle distinct.

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 'create_frame' and 'create_component_instance', there's no indication of when a rectangle is preferred over other shape or container types, nor any mention of prerequisites or exclusions for its use.

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