Skip to main content
Glama
yhc984

Talk to Figma MCP

by yhc984

get_styles

Retrieve all design styles from a Figma document to access typography, colors, and effects for consistent design implementation.

Instructions

Get all styles from the current Figma document

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core implementation of get_styles that fetches and formats local Figma styles (paint, text, effect, grid) using Figma Plugin APIs.
    async function getStyles() {
      const styles = {
        colors: await figma.getLocalPaintStylesAsync(),
        texts: await figma.getLocalTextStylesAsync(),
        effects: await figma.getLocalEffectStylesAsync(),
        grids: await figma.getLocalGridStylesAsync(),
      };
    
      return {
        colors: styles.colors.map((style) => ({
          id: style.id,
          name: style.name,
          key: style.key,
          paint: style.paints[0],
        })),
        texts: styles.texts.map((style) => ({
          id: style.id,
          name: style.name,
          key: style.key,
          fontSize: style.fontSize,
          fontName: style.fontName,
        })),
        effects: styles.effects.map((style) => ({
          id: style.id,
          name: style.name,
          key: style.key,
        })),
        grids: styles.grids.map((style) => ({
          id: style.id,
          name: style.name,
          key: style.key,
        })),
      };
    }
  • MCP server registration of the 'get_styles' tool, which proxies the command to the Figma plugin via WebSocket and formats the response.
    server.tool(
      "get_styles",
      "Get all styles from the current Figma document",
      {},
      async () => {
        try {
          const result = await sendCommandToFigma('get_styles');
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(result, null, 2)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error getting styles: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Internal dispatch in Figma plugin's handleCommand switch statement that routes 'get_styles' command to the getStyles handler function.
    case "get_styles":
      return await getStyles();
  • Input schema for get_styles MCP tool (empty object, no parameters required).
    {},
  • Type definition including 'get_styles' in FigmaCommand union type for sendCommandToFigma.
    | 'get_styles'
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states it 'gets' data, implying a read-only operation, but doesn't clarify permissions, rate limits, or what 'styles' encompass (e.g., text, color, effect styles). This leaves significant gaps for a tool that likely returns complex data.

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 front-loads the core purpose without unnecessary words. Every part of the sentence ('Get all styles from the current Figma document') directly contributes to understanding the tool's function.

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 retrieving 'all styles' from a design tool, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'styles' include, the return format, or potential limitations (e.g., pagination), making it inadequate for an agent to use effectively without additional 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 tool has 0 parameters, and schema description coverage is 100%, so there's no need for parameter documentation in the description. The baseline for this scenario is 4, as the description appropriately avoids redundant parameter 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 resource ('all styles from the current Figma document'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_annotations' or 'get_document_info' that also retrieve document metadata, 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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an open document), exclusions, or comparisons to similar sibling tools like 'get_document_info', leaving the agent to infer usage context.

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