Skip to main content
Glama
yhc984

Talk to Figma MCP

by yhc984

get_document_info

Retrieve comprehensive details about the active Figma design document, including structure, elements, and metadata for analysis or integration.

Instructions

Get detailed information about the current Figma document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core implementation of get_document_info tool. Fetches and returns detailed information about the current Figma document/page including name, ID, type, children list, and page structure.
    async function getDocumentInfo() {
      await figma.currentPage.loadAsync();
      const page = figma.currentPage;
      return {
        name: page.name,
        id: page.id,
        type: page.type,
        children: page.children.map((node) => ({
          id: node.id,
          name: node.name,
          type: node.type,
        })),
        currentPage: {
          id: page.id,
          name: page.name,
          childCount: page.children.length,
        },
        pages: [
          {
            id: page.id,
            name: page.name,
            childCount: page.children.length,
          },
        ],
      };
    }
  • MCP tool registration for 'get_document_info'. Includes empty input schema ({}), description, and proxy handler that forwards the command to the Figma plugin via WebSocket and formats the response as MCP content.
    server.tool(
      "get_document_info",
      "Get detailed information about the current Figma document",
      {},
      async () => {
        try {
          const result = await sendCommandToFigma('get_document_info');
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result, null, 2)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting document info: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Input schema for get_document_info tool: empty object indicating no parameters required.
    "get_document_info",
    "Get detailed information about the current Figma document",
    {},
  • Dispatch case in handleCommand function that routes 'get_document_info' command to the getDocumentInfo handler.
    case "get_document_info":
      return await getDocumentInfo();

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior2/5

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

No annotations are present, so the description must carry the burden of disclosing behavior. It only states 'get detailed information', which implies a read, but does not explain what details are returned, permissions needed, or any limitations. This is under-informative for an agent.

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?

One concise, front-loaded sentence with no unnecessary words. Every word contributes to the purpose.

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?

The tool is simple, but with no output schema or annotations, the description should clarify what 'detailed information' includes. The current text is vague and leaves the agent guessing about the response structure. It is minimally acceptable but not complete.

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 schema coverage is trivially 100%. The description does not need to add parameter semantics, and the baseline of 4 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Uses a specific verb ('get') and resource ('document') with scope ('current Figma document'). Clearly distinguishes from siblings like get_node_info and get_selection.

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?

Implies usage for document-level information through the description, but does not explicitly mention when to use it versus alternatives such as get_node_info or read_my_design. No exclusions or contextual guidance provided.

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