Skip to main content
Glama
yhc984

Talk to Figma MCP

by yhc984

get_selection

Retrieve details about currently selected elements in Figma designs to analyze or modify them through natural language commands.

Instructions

Get information about the current selection in Figma

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that retrieves the current Figma page selection, including count and basic node information (id, name, type, visible). This is the primary implementation of the get_selection logic.
    async function getSelection() {
      return {
        selectionCount: figma.currentPage.selection.length,
        selection: figma.currentPage.selection.map((node) => ({
          id: node.id,
          name: node.name,
          type: node.type,
          visible: node.visible,
        })),
      };
    }
  • MCP server tool registration for 'get_selection'. Defines the tool with empty input schema, proxies execution to Figma plugin via sendCommandToFigma, and formats the result as markdown text content.
    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, null, 2)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting selection: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Dispatch registration within the plugin's handleCommand switch statement, routing 'get_selection' commands to the getSelection handler function.
    case "get_selection":
      return await getSelection();
  • TypeScript union type FigmaCommand includes 'get_selection' as a valid command that can be sent to the Figma plugin.
    | 'get_selection'
Behavior2/5

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

With no annotations, the description carries full burden but only states what the tool does, not how it behaves. It doesn't disclose if this is a read-only operation, what information is returned, error conditions, or dependencies like requiring an active selection, which are critical for a tool with no input parameters.

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's front-loaded and wastes no words, making it easy for an agent to parse quickly.

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 no annotations, no output schema, and a simple purpose, the description is incomplete. It doesn't explain what 'information' includes, return format, or behavioral aspects like what happens with no selection, leaving significant gaps for the agent to operate effectively.

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 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description doesn't add param info, but that's acceptable here, earning a baseline score above 3 due to the lack of parameters.

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 action ('Get information') and target ('current selection in Figma'), making the purpose understandable. However, it doesn't differentiate from siblings like 'get_node_info' or 'get_nodes_info' that might also retrieve information about nodes, which prevents a perfect score.

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?

No guidance is provided on when to use this tool versus alternatives such as 'get_node_info' or 'get_nodes_info'. The description implies usage for selections but lacks explicit context or exclusions, leaving the agent to infer based on tool names 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/yhc984/cursor-talk-to-figma-mcp-main'

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