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();

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.0.0
    • removedInput schema / additionalProperties
      Removed value: -false
  2. First observed

TDQS

A3.6/5.0
Behavior3/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. It clearly signals a read-only list operation via 'Get,' but it does not define what qualifies as 'local,' whether nested/variant components are included, or what the returned component data contains.

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 sentence with no filler. Every word adds value, and the key scoping terms 'local' and 'Figma document' are included.

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

Completeness3/5

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

For a zero-parameter getter, the description is mostly sufficient to invoke the tool correctly. However, with no annotations and no output schema, the agent is left to infer the exact return structure and the precise boundary of 'local components.'

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 tool has zero parameters, so there is no schema to elaborate on and no parameter meaning to clarify. Baseline 4 applies because no input documentation is needed.

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 states a specific verb and resource: 'Get all local components' scoped to 'the Figma document.' It is clear and distinguishable from siblings like get_selection, get_styles, or get_node_info, though it does not explicitly name an alternative.

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

Usage Guidelines3/5

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

There is no explicit guidance about when to use this tool instead of related tools like scan_nodes_by_types or get_styles. The term 'local' implies it excludes library/team components, but this distinction is not spelled out.

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