Skip to main content
Glama
andreycretsu

Cursor Talk to Figma MCP

by andreycretsu

move_node

Reposition design elements in Figma by specifying new X and Y coordinates, enabling precise layout adjustments through programmatic control.

Instructions

Move a node to a new position in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the node to move
xYesNew X position
yYesNew Y position

Implementation Reference

  • The MCP tool handler for 'move_node'. It takes nodeId, x, y parameters, sends a 'move_node' command to the Figma plugin via WebSocket (using sendCommandToFigma), and returns a success message with the node name or an error.
    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 }) => {
        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)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Input schema for the 'move_node' tool using Zod 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"),
    },
  • Registration of the 'move_node' MCP tool on the McpServer instance, including name, description, input schema, and handler function.
    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 }) => {
        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)
                  }`,
              },
            ],
          };
        }
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/andreycretsu/cursor-talk-to-figma-mcp-main'

If you have feedback or need assistance with the MCP directory API, please join our Discord server