Skip to main content
Glama
paragdesai1

Cursor Talk to Figma MCP

by paragdesai1

clone_node

Duplicate Figma design elements by cloning nodes to new positions, enabling rapid design iteration and component reuse.

Instructions

Clone an existing node in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the node to clone
xNoNew X position for the clone
yNoNew Y position for the clone

Implementation Reference

  • The core handler function that executes the clone_node tool logic in the Figma plugin: retrieves node by ID, clones it using Figma's node.clone() API, optionally repositions the clone, appends to the original parent, and returns clone details.
      const { nodeId, x, y } = params || {};
    
      if (!nodeId) {
        throw new Error("Missing nodeId parameter");
      }
    
      const node = await figma.getNodeByIdAsync(nodeId);
      if (!node) {
        throw new Error(`Node not found with ID: ${nodeId}`);
      }
    
      // Clone the node
      const clone = node.clone();
    
      // If x and y are provided, move the clone to that position
      if (x !== undefined && y !== undefined) {
        if (!("x" in clone) || !("y" in clone)) {
          throw new Error(`Cloned node does not support position: ${nodeId}`);
        }
        clone.x = x;
        clone.y = y;
      }
    
      // Add the clone to the same parent as the original node
      if (node.parent) {
        node.parent.appendChild(clone);
      } else {
        figma.currentPage.appendChild(clone);
      }
    
      return {
        id: clone.id,
        name: clone.name,
        x: "x" in clone ? clone.x : undefined,
        y: "y" in clone ? clone.y : undefined,
        width: "width" in clone ? clone.width : undefined,
        height: "height" in clone ? clone.height : undefined,
      };
    }
  • Registers the 'clone_node' MCP tool, defining its input schema (nodeId required, x/y optional), description, and proxy handler that sends the command to the Figma plugin via WebSocket and formats the response.
    server.tool(
      "clone_node",
      "Clone an existing node in Figma",
      {
        nodeId: z.string().describe("The ID of the node to clone"),
        x: z.number().optional().describe("New X position for the clone"),
        y: z.number().optional().describe("New Y position for the clone")
      },
      async ({ nodeId, x, y }) => {
        try {
          const result = await sendCommandToFigma('clone_node', { nodeId, x, y });
          const typedResult = result as { name: string, id: string };
          return {
            content: [
              {
                type: "text",
                text: `Cloned node "${typedResult.name}" with new ID: ${typedResult.id}${x !== undefined && y !== undefined ? ` at position (${x}, ${y})` : ''}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error cloning node: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Zod schema defining input parameters for clone_node tool: nodeId (string, required), x and y (number, optional).
    {
      nodeId: z.string().describe("The ID of the node to clone"),
      x: z.number().optional().describe("New X position for the clone"),
      y: z.number().optional().describe("New Y position for the clone")
    },
  • Dispatch case in Figma plugin's handleCommand switch that routes 'clone_node' commands to the cloneNode implementation function.
    case "clone_node":
      return await cloneNode(params);
  • Includes 'clone_node' in FigmaCommand type union for TypeScript type safety in command handling.
    | "clone_node"

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv1.0.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / nodeId
      Added value: +{
      +  "description": "The ID of the node to clone",
      +  "type": "string"
      +}
    • addedInput schema / properties / x
      Added value: +{
      +  "description": "New X position for the clone",
      +  "type": "number"
      +}
    • addedInput schema / properties / y
      Added value: +{
      +  "description": "New Y position for the clone",
      +  "type": "number"
      +}
    • addedInput schema / required
      Added value: +[
      +  "nodeId"
      +]
  2. First observed

TDQS

B3.3/5.0
Behavior2/5

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

With no annotations available, the description bears full responsibility for behavioral disclosure. It only states the basic action, omitting details like whether children are copied, if the clone gets a new ID, or any side effects.

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, front-loaded sentence that conveys the core purpose without any wasteful words. It is appropriately concise for a simple tool.

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 clone operation with only three parameters and no output schema, the description is minimally adequate. However, it lacks information about return values or default behavior (e.g., what happens if x/y are omitted), which would make it more complete.

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 parameters are already fully documented. The description adds no additional parameter-level context beyond what the schema provides, earning the baseline score.

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 uses a specific verb 'Clone' with the resource 'an existing node in Figma', clearly distinguishing it from sibling tools like move_node or resize_node. There is no ambiguity about the tool's primary action.

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, such as create_rectangle or create_component_instance. No exclusions or preferred contexts are mentioned.

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