Skip to main content
Glama
arinspunk

Claude Talk to Figma MCP

by arinspunk

get_selection

Retrieve details about currently selected elements in Figma to enable AI-assisted design analysis and modifications.

Instructions

Get information about the current selection in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'get_selection' tool. It sends the 'get_selection' command to the Figma plugin using sendCommandToFigma and returns the result as JSON-formatted text content. Includes try-catch for error handling.
    async () => {
      try {
        const result = await sendCommandToFigma("get_selection");
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error getting selection: ${error instanceof Error ? error.message : String(error)}`,
            },
          ],
        };
      }
    }
  • The registration of the 'get_selection' tool using server.tool(), specifying name, description, empty input schema ({}), and the handler function. This is called within registerDocumentTools.
    server.tool(
      "get_selection",
      "Get information about the current selection in Figma",
      {},
      async () => {
        try {
          const result = await sendCommandToFigma("get_selection");
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting selection: ${error instanceof Error ? error.message : String(error)}`,
              },
            ],
          };
        }
      }
    );
  • Call to registerDocumentTools from the main registerTools function, which performs the tool registrations including get_selection.
    registerDocumentTools(server);
  • Invocation of registerTools(server) in the main server setup, which chains to the registration of get_selection.
    registerTools(server);
  • The 'get_selection' command is included in the FigmaCommand type union, used for type safety in command handling.
    | "get_selection"
Behavior2/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 of behavioral disclosure. It states the tool 'Get information' but does not specify what information is returned (e.g., node details, selection bounds), whether it requires specific permissions, or how it behaves if no selection exists. This leaves significant gaps for a tool that interacts with user state.

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, efficient sentence that directly states the tool's purpose without any fluff. It is front-loaded and every word earns its place, making it highly concise and well-structured for quick understanding.

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

Completeness2/5

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

Given the complexity of interacting with a dynamic selection in a design tool, the description is incomplete. It lacks details on return values (no output schema), error conditions, or behavioral nuances. Without annotations or output schema, the agent has insufficient information to use this tool effectively in context.

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 input schema has 0 parameters with 100% coverage, so no parameters need documentation. The description appropriately does not discuss parameters, aligning with the schema. A baseline of 4 is applied as it compensates for the lack of parameters by not adding unnecessary details.

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 clearly states the verb 'Get' and the resource 'information about the current selection in Figma', making the purpose explicit. However, it does not distinguish this from sibling tools like 'get_node_info' or 'get_nodes_info', which also retrieve information about nodes, though those may target specific nodes rather than the current selection.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives such as 'get_node_info' or 'get_nodes_info'. It lacks context on prerequisites (e.g., whether a selection must exist) or exclusions, leaving the agent to infer usage from the tool name alone.

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

Install Server

Other Tools

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