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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get text segments' but doesn't describe what the output looks like (e.g., list of segments with styling details), whether it's read-only (implied by 'Get' but not explicit), error conditions, or performance considerations. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the key action ('Get text segments') and context ('in a text node'). There is zero waste—every word contributes to understanding the tool's purpose without redundancy or unnecessary detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has no annotations, no output schema, and 2 parameters, the description is incomplete. It lacks details on output format (critical for a 'Get' operation), error handling, and behavioral context. For a tool that analyzes styling segments, more information on what is returned and how to interpret it is needed for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents both parameters (nodeId and property with enum values). The description adds no additional meaning beyond what's in the schema—it doesn't explain parameter interactions, constraints, or examples. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get text segments') and the target ('in a text node'), specifying the criteria ('with specific styling'). It distinguishes from siblings like 'get_node_info' or 'scan_text_nodes' by focusing on styling analysis rather than general node information or text scanning. However, it doesn't explicitly differentiate from all styling-related siblings like 'get_styles'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid text node ID), exclusions (e.g., not for non-text nodes), or comparisons to siblings like 'get_styles' (which might return global styles) or 'scan_text_nodes' (which might find text nodes). Usage is implied by the description but not explicitly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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