Skip to main content
Glama

set_text_content

Update text content in Figma text nodes by specifying node ID and new text, enabling programmatic text modifications through MCP integration.

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

  • Registers the set_text_content MCP tool with name, description, Zod input schema (nodeId, text), and handler function that forwards to Figma plugin.
    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 }) => {
        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 sends 'set_text_content' command with nodeId and text to Figma plugin via sendCommandToFigma, processes response or error, returns MCP-formatted content.
    async ({ nodeId, text }) => {
      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 using Zod: nodeId (string, ID of text node), text (string, new content).
    {
      nodeId: z.string().describe("The ID of the text node to modify"),
      text: z.string().describe("New text content"),
    },
  • Type definition in FigmaCommand union includes "set_text_content".
    | "scan_text_nodes"
  • TypeScript interface CommandParams defines parameters for set_text_content command: nodeId and text.
    set_text_content: {
      nodeId: string;
      text: string;
    };

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.0.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / nodeId
      Added value: +{
      +  "description": "The ID of the text node to modify",
      +  "type": "string"
      +}
    • addedInput schema / properties / text
      Added value: +{
      +  "description": "New text content",
      +  "type": "string"
      +}
    • addedInput schema / required
      Added value: +[
      +  "nodeId",
      +  "text"
      +]
  2. First observed

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It only states that the node must be existing, without detailing mutation effects, reversibility, permissions, or return values. This is insufficient for a write operation.

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?

A single concise sentence with no superfluous content, front-loading the action. It is appropriately sized for the tool's simplicity.

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?

For a simple setter with fully documented parameters, the description is minimally viable but lacks information on results, errors, or related tools, especially given no annotations. It is adequate but with clear gaps.

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 input schema already provides full descriptions for both parameters (text and nodeId), so the description adds little beyond confirming the node must be a text node. Baseline 3 applies due to 100% schema coverage.

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 clearly identifies the action (set), the target resource (text content of an existing text node), and the context (Figma). It distinguishes from sibling tools like set_multiple_text_contents (singular vs. plural) and create_text (existing vs. new).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies the tool is for modifying an existing text node, which distinguishes it from creation tools. However, it does not explicitly mention when to use it over set_multiple_text_contents or provide alternatives.

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