get_styled_text_segments
Analyze text nodes in Figma to identify segments with specific styling properties like font, color, or spacing for design consistency checks.
Instructions
Get text segments with specific styling in a text node
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodeId | Yes | The ID of the text node to analyze | |
| property | Yes | The style property to analyze segments by |
Implementation Reference
- The complete implementation of the 'get_styled_text_segments' MCP tool, including registration, input schema, and execution handler. Sends command to Figma and returns JSON result.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 the Figma command 'get_styled_text_segments' used by the MCP handler.| "get_styled_text_segments"
- src/talk_to_figma_mcp/tools/index.ts:17-17 (registration)Calls registerTextTools which includes registration of get_styled_text_segments tool.registerTextTools(server);