clone_node
Duplicate Figma design elements by cloning nodes to new positions, enabling design iteration and layout adjustments through programmatic automation.
Instructions
Clone an existing node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to clone | |
| x | No | New X position for the clone | |
| y | No | New Y position for the clone |
Implementation Reference
- src/talk_to_figma_mcp/server.ts:724-755 (handler)The handler function registers the 'clone_node' MCP tool, defines its input schema (nodeId required, x/y optional), sends the command to the Figma plugin via WebSocket using sendCommandToFigma, processes the result or error, and returns a formatted text response with the new node's name and ID.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)}` } ] }; } } );