Skip to main content
Glama

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

NameRequiredDescriptionDefault

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)"), },
  • 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"
  • Invocation of registerTextTools which registers the set_line_height tool among others.
    registerTextTools(server);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/arinspunk/claude-talk-to-figma-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server