clone_node
Clone a Figma design node by specifying its ID and positioning the duplicate at new X and Y coordinates programmatically via natural language commands.
Instructions
Clone an existing node in Figma
Input 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 |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"nodeId": {
"description": "The ID of the node to clone",
"type": "string"
},
"x": {
"description": "New X position for the clone",
"type": "number"
},
"y": {
"description": "New Y position for the clone",
"type": "number"
}
},
"required": [
"nodeId"
],
"type": "object"
}
Implementation Reference
- src/talk_to_figma_mcp/server.ts:718-749 (handler)MCP tool registration and handler for 'clone_node'. Registers the tool with Zod schema for inputs (nodeId required, x/y optional) and implements the handler that forwards the clone_node command to the Figma plugin via WebSocket, handles the response, and returns formatted content or error.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 }: any) => { 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)}` } ] }; } } );