Skip to main content
Glama
arinspunk

Claude Talk to Figma MCP

by arinspunk

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
NameRequiredDescriptionDefault
nodeIdYesThe ID of the text node to analyze
propertyYesThe 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"
  • Calls registerTextTools which includes registration of get_styled_text_segments tool.
    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