Skip to main content
Glama

set_instance_overrides

Apply copied component overrides to selected instances in Figma, swapping them to match the source component's properties.

Instructions

Apply previously copied overrides to selected component instances. Target instances will be swapped to the source component and all copied override properties will be applied.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceInstanceIdYesID of the source component instance
targetNodeIdsYesArray of target instance IDs. Currently selected instances will be used.

Implementation Reference

  • The handler function that executes the 'set_instance_overrides' tool. It sends the sourceInstanceId and targetNodeIds to the Figma plugin via sendCommandToFigma, processes the result typed as setInstanceOverridesResult, and returns formatted content blocks based on success or failure.
    async ({ sourceInstanceId, targetNodeIds }) => {
      try {
        const result = await sendCommandToFigma("set_instance_overrides", {
          sourceInstanceId: sourceInstanceId,
          targetNodeIds: targetNodeIds || []
        });
        const typedResult = result as setInstanceOverridesResult;
        
        if (typedResult.success) {
          const successCount = typedResult.results?.filter(r => r.success).length || 0;
          return {
            content: [
              {
                type: "text",
                text: `Successfully applied ${typedResult.totalCount || 0} overrides to ${successCount} instances.`
              }
            ]
          };
        } else {
          return {
            content: [
              {
                type: "text",
                text: `Failed to set instance overrides: ${typedResult.message}`
              }
            ]
          };
        }
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error setting instance overrides: ${error instanceof Error ? error.message : String(error)}`
            }
          ]
        };
      }
    }
  • Zod schema for input validation of the 'set_instance_overrides' tool parameters: sourceInstanceId (string) and targetNodeIds (array of strings).
    {
      sourceInstanceId: z.string().describe("ID of the source component instance"),
      targetNodeIds: z.array(z.string()).describe("Array of target instance IDs. Currently selected instances will be used.")
    },
  • Registration of the 'set_instance_overrides' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    server.tool(
      "set_instance_overrides",
      "Apply previously copied overrides to selected component instances. Target instances will be swapped to the source component and all copied override properties will be applied.",
      {
        sourceInstanceId: z.string().describe("ID of the source component instance"),
        targetNodeIds: z.array(z.string()).describe("Array of target instance IDs. Currently selected instances will be used.")
      },
      async ({ sourceInstanceId, targetNodeIds }) => {
        try {
          const result = await sendCommandToFigma("set_instance_overrides", {
            sourceInstanceId: sourceInstanceId,
            targetNodeIds: targetNodeIds || []
          });
          const typedResult = result as setInstanceOverridesResult;
          
          if (typedResult.success) {
            const successCount = typedResult.results?.filter(r => r.success).length || 0;
            return {
              content: [
                {
                  type: "text",
                  text: `Successfully applied ${typedResult.totalCount || 0} overrides to ${successCount} instances.`
                }
              ]
            };
          } else {
            return {
              content: [
                {
                  type: "text",
                  text: `Failed to set instance overrides: ${typedResult.message}`
                }
              ]
            };
          }
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error setting instance overrides: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • TypeScript interface defining the expected result structure from the Figma plugin for set_instance_overrides.
    interface setInstanceOverridesResult {
      success: boolean;
      message: string;
      totalCount?: number;
      results?: Array<{
        success: boolean;
        instanceId: string;
        instanceName: string;
        appliedCount?: number;
        message?: string;
      }>;
    }
Behavior2/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 describes the action ('Apply', 'swapped') which implies mutation, but doesn't specify whether this is destructive (e.g., overwrites existing overrides), requires specific permissions, has side effects on other instances, or what happens on failure. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 action ('Apply previously copied overrides to selected component instances') and adds necessary detail in a second clause. Every word contributes to understanding the tool's function without redundancy or fluff.

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 operation with 2 required parameters), lack of annotations, and no output schema, the description is minimally adequate. It covers the basic purpose and parameters but lacks details on behavioral traits (e.g., side effects, error handling) and output expectations. For a tool that modifies component instances, more context on safety and results would be beneficial.

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%, with both parameters ('sourceInstanceId' and 'targetNodeIds') fully documented in the schema. The description adds marginal value by implying that 'targetNodeIds' corresponds to 'selected component instances' and that overrides are 'previously copied', but doesn't provide additional syntax, format, or constraints beyond what the schema already states. Baseline 3 is appropriate when schema does the heavy lifting.

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 ('Apply previously copied overrides') and target ('selected component instances'), specifying that target instances will be swapped to the source component with copied override properties applied. It distinguishes from sibling tools like 'get_instance_overrides' (which retrieves overrides) and 'clone_node' (which creates copies), though it doesn't explicitly name alternatives.

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

Usage Guidelines3/5

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

The description implies usage context by mentioning 'previously copied overrides' and 'selected component instances', suggesting it should be used after copying overrides and when instances are selected. However, it doesn't explicitly state when to use this tool versus alternatives like 'clone_node' or 'set_layout_mode', nor does it provide exclusion criteria or prerequisites beyond the implied state.

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/pipethedev/Talk-to-Figma-MCP'

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