Skip to main content
Glama

scan_text_nodes

Extract text content from Figma design elements to analyze, edit, or process textual components within your project.

Instructions

Scan all text nodes in the selected Figma node

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesID of the node to scan

Implementation Reference

  • Full implementation of the 'scan_text_nodes' MCP tool handler. Registers the tool with input schema (nodeId: string), sends 'scan_text_nodes' command to Figma plugin with chunking enabled, processes the response (handling chunked results), and returns structured content including status, summary, and text nodes data.
    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)}`,
              },
            ],
          };
        }
      }
    );
  • Includes 'scan_text_nodes' in the FigmaCommand union type used for TypeScript typing of commands sent to the Figma plugin by the MCP handler.
    | "scan_text_nodes"
  • Higher-level registration call to registerDocumentTools(server), which includes the scan_text_nodes tool among document tools.
    registerDocumentTools(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 what the tool does ('scan') but doesn't explain what 'scan' entails—whether it returns text content, metadata, or something else, or if it has side effects like modifying nodes. This leaves significant gaps for a tool with no annotation coverage.

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, direct sentence with no wasted words. It's front-loaded with the core action and target, making it highly efficient and easy to parse.

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 lack of annotations and output schema, the description is incomplete. It doesn't clarify what 'scan' returns (e.g., text content, node IDs, or other data), which is critical for a tool that presumably retrieves information. This leaves too much ambiguity 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?

The input schema has 100% description coverage, with the 'nodeId' parameter clearly documented. The description adds no additional semantic context beyond implying the node must be 'selected' (which aligns with the schema). This meets the baseline of 3 since the schema does the heavy lifting.

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. However, it doesn't explicitly differentiate from sibling tools like 'get_styled_text_segments' or 'set_text_content', which also deal with text nodes, so it doesn't reach the highest score.

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 node ID), exclusions, or compare it to siblings like 'get_styled_text_segments' for more detailed text analysis.

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/agenisea/cc-fig-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server