Skip to main content
Glama

set_fill_variable

Bind a color variable to a node's fill for theme-compatible designs instead of hardcoded RGB values.

Instructions

Bind a color variable to a node's fill. Use this for theme-compatible colors instead of hardcoded RGB values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodeIdYesThe ID of the node to modify
variableIdYesThe ID of the color variable to bind
fillIndexNoIndex of the fill to modify (default: 0)

Implementation Reference

  • The execution handler for the 'set_fill_variable' tool. It sends a websocket command to Figma to bind the specified color variable to the node's fill (at optional fillIndex), then returns a success or error message.
    async ({ nodeId, variableId, fillIndex }) => {
      try {
        const result = await sendCommandToFigma("set_fill_variable", {
          nodeId,
          variableId,
          fillIndex: fillIndex ?? 0
        });
        const typedResult = result as { name: string; variableName: string };
        return {
          content: [
            {
              type: "text",
              text: `Successfully bound variable "${typedResult.variableName}" to fill of node "${typedResult.name}"`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error setting fill variable: ${error instanceof Error ? error.message : String(error)}`
            }
          ]
        };
      }
    }
  • Zod input schema for the 'set_fill_variable' tool, validating nodeId (string), variableId (string), and optional fillIndex (number).
    {
      nodeId: z.string().describe("The ID of the node to modify"),
      variableId: z.string().describe("The ID of the color variable to bind"),
      fillIndex: z.number().optional().describe("Index of the fill to modify (default: 0)")
    },
  • Full registration of the 'set_fill_variable' MCP tool on the server, including name, description, input schema, and handler function.
    server.tool(
      "set_fill_variable",
      "Bind a color variable to a node's fill. Use this for theme-compatible colors instead of hardcoded RGB values.",
      {
        nodeId: z.string().describe("The ID of the node to modify"),
        variableId: z.string().describe("The ID of the color variable to bind"),
        fillIndex: z.number().optional().describe("Index of the fill to modify (default: 0)")
      },
      async ({ nodeId, variableId, fillIndex }) => {
        try {
          const result = await sendCommandToFigma("set_fill_variable", {
            nodeId,
            variableId,
            fillIndex: fillIndex ?? 0
          });
          const typedResult = result as { name: string; variableName: string };
          return {
            content: [
              {
                type: "text",
                text: `Successfully bound variable "${typedResult.variableName}" to fill of node "${typedResult.name}"`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error setting fill variable: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
Behavior3/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 mentions the tool 'binds' a variable, implying a mutation that links a color variable to a node's fill, which is useful context. However, it lacks details on permissions, error conditions, or what happens if the variable or node doesn't exist, leaving gaps in behavioral transparency for a mutation tool.

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 two sentences with zero waste: the first states the purpose, and the second provides usage guidelines. It is front-loaded with the core action and efficiently conveys essential information without unnecessary details, making it highly concise and well-structured.

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 mutation with 3 parameters) and no annotations or output schema, the description is moderately complete. It covers purpose and usage well but lacks behavioral details like error handling or response format. For a mutation tool without annotations, this leaves some gaps, but it's adequate for basic understanding.

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 documents all parameters (nodeId, variableId, fillIndex) with clear descriptions. The description adds no additional parameter semantics beyond what the schema provides, such as format examples or constraints, so it meets the baseline score of 3 for high schema 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 ('Bind a color variable to a node's fill') and the resource involved ('node's fill'). It distinguishes this tool from sibling tools like 'set_fill_color' (which likely uses hardcoded colors) by explicitly mentioning 'theme-compatible colors instead of hardcoded RGB values,' providing clear differentiation.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool ('Use this for theme-compatible colors instead of hardcoded RGB values'), providing clear guidance on its intended context. It implies an alternative ('hardcoded RGB values'), which likely refers to sibling tools like 'set_fill_color,' making the usage distinction clear and actionable.

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

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