Skip to main content
Glama

set_gradient

Apply linear, radial, angular, or diamond gradients to Figma fills or strokes by node IDs, using color stops, angle or transform, and replace or append modes.

Instructions

Apply a gradient paint to fills or strokes. Give either angle in degrees (0 = left→right, 90 = top→bottom, 180 = right→left, 45 = top-left corner → bottom-right corner; measured in the node's box so corners always hit 0%/100% for LINEAR; default 90 for LINEAR, 0 otherwise) or a raw 2x3 transform (Figma gradientTransform). RADIAL/DIAMOND/ANGULAR are centered and fill the box. mode replace (default) replaces all paints; append adds on top. Returns per-node results ({id, ok, ...} or {id, error}); one failing node does not abort the batch.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "nodeIds": "<nodeIds>",
      "stops": "<stops>"
    },
    "name": "set_gradient"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileNoTarget file (fileKey, id or name). Defaults to the most recently active file.
modeNo
typeNoDefault LINEAR
angleNo
stopsYesColor stops, position 0..1
targetNoDefault fill
nodeIdsYesFigma node ids, e.g. ['12:34']
opacityNoPaint opacity
transformNoRaw gradientTransform [[a,b,tx],[c,d,ty]] (overrides angle)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the burden well: it discloses that 'replace' wipes existing paints, that append stacks on top, and that a failing node does not abort the batch, plus the per-node return shape. It does not mention permission requirements or whether the paint is created when a node has no existing fill/stroke, which keeps it from a 5.

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 purpose is front-loaded in the first sentence, and each subsequent clause covers a distinct decision the caller must make (angle vs transform, type behavior, mode, return/failure semantics). No sentence is redundant, and the dense angle parenthetical is justified because that convention is otherwise unguessable.

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

Completeness5/5

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

For a 9-parameter mutation tool with no annotations and no output schema, the description covers defaults, mutual exclusivity of angle/transform, destructive replace semantics, and the return/error contract. An agent has enough information to call it correctly without trial and error.

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 78%, and the description adds real meaning beyond it for the ambiguous parameters: exact angle orientation, box-relative measurement, type-specific defaults (90 for LINEAR, 0 otherwise), transform as a Figma gradientTransform that overrides angle, and replace/append behavior. Remaining parameters (file, nodeIds, stops, opacity, target) are left to the schema, which already documents them.

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 opens with a precise verb+resource+scope: 'Apply a gradient paint to fills or strokes.' It also names the gradient types accepted, so an agent can immediately tell this apart from siblings like set_stroke or create_paint_style, which are not gradient-specific.

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?

It clearly sets out the in-tool choice between supplying `angle` versus a raw `transform`, notes that transform overrides angle, and explains replace vs append semantics with defaults. It stops short of routing the agent against sibling tools (e.g., when a paint style would be preferable), so it is not a full when/when-not guide.

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