Skip to main content
Glama
arinspunk

Claude Talk to Figma MCP

by arinspunk

get_local_components

Retrieve all local components from a Figma document to access reusable design elements for AI-assisted design workflows.

Instructions

Get all local components from the Figma document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration and handler implementation of the 'get_local_components' MCP tool. The handler forwards the request to the Figma plugin using sendCommandToFigma and formats the response as text 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)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting local components: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • Inline handler function that executes the tool logic by calling sendCommandToFigma('get_local_components') and returning the result.
    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)}`,
            },
          ],
        };
      }
    }
  • The 'get_local_components' command is defined in the FigmaCommand type union, used for type safety in websocket communications.
    | "get_local_components"

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/arinspunk/claude-talk-to-figma-mcp'

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