set_paragraph_spacing
Adjust spacing between paragraphs in Figma text nodes to improve readability and visual hierarchy in designs.
Instructions
Set the paragraph spacing of a text node in Figma
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the text node to modify | |
| paragraphSpacing | Yes | Paragraph spacing value in pixels |
Implementation Reference
- src/talk_to_figma_mcp/tools/text-tools.ts:341-375 (registration)Registers the MCP tool 'set_paragraph_spacing' including its description, Zod input schema (nodeId: string, paragraphSpacing: number), and async handler. The handler sends the command to the Figma plugin via sendCommandToFigma and returns a formatted success or error message.// Set Paragraph Spacing Tool server.tool( "set_paragraph_spacing", "Set the paragraph spacing of a text node in Figma", { nodeId: z.string().describe("The ID of the text node to modify"), paragraphSpacing: z.number().describe("Paragraph spacing value in pixels"), }, async ({ nodeId, paragraphSpacing }) => { try { const result = await sendCommandToFigma("set_paragraph_spacing", { nodeId, paragraphSpacing }); const typedResult = result as { name: string, paragraphSpacing: number }; return { content: [ { type: "text", text: `Updated paragraph spacing of node "${typedResult.name}" to ${typedResult.paragraphSpacing}px` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting paragraph spacing: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- The core handler logic for executing the 'set_paragraph_spacing' tool: calls sendCommandToFigma with parameters, type-casts the result, and returns content with update confirmation or error.async ({ nodeId, paragraphSpacing }) => { try { const result = await sendCommandToFigma("set_paragraph_spacing", { nodeId, paragraphSpacing }); const typedResult = result as { name: string, paragraphSpacing: number }; return { content: [ { type: "text", text: `Updated paragraph spacing of node "${typedResult.name}" to ${typedResult.paragraphSpacing}px` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting paragraph spacing: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
- Zod schema defining inputs for the tool: nodeId (string) and paragraphSpacing (number).{ nodeId: z.string().describe("The ID of the text node to modify"), paragraphSpacing: z.number().describe("Paragraph spacing value in pixels"), },
- Includes 'set_paragraph_spacing' in the FigmaCommand type union, used internally for typing the commands sent to Figma plugin.| "set_paragraph_spacing"