Skip to main content
Glama

set_api_key

Configure your Figma API personal access token to enable AI assistants to interact with Figma files, comments, components, and team resources through the MCP server.

Instructions

Set your Figma API personal access token (will be saved to ~/.mcp-figma/config.json)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyYesYour Figma API personal access token

Implementation Reference

  • Main handler for the 'set_api_key' tool. Validates input arguments and delegates to AuthManager.setApiKey to store the API key.
    case 'set_api_key': {
      const args = this.validateArgs<{ api_key: string }>(request.params.arguments, ['api_key']);
      this.authManager.setApiKey(args.api_key);
      return {
        content: [{ type: 'text', text: 'API key set successfully and saved to config file' }],
      };
    }
  • src/index.ts:91-104 (registration)
    Tool registration including name, description, and input schema for 'set_api_key'.
    {
      name: 'set_api_key',
      description: 'Set your Figma API personal access token (will be saved to ~/.mcp-figma/config.json)',
      inputSchema: {
        type: 'object',
        properties: {
          api_key: {
            type: 'string',
            description: 'Your Figma API personal access token'
          }
        },
        required: ['api_key']
      },
    },
  • AuthManager.setApiKey method: stores the API key in memory, persists it via ConfigManager, and sets token info.
    setApiKey(apiKey: string): void {
      this.apiKey = apiKey;
      // 保存到配置文件
      this.configManager.setApiKey(apiKey);
      
      // 由于Figma个人访问令牌不会过期,我们设置一个很远的过期日期
      this.tokenInfo = {
        accessToken: apiKey,
        expiresAt: Date.now() + (365 * 24 * 60 * 60 * 1000) // 1年后
      };
    }
  • ConfigManager.setApiKey: updates the config object and saves it to ~/.mcp-figma/config.json file.
    public setApiKey(apiKey: string): void {
      this.config.apiKey = apiKey;
      this.saveConfig();
    }
  • Input schema definition for the 'set_api_key' tool, specifying the required 'api_key' string parameter.
    inputSchema: {
      type: 'object',
      properties: {
        api_key: {
          type: 'string',
          description: 'Your Figma API personal access token'
        }
      },
      required: ['api_key']
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It reveals that this is a write operation ('Set') that persists data to a local config file, which is useful context. However, it lacks details on permissions needed, error handling, or whether this overwrites existing tokens.

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 key action and resource, with no wasted words. Every part of the sentence adds value by specifying the token type and storage location.

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?

Given the tool's complexity (a write operation with no annotations and no output schema), the description is minimally adequate. It covers the basic purpose and storage behavior but lacks details on success/failure responses, side effects, or integration with other tools like 'check_api_key'.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents the single parameter. The description does not add any additional meaning or context beyond what the schema provides, such as format requirements or examples, meeting the baseline for high coverage.

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?

The description clearly states the specific action ('Set') and resource ('Figma API personal access token'), with additional detail about where it will be saved. It distinguishes itself from sibling tools like 'check_api_key' by being a write operation rather than a read operation.

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

Usage Guidelines4/5

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

The description implies usage context by specifying that the token will be saved to a config file, which suggests this is for initial setup or configuration changes. However, it does not explicitly state when to use this tool versus alternatives or provide any exclusions or prerequisites.

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

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