clone_node
Automate Figma design tasks by cloning an existing node using Cursor AI and the MCP server. Streamline design workflows programmatically.
Instructions
Clone an existing node in Figma
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- src/talk_to_figma_mcp/server.ts:723-755 (handler)The complete MCP tool definition for 'clone_node', including registration, input schema, and handler logic. The handler proxies the clone_node command to the Figma plugin and handles the response.// Clone Node Tool 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 the input parameters for the clone_node tool: required nodeId (string), optional x and y (numbers).{ 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") },
- src/talk_to_figma_mcp/server.ts:723-723 (registration)Registration of the clone_node tool using server.tool() with name, description, schema, and handler.// Clone Node Tool
- TypeScript type definition for clone_node command parameters in CommandParams interface.clone_node: { nodeId: string; x?: number; y?: number; };
- Example usage of clone_node in the text_replacement_strategy prompt.clone_node(nodeId: "selected-node-id", x: [new-x], y: [new-y]) // Replace text chunk by chunk