set_corner_radius
Adjust corner rounding on Figma design elements by specifying radius values and optional corner selection for precise visual styling.
Instructions
Set the corner radius of a node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the node to modify | |
| radius | Yes | Corner radius value | |
| corners | No | Optional array of 4 booleans to specify which corners to round [topLeft, topRight, bottomRight, bottomLeft] |
Implementation Reference
- src/talk_to_figma_mcp/tools/modification-tools.ts:217-257 (registration)Registration of the MCP tool 'set_corner_radius' via server.tool(), including description, Zod input schema, and handler function that forwards the set corner radius command to Figma."set_corner_radius", "Set the corner radius of a node in Figma", { nodeId: z.string().describe("The ID of the node to modify"), radius: z.number().min(0).describe("Corner radius value"), corners: z .array(z.boolean()) .length(4) .optional() .describe( "Optional array of 4 booleans to specify which corners to round [topLeft, topRight, bottomRight, bottomLeft]" ), }, async ({ nodeId, radius, corners }) => { try { const result = await sendCommandToFigma("set_corner_radius", { nodeId, radius, corners: corners || [true, true, true, true], }); const typedResult = result as { name: string }; return { content: [ { type: "text", text: `Set corner radius of node "${typedResult.name}" to ${radius}px`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error setting corner radius: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );
- The handler function for the 'set_corner_radius' tool. It sends the command to Figma using sendCommandToFigma, handles the response, and returns a formatted text content block with success or error message.async ({ nodeId, radius, corners }) => { try { const result = await sendCommandToFigma("set_corner_radius", { nodeId, radius, corners: corners || [true, true, true, true], }); const typedResult = result as { name: string }; return { content: [ { type: "text", text: `Set corner radius of node "${typedResult.name}" to ${radius}px`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error setting corner radius: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }
- Zod schema for validating input parameters of the 'set_corner_radius' tool: nodeId (string), radius (number >= 0), corners (optional array of exactly 4 booleans).{ nodeId: z.string().describe("The ID of the node to modify"), radius: z.number().min(0).describe("Corner radius value"), corners: z .array(z.boolean()) .length(4) .optional() .describe( "Optional array of 4 booleans to specify which corners to round [topLeft, topRight, bottomRight, bottomLeft]" ), },
- The 'set_corner_radius' command is included in the FigmaCommand type union, used for typing the websocket communication to Figma plugin.| "set_corner_radius"