Skip to main content
Glama
arinspunk

Claude Talk to Figma MCP

by arinspunk

resize_node

Change the dimensions of design elements in Figma by specifying new width and height values for precise layout adjustments.

Instructions

Resize a node in Figma

Input Schema

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

Implementation Reference

  • The handler function that implements the core logic of the 'resize_node' tool. It invokes sendCommandToFigma to resize the specified node in Figma and returns a success or error message.
    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 schema defining the input parameters for the 'resize_node' tool: nodeId (string), width (positive number), height (positive number).
    {
      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"),
    },
  • The server.tool() call that registers the 'resize_node' tool on the MCP server, including its name, description, schema, and handler.
    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)}`,
              },
            ],
          };
        }
      }
    );
  • Registration of the modification tools module (including resize_node) by calling registerModificationTools in the tools index.
    registerModificationTools(server);
  • Top-level registration of all tools (including resize_node via chained calls) in the main server setup.
    registerTools(server);

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/arinspunk/claude-talk-to-figma-mcp'

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