set_line_height
Adjust the line height of text nodes in Figma directly through natural language commands, enhancing design precision and efficiency with AI-assisted tools.
Instructions
Set the line height of a text node in Figma
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- The async handler function that implements the core logic of the 'set_line_height' tool. It delegates the actual Figma modification to sendCommandToFigma and handles the response formatting.async ({ nodeId, lineHeight, unit }) => { try { const result = await sendCommandToFigma("set_line_height", { nodeId, lineHeight, unit: unit || "PIXELS" }); const typedResult = result as { name: string, lineHeight: { value: number, unit: string } }; return { content: [ { type: "text", text: `Updated line height of node "${typedResult.name}" to ${typedResult.lineHeight.value} ${typedResult.lineHeight.unit}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting line height: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
- Zod schema defining the input parameters for the set_line_height tool: nodeId (string), lineHeight (number), unit (enum optional).{ nodeId: z.string().describe("The ID of the text node to modify"), lineHeight: z.number().describe("Line height value"), unit: z.enum(["PIXELS", "PERCENT", "AUTO"]).optional().describe("Unit type (PIXELS, PERCENT, or AUTO)"), },
- src/talk_to_figma_mcp/tools/text-tools.ts:304-339 (registration)MCP server.tool registration for 'set_line_height', including name, description, input schema, and handler function.server.tool( "set_line_height", "Set the line height of a text node in Figma", { nodeId: z.string().describe("The ID of the text node to modify"), lineHeight: z.number().describe("Line height value"), unit: z.enum(["PIXELS", "PERCENT", "AUTO"]).optional().describe("Unit type (PIXELS, PERCENT, or AUTO)"), }, async ({ nodeId, lineHeight, unit }) => { try { const result = await sendCommandToFigma("set_line_height", { nodeId, lineHeight, unit: unit || "PIXELS" }); const typedResult = result as { name: string, lineHeight: { value: number, unit: string } }; return { content: [ { type: "text", text: `Updated line height of node "${typedResult.name}" to ${typedResult.lineHeight.value} ${typedResult.lineHeight.unit}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error setting line height: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
- Part of FigmaCommand union type listing 'set_line_height' as a supported Figma plugin command.| "set_line_height"
- src/talk_to_figma_mcp/tools/index.ts:17-17 (registration)Invocation of registerTextTools which registers the set_line_height tool among others.registerTextTools(server);