move_node
Reposition a Figma design element by specifying its node ID and new X, Y coordinates, optimizing layout adjustments programmatically via natural language commands.
Instructions
Move a node to a new position in Figma
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to move | |
| x | Yes | New X position | |
| y | Yes | New Y position |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"nodeId": {
"description": "The ID of the node to move",
"type": "string"
},
"x": {
"description": "New X position",
"type": "number"
},
"y": {
"description": "New Y position",
"type": "number"
}
},
"required": [
"nodeId",
"x",
"y"
],
"type": "object"
}
Implementation Reference
- src/talk_to_figma_mcp/server.ts:683-715 (registration)Registration of the 'move_node' MCP tool including description, Zod input schema (nodeId, x, y), and inline handler function that delegates to Figma plugin via sendCommandToFigma.server.tool( "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 }: any) => { 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) }`, }, ], }; } } );
- src/talk_to_figma_mcp/server.ts:691-714 (handler)The handler function for the move_node tool. It calls sendCommandToFigma with the parameters and formats a success or error response message.async ({ nodeId, x, y }: any) => { 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 schema for move_node tool input validation: 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"), },
- TypeScript interface definition for move_node command parameters in CommandParams type, used for typing sendCommandToFigma calls.move_node: { nodeId: string; x: number; y: number; };