Skip to main content
Glama

get_styled_text_segments

Extract text segments with specific styling from Figma text nodes, enabling precise design adjustments through AI-assisted interface interactions.

Instructions

Get text segments with specific styling in a text node

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 handler function that executes the get_styled_text_segments tool by sending the corresponding command to Figma via websocket and returning the JSON stringified result.
    async ({ nodeId, property }) => { try { const result = await sendCommandToFigma("get_styled_text_segments", { nodeId, property }); return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting styled text segments: ${error instanceof Error ? error.message : String(error)}` } ] }; }
  • Zod schema defining the input parameters for the tool: nodeId (string) and property (enum of style properties).
    nodeId: z.string().describe("The ID of the text node to analyze"), property: z.enum([ "fillStyleId", "fontName", "fontSize", "textCase", "textDecoration", "textStyleId", "fills", "letterSpacing", "lineHeight", "fontWeight" ]).describe("The style property to analyze segments by"),
  • Higher-level registration call that invokes registerTextTools to register all text tools, including get_styled_text_segments.
    registerTextTools(server);
  • Direct registration of the tool using server.tool() within the registerTextTools function.
    server.tool( "get_styled_text_segments", "Get text segments with specific styling in a text node", { nodeId: z.string().describe("The ID of the text node to analyze"), property: z.enum([ "fillStyleId", "fontName", "fontSize", "textCase", "textDecoration", "textStyleId", "fills", "letterSpacing", "lineHeight", "fontWeight" ]).describe("The style property to analyze segments by"), }, async ({ nodeId, property }) => { try { const result = await sendCommandToFigma("get_styled_text_segments", { nodeId, property }); return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error getting styled text segments: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
  • Type definition for FigmaCommand union type includes this command name for type safety in sendCommandToFigma calls.
    | "get_styled_text_segments"

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