set_item_spacing
Adjust the spacing between elements within an auto-layout frame in Figma using natural language commands to streamline design alignment and organization.
Instructions
Set distance between children in an auto-layout frame
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/talk_to_figma_mcp/server.ts:2302-2336 (registration)Full registration of the 'set_item_spacing' MCP tool, including description, Zod input schema (nodeId and itemSpacing), and handler function that proxies the command to the Figma plugin via sendCommandToFigma.server.tool( "set_item_spacing", "Set distance between children in an auto-layout frame", { nodeId: z.string().describe("The ID of the frame to modify"), itemSpacing: z.number().describe("Distance between children. Note: This value will be ignored if primaryAxisAlignItems is set to SPACE_BETWEEN.") }, async ({ nodeId, itemSpacing }) => { try { const result = await sendCommandToFigma("set_item_spacing", { nodeId, itemSpacing }); const typedResult = result as { name: string }; return { content: [ { type: "text", text: `Set item spacing to ${itemSpacing} for frame "${typedResult.name}"`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error setting item spacing: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );