Skip to main content
Glama

create_text

Add text elements to Figma designs by specifying position, content, font properties, and color through the Talk to Figma MCP server.

Instructions

Create a new text element in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xYesX position
yYesY position
textYesText content
fontSizeNoFont size (default: 14)
fontWeightNoFont weight (e.g., 400 for Regular, 700 for Bold)
fontColorNoFont color in RGBA format
nameNoSemantic layer name for the text node
parentIdNoOptional parent node ID to append the text to

Implementation Reference

  • The MCP tool handler for 'create_text' which forwards parameters to the Figma plugin via sendCommandToFigma, processes the result, and returns a formatted response or error.
    async ({ x, y, text, fontSize, fontWeight, fontColor, name, parentId }) => {
      try {
        const result = await sendCommandToFigma("create_text", {
          x,
          y,
          text,
          fontSize: fontSize || 14,
          fontWeight: fontWeight || 400,
          fontColor: fontColor || { r: 0, g: 0, b: 0, a: 1 },
          name: name || "Text",
          parentId,
        });
        const typedResult = result as { name: string; id: string };
        return {
          content: [
            {
              type: "text",
              text: `Created text "${typedResult.name}" with ID: ${typedResult.id}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error creating text: ${error instanceof Error ? error.message : String(error)
                }`,
            },
          ],
        };
      }
    }
  • Zod input schema defining parameters for the create_text tool: position (x,y), text content, optional font styling, name, and parent ID.
    {
      x: z.number().describe("X position"),
      y: z.number().describe("Y position"),
      text: z.string().describe("Text content"),
      fontSize: z.number().optional().describe("Font size (default: 14)"),
      fontWeight: z
        .number()
        .optional()
        .describe("Font weight (e.g., 400 for Regular, 700 for Bold)"),
      fontColor: 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("Font color in RGBA format"),
      name: z
        .string()
        .optional()
        .describe("Semantic layer name for the text node"),
      parentId: z
        .string()
        .optional()
        .describe("Optional parent node ID to append the text to"),
    },
  • Registration of the 'create_text' MCP tool using McpServer.tool() with description, input schema, and handler function.
    server.tool(
      "create_text",
      "Create a new text element in Figma",
      {
        x: z.number().describe("X position"),
        y: z.number().describe("Y position"),
        text: z.string().describe("Text content"),
        fontSize: z.number().optional().describe("Font size (default: 14)"),
        fontWeight: z
          .number()
          .optional()
          .describe("Font weight (e.g., 400 for Regular, 700 for Bold)"),
        fontColor: 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("Font color in RGBA format"),
        name: z
          .string()
          .optional()
          .describe("Semantic layer name for the text node"),
        parentId: z
          .string()
          .optional()
          .describe("Optional parent node ID to append the text to"),
      },
      async ({ x, y, text, fontSize, fontWeight, fontColor, name, parentId }) => {
        try {
          const result = await sendCommandToFigma("create_text", {
            x,
            y,
            text,
            fontSize: fontSize || 14,
            fontWeight: fontWeight || 400,
            fontColor: fontColor || { r: 0, g: 0, b: 0, a: 1 },
            name: name || "Text",
            parentId,
          });
          const typedResult = result as { name: string; id: string };
          return {
            content: [
              {
                type: "text",
                text: `Created text "${typedResult.name}" with ID: ${typedResult.id}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error creating text: ${error instanceof Error ? error.message : String(error)
                  }`,
              },
            ],
          };
        }
      }
    );

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv1.0.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / fontColor
      Added value: +{
      +  "description": "Font color in RGBA format",
      +  "properties": {
      +    "a": {
      +      "description": "Alpha component (0-1)",
      +      "maximum": 1,
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "b": {
      +      "description": "Blue component (0-1)",
      +      "maximum": 1,
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "g": {
      +      "description": "Green component (0-1)",
      +      "maximum": 1,
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    "r": {
      +      "description": "Red component (0-1)",
      +      "maximum": 1,
      +      "minimum": 0,
      +      "type": "number"
      +    }
      +  },
      +  "required": [
      +    "r",
      +    "g",
      +    "b"
      +  ],
      +  "type": "object"
      +}
    • addedInput schema / properties / fontSize
      Added value: +{
      +  "description": "Font size (default: 14)",
      +  "type": "number"
      +}
    • addedInput schema / properties / fontWeight
      Added value: +{
      +  "description": "Font weight (e.g., 400 for Regular, 700 for Bold)",
      +  "type": "number"
      +}
    • addedInput schema / properties / name
      Added value: +{
      +  "description": "Semantic layer name for the text node",
      +  "type": "string"
      +}
    • addedInput schema / properties / parentId
      Added value: +{
      +  "description": "Optional parent node ID to append the text to",
      +  "type": "string"
      +}
    • addedInput schema / properties / text
      Added value: +{
      +  "description": "Text content",
      +  "type": "string"
      +}
    • addedInput schema / properties / x
      Added value: +{
      +  "description": "X position",
      +  "type": "number"
      +}
    • addedInput schema / properties / y
      Added value: +{
      +  "description": "Y position",
      +  "type": "number"
      +}
    • addedInput schema / required
      Added value: +[
      +  "x",
      +  "y",
      +  "text"
      +]
  2. First observed

TDQS

B3.2/5.0
Behavior2/5

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

With no annotations provided, the description carries full responsibility for behavioral disclosure. It only states the basic action ('create') and reveals nothing about return values, side effects, permissions, or how it interacts with the document. This is a minimal but non-misleading disclosure.

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, short, grammatically complete sentence with zero filler. It efficiently communicates the tool's purpose without unnecessary detail, matching the standard for appropriate conciseness.

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?

The tool has 8 parameters including a nested fontColor object and no output schema, yet the description provides no context about return values, default behavior, parent requirements, or typical use scenarios. The single-sentence description is insufficient for an agent to fully understand the tool's behavior in complex workflows.

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 all 8 parameters (x, y, text, name, fontSize, parentId, fontColor, fontWeight) have individual descriptions. The tool description adds no additional parameter meaning, so the schema already provides the needed semantics. Baseline 3 is appropriate.

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 states a specific verb ('Create') and resource ('text element') with clear scope ('in Figma'). It distinguishes from sibling tools like set_text_content (which modifies) and create_rectangle (which creates a different resource type).

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. It doesn't mention that set_text_content should be used for modifying existing text, or any context about parent frames or prerequisites. The description simply states what it does without guiding selection.

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