Skip to main content
Glama
arinspunk

Claude Talk to Figma MCP

by arinspunk

insert_child

Add a child node to a parent node in Figma designs to organize layers and structure components.

Instructions

Insert a child node inside a parent node in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
parentIdYesID of the parent node where the child will be inserted
childIdYesID of the child node to insert
indexNoOptional index where to insert the child (if not specified, it will be added at the end)

Implementation Reference

  • Full registration block including the handler function for the 'insert_child' MCP tool. The handler sends the insert_child command to Figma's websocket server with the provided parentId, childId, and optional index, types the result, and returns a structured text response indicating success or error.
    server.tool(
      "insert_child",
      "Insert a child node inside a parent node in Figma",
      {
        parentId: z.string().describe("ID of the parent node where the child will be inserted"),
        childId: z.string().describe("ID of the child node to insert"),
        index: z.number().optional().describe("Optional index where to insert the child (if not specified, it will be added at the end)")
      },
      async ({ parentId, childId, index }) => {
        try {
          const result = await sendCommandToFigma("insert_child", { 
            parentId, 
            childId,
            index 
          });
          
          const typedResult = result as { 
            parentId: string,
            childId: string,
            index: number,
            success: boolean
          };
          
          return {
            content: [
              {
                type: "text",
                text: `Child node with ID: ${typedResult.childId} successfully inserted into parent node with ID: ${typedResult.parentId}${index !== undefined ? ` at position ${typedResult.index}` : ''}.`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error inserting child node: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • TypeScript type definition for FigmaCommand union that includes "insert_child" as a valid command type used throughout the codebase for typing Figma interactions.
    export type FigmaCommand =
      | "get_document_info"
      | "get_selection"
      | "get_node_info"
      | "create_rectangle"
      | "create_frame"
      | "create_text"
      | "create_ellipse"
      | "create_polygon"
      | "create_star"
      | "create_vector"
      | "create_line"
      | "set_fill_color"
      | "set_stroke_color"
      | "move_node"
      | "resize_node"
      | "delete_node"
      | "get_styles"
      | "get_local_components"
      | "get_team_components"
      | "create_component_instance"
      | "export_node_as_image"
      | "join"
      | "set_corner_radius"
      | "clone_node"
      | "set_text_content"
      | "scan_text_nodes"
      | "set_multiple_text_contents"
      | "set_auto_layout"
      | "set_font_name"
      | "set_font_size"
      | "set_font_weight"
      | "set_letter_spacing"
      | "set_line_height"
      | "set_paragraph_spacing"
      | "set_text_case"
      | "set_text_decoration"
      | "get_styled_text_segments"
      | "load_font_async"
      | "get_remote_components"
      | "set_effects"
      | "set_effect_style_id"
      | "group_nodes"
      | "ungroup_nodes"
      | "flatten_node"
      | "insert_child";
  • Higher-level registration call to registerCreationTools(server), which in turn registers the insert_child tool among other creation tools.
    registerCreationTools(server);
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('insert') but does not explain critical behaviors such as permissions needed, whether this modifies the document structure permanently, error conditions (e.g., invalid IDs), or what happens on success/failure. This is inadequate for a mutation tool with zero annotation coverage.

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 that states the tool's purpose without unnecessary words. It is front-loaded and efficiently conveys the core action, making it easy to parse and understand 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 complexity of a mutation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits (e.g., side effects, error handling), usage context, and return values, leaving significant gaps for an agent to invoke the tool correctly in a real-world scenario.

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 has 100% description coverage, clearly documenting all three parameters (parentId, childId, index). The description does not add any semantic details beyond what the schema provides, such as format examples or edge cases. With high schema coverage, the baseline score of 3 is appropriate as the schema handles parameter documentation effectively.

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 ('insert') and the resources involved ('a child node inside a parent node in Figma'), making the purpose evident. However, it does not differentiate from siblings like 'move_node' or 'group_nodes', which also manipulate node relationships, so it lacks sibling distinction for 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 on when to use this tool versus alternatives. It does not mention prerequisites (e.g., existing nodes), exclusions, or compare to siblings like 'move_node' for repositioning or 'group_nodes' for grouping, leaving the agent without contextual usage cues.

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