Skip to main content
Glama
paragdesai1

Cursor Talk to Figma MCP

by paragdesai1

resize_node

Resize Figma design elements by specifying new width and height dimensions to adjust layout proportions.

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 core handler function for the resize_node command in the Figma plugin. It retrieves the node by ID, validates it supports resize, calls node.resize(width, height), and returns the updated dimensions.
    async function resizeNode(params) {
      const { nodeId, width, height } = params || {};
    
      if (!nodeId) {
        throw new Error("Missing nodeId parameter");
      }
    
      if (width === undefined || height === undefined) {
        throw new Error("Missing width or height parameters");
      }
    
      const node = await figma.getNodeByIdAsync(nodeId);
      if (!node) {
        throw new Error(`Node not found with ID: ${nodeId}`);
      }
    
      if (!("resize" in node)) {
        throw new Error(`Node does not support resizing: ${nodeId}`);
      }
    
      node.resize(width, height);
    
      return {
        id: node.id,
        name: node.name,
        width: node.width,
        height: node.height,
      };
    }
  • Registers the 'resize_node' tool with the MCP server. Defines the input schema using Zod and provides a proxy handler that forwards the command to the Figma plugin via WebSocket using sendCommandToFigma.
    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)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Input schema for the resize_node tool, validating nodeId as string and width/height as 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"),
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Resize' implies a mutation operation, the description doesn't address important behavioral aspects: whether this requires specific permissions, what happens to child elements when a parent node is resized, whether constraints or aspect ratios are preserved, or what validation occurs. This leaves significant gaps for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just four words, front-loading the essential information with zero wasted words. Every element earns its place, making it easy for an agent to quickly understand the core function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't address behavioral implications, error conditions, success indicators, or how this operation interacts with other node properties. Given the complexity of resizing operations in design tools and the lack of structured safety information, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with all three parameters clearly documented in the schema (nodeId, width, height). The description adds no additional parameter semantics beyond what's already in the structured schema, so it meets the baseline expectation but doesn't provide extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Resize') and target resource ('a node in Figma'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'move_node' or 'set_layout_sizing' which also modify node properties, leaving some ambiguity about when to choose resize over other dimension-altering operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple sibling tools that modify node properties (move_node, set_layout_sizing, set_corner_radius, etc.), there's no indication of when resizing is appropriate versus other transformations or when to combine operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/paragdesai1/parag-Figma-MCP'

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