Skip to main content
Glama
arinspunk

Claude Talk to Figma MCP

by arinspunk

create_polygon

Create polygons in Figma designs by specifying position, dimensions, sides, colors, and stroke properties for geometric shapes.

Instructions

Create a new polygon in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX position
yYesY position
widthYesWidth of the polygon
heightYesHeight of the polygon
sidesNoNumber of sides (default: 6)
nameNoOptional name for the polygon
parentIdNoOptional parent node ID to append the polygon to
fillColorNoFill color in RGBA format
strokeColorNoStroke color in RGBA format
strokeWeightNoStroke weight

Implementation Reference

  • Handler function for the 'create_polygon' MCP tool. It constructs parameters with defaults and sends a websocket command to Figma using sendCommandToFigma, then returns success/error text response.
    async ({ x, y, width, height, sides, name, parentId, fillColor, strokeColor, strokeWeight }) => {
      try {
        const result = await sendCommandToFigma("create_polygon", {
          x,
          y,
          width,
          height,
          sides: sides || 6,
          name: name || "Polygon",
          parentId,
          fillColor,
          strokeColor,
          strokeWeight,
        });
        
        const typedResult = result as { id: string, name: string };
        return {
          content: [
            {
              type: "text",
              text: `Created polygon with ID: ${typedResult.id} and ${sides || 6} sides`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error creating polygon: ${error instanceof Error ? error.message : String(error)}`
            }
          ]
        };
      }
    }
  • Zod input schema for the 'create_polygon' tool parameters including position, dimensions, number of sides, name, parent, and optional color/stroke properties.
    {
      x: z.number().describe("X position"),
      y: z.number().describe("Y position"),
      width: z.number().describe("Width of the polygon"),
      height: z.number().describe("Height of the polygon"),
      sides: z.number().min(3).optional().describe("Number of sides (default: 6)"),
      name: z.string().optional().describe("Optional name for the polygon"),
      parentId: z.string().optional().describe("Optional parent node ID to append the polygon 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"),
    },
  • Direct registration of the 'create_polygon' tool on the MCP server instance inside registerCreationTools function.
      "create_polygon",
      "Create a new polygon in Figma",
      {
        x: z.number().describe("X position"),
        y: z.number().describe("Y position"),
        width: z.number().describe("Width of the polygon"),
        height: z.number().describe("Height of the polygon"),
        sides: z.number().min(3).optional().describe("Number of sides (default: 6)"),
        name: z.string().optional().describe("Optional name for the polygon"),
        parentId: z.string().optional().describe("Optional parent node ID to append the polygon 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, sides, name, parentId, fillColor, strokeColor, strokeWeight }) => {
        try {
          const result = await sendCommandToFigma("create_polygon", {
            x,
            y,
            width,
            height,
            sides: sides || 6,
            name: name || "Polygon",
            parentId,
            fillColor,
            strokeColor,
            strokeWeight,
          });
          
          const typedResult = result as { id: string, name: string };
          return {
            content: [
              {
                type: "text",
                text: `Created polygon with ID: ${typedResult.id} and ${sides || 6} sides`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error creating polygon: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • registerTools calls registerCreationTools(server), which registers the create_polygon tool among others.
    registerCreationTools(server);
  • Main server initialization calls registerTools(server), starting the chain that registers create_polygon.
    registerTools(server);
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 polygon' implies a write/mutation operation, but the description doesn't mention permissions required, whether this modifies existing documents, what happens on failure, or any rate limits. For a creation tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 for a tool with comprehensive schema documentation and gets straight to the point with zero wasted text.

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 creation tool with 10 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what happens after creation (does it return an ID? success status?), doesn't mention error conditions, and provides no context about how this fits into the Figma document structure. The comprehensive schema helps, but the description itself lacks completeness for a complex mutation operation.

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 schema description coverage is 100%, so the schema already documents all 10 parameters thoroughly. The description adds no parameter information beyond what's in the schema - it doesn't explain relationships between parameters, provide examples, or clarify semantics. With complete schema coverage, the baseline is 3 even without additional parameter context in the description.

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 verb ('Create') and resource ('polygon in Figma'), making the purpose immediately understandable. However, it doesn't differentiate this tool from other shape creation tools like create_rectangle, create_ellipse, or create_star that exist in the sibling list, which prevents a perfect score.

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 about when to use this tool versus alternatives. With multiple shape creation tools available (rectangle, ellipse, star), there's no indication that this tool is specifically for polygons with configurable sides versus other shapes. No prerequisites, constraints, or comparison to siblings are mentioned.

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/arinspunk/claude-talk-to-figma-mcp'

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