move_node
Reposition design elements in Figma by specifying new X and Y coordinates for precise layout adjustments.
Instructions
Move a node to a new position in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to move | |
| x | Yes | New X position | |
| y | Yes | New Y position |
Implementation Reference
- src/cursor_mcp_plugin/code.js:490-519 (handler)Core implementation of move_node tool: retrieves Figma node by ID, validates parameters, updates node position (x, y), and returns updated node information.async function moveNode(params) { const { nodeId, x, y } = params || {}; if (!nodeId) { throw new Error("Missing nodeId parameter"); } if (x === undefined || y === undefined) { throw new Error("Missing x or y parameters"); } const node = await figma.getNodeByIdAsync(nodeId); if (!node) { throw new Error(`Node not found with ID: ${nodeId}`); } if (!("x" in node) || !("y" in node)) { throw new Error(`Node does not support position: ${nodeId}`); } node.x = x; node.y = y; return { id: node.id, name: node.name, x: node.x, y: node.y, }; }
- src/talk_to_figma_mcp/server.ts:346-376 (registration)MCP server.tool registration for 'move_node', including schema validation with Zod (nodeId, x, y) and handler that forwards to Figma plugin via sendCommandToFigma."move_node", "Move a node to a new position in Figma", { nodeId: z.string().describe("The ID of the node to move"), x: z.number().describe("New X position"), y: z.number().describe("New Y position") }, async ({ nodeId, x, y }) => { try { const result = await sendCommandToFigma('move_node', { nodeId, x, y }); const typedResult = result as { name: string }; return { content: [ { type: "text", text: `Moved node "${typedResult.name}" to position (${x}, ${y})` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error moving node: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- Zod input schema for move_node tool parameters: nodeId (string), x (number), y (number).{ nodeId: z.string().describe("The ID of the node to move"), x: z.number().describe("New X position"), y: z.number().describe("New Y position") },
- src/cursor_mcp_plugin/code.js:83-84 (handler)Dispatch handler case in Figma plugin code that routes 'move_node' command to the moveNode function.case "move_node": return await moveNode(params);
- Type union FigmaCommand includes 'move_node' for type safety in sendCommandToFigma calls.| 'move_node'