Skip to main content
Glama
MatthewDailey

Figma MCP Server

read_comments

Retrieve all comments from a Figma file to review feedback and track design discussions within collaborative projects.

Instructions

Get all comments on a Figma file

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_keyYesThe key of the Figma file

Implementation Reference

  • Dedicated handler function for the read_comments tool that fetches comments using the helper and returns formatted JSON response as CallToolResult.
    async function doReadComments(fileKey: string): Promise<CallToolResult> {
      const data = await readComments(fileKey);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(data, null, 2),
          },
        ],
      };
    }
  • Tool schema defining name, description, and input schema for read_comments.
    const READ_COMMENTS: Tool = {
      name: "read_comments",
      description: "Get all comments on a Figma file",
      inputSchema: {
        type: "object",
        properties: {
          file_key: {
            type: "string",
            description: "The key of the Figma file",
          },
        },
        required: ["file_key"],
      },
    };
  • index.ts:138-140 (registration)
    Registration of the read_comments tool (as READ_COMMENTS) in the list of available tools returned by ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [ADD_FIGMA_FILE, VIEW_NODE, READ_COMMENTS, POST_COMMENT, REPLY_TO_COMMENT],
    }));
  • Dispatch logic within the main CallToolRequest handler that routes calls to the read_comments tool to its dedicated handler.
    if (request.params.name === "read_comments") {
      const input = request.params.arguments as { file_key: string };
      return doReadComments(input.file_key);
  • Supporting utility function that performs the actual Figma API request to fetch comments for the given file key.
    export async function readComments(fileKey: string) {
      const response = await axios.get(`https://api.figma.com/v1/files/${fileKey}/comments`, {
        headers: {
          "X-FIGMA-TOKEN": getFigmaApiKey(),
        },
      });
      return response.data;
    }

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/MatthewDailey/figma-mcp'

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