Skip to main content
Glama
paragdesai1

Cursor Talk to Figma MCP

by paragdesai1

get_local_components

Retrieve all local components from a Figma document to access reusable design elements within the Cursor AI and Figma integration.

Instructions

Get all local components from the Figma document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP server tool registration. Defines the tool schema (empty params) and handler function that forwards the request to the Figma plugin via sendCommandToFigma WebSocket proxy.
    // Get Local Components Tool
    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)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting local components: ${error instanceof Error ? error.message : String(error)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Core implementation of get_local_components in the Figma plugin. Loads all pages and finds all COMPONENT nodes using figma.root.findAllWithCriteria, returns count and list with id, name, key.
    async function getLocalComponents() {
      await figma.loadAllPagesAsync();
    
      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,
        })),
      };
    }
  • Dispatch registration in Figma plugin's handleCommand switch that calls the getLocalComponents handler.
    case "get_local_components":
      return await getLocalComponents();
Behavior2/5

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

No annotations are provided, so the description carries full burden but only states what the tool does, not how it behaves. It doesn't disclose if this is a read-only operation, what permissions are needed, how results are formatted (e.g., list, paginated), or any rate limits, leaving significant behavioral gaps.

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 directly states the tool's purpose without unnecessary words. It is appropriately sized and front-loaded, with every part contributing essential information.

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, no output schema, and a simple tool with 0 parameters, the description is minimal. It states the basic action but lacks details on return values (e.g., format, structure) or behavioral context, making it incomplete for effective agent use despite low complexity.

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?

With 0 parameters and 100% schema description coverage, the baseline is 4. The description adds no parameter information, which is acceptable since there are no parameters to document, but it doesn't compensate for any gaps (none exist).

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'), providing specific purpose. However, it doesn't explicitly differentiate from sibling tools like 'get_document_info' or 'get_styles' that might also retrieve document metadata, leaving room for ambiguity.

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?

No guidance is provided on when to use this tool versus alternatives. With siblings like 'get_document_info' (which might include components) and 'scan_nodes_by_types' (which could filter for components), the description lacks context for selection, offering only a basic statement without exclusions or recommendations.

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/paragdesai1/parag-Figma-MCP'

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