Skip to main content
Glama

Swap component

figma_swap_component
Idempotent

Make an existing instance show a different component (a component set swaps to its default variant, or to the variant you name), keeping overrides where Figma can.

Instructions

Make an existing instance show a different component (a component set swaps to its default variant, or to the variant you name), keeping overrides where Figma can. A library component is given by componentKey / componentSetKey and imported first. To switch a variant of the SAME set, figma_set_instance_properties keeps the other values; to place a new instance use figma_create_instance. Editors: Design; unverified: FigJam, Slides.

Input Schema

NameRequiredDescriptionDefault
forceNoOverwrite on purpose. A write to a node someone changed after you last read it is refused (STALE); read it again and resend instead. Pass true only when the person said to overwrite their edit.
nodeIdYesThe INSTANCE to swap.
sessionNoOptional sessionId or file name, to pick a Figma file when more than one is connected.
variantNoFor a set: which variant, e.g. "Size=Large, State=Hover".
componentIdNoThe COMPONENT or COMPONENT_SET to show instead. Exactly one of componentId, componentKey, componentSetKey.
componentKeyNoA published library component's key.
idempotencyKeyNoCaller-owned retry key, ≤128 chars. Re-calling with the same key never executes twice: it returns the existing result, or waits for the op still in flight. Supply your own for anything large — if the MCP client times out (rather than the bridge), only a key you chose can be used to retry safely.
componentSetKeyNoA published library component set's key.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.3.0
    • addedInput schema / properties / force
      Added value: +{
      +  "description": "Overwrite on purpose. A write to a node someone changed after you last read it is refused (STALE); read it again and resend instead. Pass true only when the person said to overwrite their edit.",
      +  "type": "boolean"
      +}
  2. First observedv0.1.1

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already cover safety (destructiveHint false, idempotentHint true); the description adds non-obvious behavior: overrides are preserved only 'where Figma can', and library components are imported first as a side effect. It doesn't spell out what happens to overrides that can't be kept, which is the one thing an agent would want before overwriting a carefully-tuned instance.

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?

Three tight sentences: behavior first, alternatives second, platform scope last. No filler, and the load-bearing information is front-loaded before the sibling routing.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 8-parameter mutation with no output schema, the description covers behavior, alternatives, side effects and platform support. It leaves the return value (e.g. whether the new component/variant is echoed back) and the practical consequence of a lost override unstated.

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?

Schema coverage is 100%, so the baseline is 3, but the description still adds meaning: a component set resolves to its default variant unless `variant` is named, and `componentKey`/`componentSetKey` denote library assets that get imported. That explains the semantics of the key parameters beyond their terse schema strings.

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?

Opens with a specific verb+resource ('Make an existing instance show a different component') and immediately pins down scope: existing instance, not a new one, with variant defaulting rules. It is unmistakable against siblings like figma_create_instance and figma_set_instance_properties.

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?

Explicitly routes away from two siblings with their selecting conditions: figma_set_instance_properties for same-set variants (keeps other values) and figma_create_instance for new instances. It also states editor availability (Design; unverified FigJam/Slides), which is a real usage gate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools