Skip to main content
Glama
andreycretsu

Cursor Talk to Figma MCP

by andreycretsu

resize_node

Resize Figma design elements by specifying new width and height values. Use this tool to adjust node dimensions programmatically within your design workflow.

Instructions

Resize a node in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the node to resize
widthYesNew width
heightYesNew height

Implementation Reference

  • Registration of the 'resize_node' MCP tool, including inline input schema definition and handler function that forwards the resize command to the Figma plugin via WebSocket.
    server.tool(
      "resize_node",
      "Resize a node in Figma",
      {
        nodeId: z.string().describe("The ID of the node to resize"),
        width: z.number().positive().describe("New width"),
        height: z.number().positive().describe("New height"),
      },
      async ({ nodeId, width, height }) => {
        try {
          const result = await sendCommandToFigma("resize_node", {
            nodeId,
            width,
            height,
          });
          const typedResult = result as { name: string };
          return {
            content: [
              {
                type: "text",
                text: `Resized node "${typedResult.name}" to width ${width} and height ${height}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error resizing node: ${error instanceof Error ? error.message : String(error)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Zod input schema for the resize_node tool: requires nodeId (string), width and height (positive numbers).
    {
      nodeId: z.string().describe("The ID of the node to resize"),
      width: z.number().positive().describe("New width"),
      height: z.number().positive().describe("New height"),
    },
  • Handler function for resize_node tool. Sends the resize parameters to Figma plugin using sendCommandToFigma and returns success/error message with MCP content format.
      async ({ nodeId, width, height }) => {
        try {
          const result = await sendCommandToFigma("resize_node", {
            nodeId,
            width,
            height,
          });
          const typedResult = result as { name: string };
          return {
            content: [
              {
                type: "text",
                text: `Resized node "${typedResult.name}" to width ${width} and height ${height}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error resizing 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