Skip to main content
Glama
grab

Talk to Figma MCP

by grab

set_text_content

Update text content in Figma by specifying the node ID and new text. Enables programmatic text modification in designs through natural language commands.

Instructions

Set the text content of an existing text node in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the text node to modify
textYesNew text content

Implementation Reference

  • MCP tool registration for 'set_text_content'. Includes schema definition and handler function that sends the command to the Figma plugin via WebSocket.
    // Set Text Content Tool
    server.tool(
      "set_text_content",
      "Set the text content of an existing text node in Figma",
      {
        nodeId: z.string().describe("The ID of the text node to modify"),
        text: z.string().describe("New text content"),
      },
      async ({ nodeId, text }: any) => {
        try {
          const result = await sendCommandToFigma("set_text_content", {
            nodeId,
            text,
          });
          const typedResult = result as { name: string };
          return {
            content: [
              {
                type: "text",
                text: `Updated text content of node "${typedResult.name}" to "${text}"`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error setting text content: ${error instanceof Error ? error.message : String(error)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Handler function for the 'set_text_content' tool. Forwards nodeId and text to Figma plugin command 'set_text_content' and formats success/error response.
    async ({ nodeId, text }: any) => {
      try {
        const result = await sendCommandToFigma("set_text_content", {
          nodeId,
          text,
        });
        const typedResult = result as { name: string };
        return {
          content: [
            {
              type: "text",
              text: `Updated text content of node "${typedResult.name}" to "${text}"`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error setting text content: ${error instanceof Error ? error.message : String(error)
                }`,
            },
          ],
        };
      }
    }
  • Input schema validation using Zod for 'set_text_content' tool parameters: nodeId (string) and text (string).
    {
      nodeId: z.string().describe("The ID of the text node to modify"),
      text: z.string().describe("New text content"),
    },
  • TypeScript type definition for FigmaCommand parameters of 'set_text_content' in CommandParams interface.
    set_text_content: {
      nodeId: string;
      text: string;
    };
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states the tool modifies an existing node, implying mutation, but lacks critical behavioral details: whether it requires specific permissions, if changes are reversible, potential side effects (e.g., text overflow), or error conditions (e.g., invalid nodeId). For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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, direct sentence with zero waste—it states the action, target, and context without redundancy. It is front-loaded and efficiently conveys the core purpose, making it easy for an agent to parse quickly.

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 tool's mutation nature, lack of annotations, and no output schema, the description is incomplete. It fails to address behavioral aspects like permissions, reversibility, or response format, which are crucial for safe and effective use. While the schema covers parameters well, the overall context for a write operation remains underspecified.

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%, with clear descriptions for both parameters ('nodeId' and 'text'). The description adds no additional semantic context beyond what the schema provides, such as format examples for nodeId or text constraints. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, but no extra value is contributed.

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 ('Set') and target resource ('text content of an existing text node in Figma'), making the purpose immediately understandable. It distinguishes itself from siblings like 'create_text' (which creates new text) and 'delete_node' (which removes nodes). However, it doesn't explicitly mention what distinguishes it from other modification tools like 'set_fill_color' or 'set_stroke_color' beyond the 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?

The description provides minimal guidance by specifying 'existing text node,' which implies it cannot be used on non-text nodes or newly created ones. However, it offers no explicit when-to-use rules, alternatives for similar operations, or prerequisites (e.g., node must be editable). Without this, an agent might misuse it or overlook better options among siblings.

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

Related 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/grab/cursor-talk-to-figma-mcp'

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