Skip to main content
Glama
arinspunk

Claude Talk to Figma MCP

by arinspunk

scan_text_nodes

Extract all text content from selected Figma design elements to analyze, edit, or export text data for AI-assisted design workflows.

Instructions

Scan all text nodes in the selected Figma node

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesID of the node to scan

Implementation Reference

  • Full registration and handler implementation for the 'scan_text_nodes' MCP tool. The handler proxies the request to the Figma plugin's scan_text_nodes command with chunking enabled, processes the response, and returns formatted content including progress status and results.
    server.tool(
      "scan_text_nodes",
      "Scan all text nodes in the selected Figma node",
      {
        nodeId: z.string().describe("ID of the node to scan"),
      },
      async ({ nodeId }) => {
        try {
          // Initial response to indicate we're starting the process
          const initialStatus = {
            type: "text" as const,
            text: "Starting text node scanning. This may take a moment for large designs...",
          };
    
          // Use the plugin's scan_text_nodes function with chunking flag
          const result = await sendCommandToFigma("scan_text_nodes", {
            nodeId,
            useChunking: true,  // Enable chunking on the plugin side
            chunkSize: 10       // Process 10 nodes at a time
          });
    
          // If the result indicates chunking was used, format the response accordingly
          if (result && typeof result === 'object' && 'chunks' in result) {
            const typedResult = result as {
              success: boolean,
              totalNodes: number,
              processedNodes: number,
              chunks: number,
              textNodes: Array<any>
            };
    
            const summaryText = `
            Scan completed:
            - Found ${typedResult.totalNodes} text nodes
            - Processed in ${typedResult.chunks} chunks
            `;
    
            return {
              content: [
                initialStatus,
                {
                  type: "text" as const,
                  text: summaryText
                },
                {
                  type: "text" as const,
                  text: JSON.stringify(typedResult.textNodes, null, 2)
                }
              ],
            };
          }
    
          // If chunking wasn't used or wasn't reported in the result format, return the result as is
          return {
            content: [
              initialStatus,
              {
                type: "text",
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error scanning text nodes: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • Input schema for the scan_text_nodes tool using Zod validation for nodeId parameter.
    {
      nodeId: z.string().describe("ID of the node to scan"),
    },
  • Higher-level tool registration that calls registerDocumentTools(server), which includes scan_text_nodes.
    export function registerTools(server: McpServer): void {
      // Register all tool categories
      registerDocumentTools(server);
      registerCreationTools(server);
      registerModificationTools(server);
      registerTextTools(server);
      registerComponentTools(server);
    }
  • Main server setup calls registerTools, indirectly registering scan_text_nodes tool.
    registerTools(server);
  • Type definition including 'scan_text_nodes' as a valid FigmaCommand used by the websocket communication.
    | "scan_text_nodes"
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('scan') but fails to explain what 'scan' entails—whether it returns text content, node IDs, metadata, or other details. It doesn't mention permissions, rate limits, or potential side effects (though 'scan' suggests read-only, this isn't explicit). For a tool with zero annotation coverage, this is a significant gap in transparency.

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 core action and target without unnecessary words. It wastes no space on redundant details or fluff, making it easy to parse quickly. Every part of the sentence earns its place by directly contributing to understanding the tool's purpose.

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 complexity of scanning text nodes in Figma, the description is incomplete. With no annotations and no output schema, it fails to explain what the scan returns (e.g., text content, node IDs, positions) or any behavioral nuances. While the schema covers the single parameter well, the overall context lacks details needed for effective use, especially compared to siblings that handle related tasks like 'get_styled_text_segments'.

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?

The input schema has 100% description coverage, with 'nodeId' clearly documented as 'ID of the node to scan'. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints. Given the high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract from the schema's clarity.

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 ('scan') and target ('all text nodes in the selected Figma node'), making the purpose immediately understandable. It distinguishes itself from siblings like 'get_node_info' or 'get_styled_text_segments' by focusing specifically on text node scanning rather than general node information or styled text details. However, it doesn't explicitly contrast with all potential alternatives like 'get_nodes_info' which might also retrieve text data.

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 minimal guidance on when to use this tool, only implying usage when text nodes within a Figma node need scanning. It offers no explicit comparison to siblings like 'get_styled_text_segments' (which handles styled text) or 'get_node_info' (which provides general node data), nor does it mention prerequisites such as needing a valid node ID or when not to use it (e.g., for non-text elements). This lack of contextual differentiation leaves gaps in usage clarity.

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