Skip to main content
Glama
yhc984

Talk to Figma MCP

by yhc984

get_local_components

Retrieve all local components from a Figma document to access reusable design elements for integration or modification.

Instructions

Get all local components from the Figma document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that retrieves all local COMPONENT nodes from the Figma document root using findAllWithCriteria, and returns a structured list with count, ids, names, and keys.
    async function getLocalComponents() {
      const components = figma.root.findAllWithCriteria({
        types: ["COMPONENT"],
      });
    
      return {
        count: components.length,
        components: components.map((component) => ({
          id: component.id,
          name: component.name,
          key: "key" in component ? component.key : null,
        })),
      };
    }
  • MCP server registration of the 'get_local_components' tool, which proxies the command to the Figma plugin via WebSocket and formats the response as MCP content.
    server.tool(
      "get_local_components",
      "Get all local components from the Figma document",
      {},
      async () => {
        try {
          const result = await sendCommandToFigma('get_local_components');
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result, null, 2)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting local components: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Dispatch case in the Figma plugin's handleCommand function that routes 'get_local_components' to the getLocalComponents handler.
    case "get_local_components":
      return await getLocalComponents();
  • Input schema for the tool (empty object, no parameters required).
    {},
  • Inclusion of 'get_local_components' in the FigmaCommand type union for TypeScript type safety.
    | 'get_local_components'
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 a read operation ('Get') but doesn't mention any behavioral traits such as permissions needed, rate limits, pagination, or what 'local components' entails (e.g., scope, format). This leaves significant gaps for a tool with no structured safety hints.

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, front-loading the core action and resource. It's efficiently structured and appropriately sized for a simple tool, earning full marks for conciseness.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what 'local components' means, the return format, or any behavioral context like errors or limitations. For a tool in a complex environment with many siblings, this leaves the agent under-informed.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate, but it could have clarified implicit inputs like document context. Baseline is 4 for zero parameters, as it avoids redundancy.

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') and resource ('all local components from the Figma document'), making the purpose immediately understandable. However, it doesn't distinguish itself from sibling tools like 'get_document_info' or 'get_node_info' that might also retrieve component-related data, missing full differentiation.

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. With siblings like 'get_document_info' or 'get_node_info' that might overlap in functionality, there's no indication of specific use cases, prerequisites, or exclusions, leaving the agent to infer usage.

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/yhc984/cursor-talk-to-figma-mcp-main'

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