Skip to main content
Glama

resolve_variable_by_name

Find variable IDs by name to bind design tokens like 'base-100' or 'primary' in Figma, enabling precise component styling and design system management.

Instructions

Find a variable ID by its name. Useful for binding variables when you know the semantic name (e.g., 'base-100', 'primary').

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the variable to find (e.g., 'base-100', 'primary', 'neutral')
collectionNameNoOptional: Filter by collection name

Implementation Reference

  • Registration of the MCP tool 'resolve_variable_by_name' using server.tool(). Includes tool description, Zod input schema (name: string, optional collectionName: string), and handler that proxies the request to Figma via sendCommandToFigma and returns the JSON result or error message.
    server.tool( "resolve_variable_by_name", "Find a variable ID by its name. Useful for binding variables when you know the semantic name (e.g., 'base-100', 'primary').", { name: z.string().describe("The name of the variable to find (e.g., 'base-100', 'primary', 'neutral')"), collectionName: z.string().optional().describe("Optional: Filter by collection name") }, async ({ name, collectionName }) => { try { const result = await sendCommandToFigma("resolve_variable_by_name", { name, collectionName }); return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error resolving variable: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
  • The handler function executes the tool logic by sending a 'resolve_variable_by_name' command to the Figma plugin via websocket, stringifies the result as text response, or returns an error message.
    async ({ name, collectionName }) => { try { const result = await sendCommandToFigma("resolve_variable_by_name", { name, collectionName }); return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] }; } catch (error) { return { content: [ { type: "text", text: `Error resolving variable: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
  • Zod schema defining the input parameters for the tool: required 'name' (string) and optional 'collectionName' (string).
    { name: z.string().describe("The name of the variable to find (e.g., 'base-100', 'primary', 'neutral')"), collectionName: z.string().optional().describe("Optional: Filter by collection name") },

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/agenisea/cc-fig-mcp'

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