Skip to main content
Glama

get_local_components

Retrieve all local components from a Figma document to access design elements for programmatic use.

Instructions

Get all local components from the Figma document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_local_components' MCP tool. It proxies the request to the Figma plugin by calling sendCommandToFigma('get_local_components'), receives the result, and returns it as JSON-formatted text content. Includes error handling.
    // 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)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Registration of the 'get_local_components' tool using McpServer.tool(). Defines the tool name, description, input schema (empty), and handler function.
    // 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)
                  }`,
              },
            ],
          };
        }
      }
    );
  • Input schema for 'get_local_components' tool is empty object ({}), indicating no parameters required.
    // Get Local Components Tool

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/pipethedev/Talk-to-Figma-MCP'

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