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
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to resize | |
| width | Yes | New width | |
| height | Yes | New 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"), },
- src/talk_to_figma_mcp/tools/modification-tools.ts:147-182 (registration)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)}`, }, ], }; } } );
- src/talk_to_figma_mcp/tools/index.ts:16-16 (registration)Registration of the modification tools module (including resize_node) by calling registerModificationTools in the tools index.registerModificationTools(server);
- src/talk_to_figma_mcp/server.ts:34-34 (registration)Top-level registration of all tools (including resize_node via chained calls) in the main server setup.registerTools(server);