Skip to main content
Glama
yhc984
by yhc984

resize_node

Adjust the dimensions of a Figma design element by specifying a new width and height using the node's unique ID.

Instructions

Resize a node in Figma

Input Schema

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

Implementation Reference

  • Core implementation of resize_node in Figma plugin: validates parameters, fetches node, calls Figma API node.resize(width, height), returns updated info.
    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, }; }
  • MCP server registration of 'resize_node' tool, including input schema and proxy handler that forwards to 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)}` } ] }; } } );
  • Command dispatcher in Figma plugin's handleCommand function that routes 'resize_node' calls to the resizeNode handler.
    case "resize_node": return await resizeNode(params);
  • Input schema validation for resize_node tool using Zod.
    { 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") },

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/yhc984/cursor-talk-to-figma-mcp-main'

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