resize_node
Resize Figma design elements by specifying new width and height dimensions for selected nodes.
Instructions
Resize a node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to resize | |
| width | Yes | New width | |
| height | Yes | New height |
Implementation Reference
- src/cursor_mcp_plugin/code.js:521-549 (handler)Core handler function that implements the resize_node tool logic by fetching the Figma node and calling its resize method.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, }; }
- src/cursor_mcp_plugin/code.js:85-86 (registration)Dispatcher case in the command handler switch that routes 'resize_node' calls to the resizeNode function.case "resize_node": return await resizeNode(params);
- src/talk_to_figma_mcp/server.ts:379-410 (registration)MCP server tool registration for 'resize_node', including schema validation and proxy handler that forwards to Figma plugin.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 definition using Zod for the resize_node tool parameters.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") },
- Type union including 'resize_node' command for Figma communication.| 'resize_node' | 'delete_node'