Skip to main content
Glama

create_rectangle

Add rectangular shapes to Figma designs by specifying position, dimensions, and optional parent elements for precise layout control.

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 async handler function that executes the 'create_rectangle' tool logic. It forwards the parameters to Figma via sendCommandToFigma and returns a textual response with the result or error.
    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 input schema defining 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"),
    },
  • Direct registration of the 'create_rectangle' MCP tool via server.tool(), specifying name, description, input schema, and handler.
      "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)}`,
              },
            ],
          };
        }
      }
    );
  • Higher-level registration call to registerCreationTools(server), which includes the create_rectangle tool, as part of all tools registration.
    registerCreationTools(server);
  • Top-level call to registerTools(server) in the main server initialization, which chains to registering the create_rectangle tool.
    registerTools(server);

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.1/5.0
Behavior1/5

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

With no annotations provided, the description must carry the full burden of behavioral disclosure. It only restates the name and domain ('Create a new rectangle in Figma') and does not mention side effects, default parent behavior, mutation, permissions, or reversibility. This adds no value beyond the purpose clarity.

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 concise sentence with no redundancy. It front-loads the core purpose effectively, and every word earns its place, making it appropriately sized for a simple creation tool.

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 description alone is minimal but sufficient for a basic create operation given the schema covers all parameters. However, it lacks context about default behaviors (e.g., what happens if parentId is omitted) and does not enrich the overall workflow. It is a minimum viable description.

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 (e.g., x, y, width, height, name, parentId). The description adds no parameter semantics beyond the schema, meeting the baseline of 3 as the schema does the heavy lifting.

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 uses the specific verb 'Create' with the resource 'rectangle' and context 'Figma', clearly distinguishing it from sibling tools like create_frame or create_text. The purpose is unambiguous and directly tied to the tool's name.

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 choose this tool over alternatives such as create_frame or create_text. The description only states the action without contextual use cases, exclusions, or comparisons to sibling creation tools.

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