Skip to main content
Glama

Add layer mask

gimp_add_layer_mask

Add a non-destructive mask to a GIMP layer or group using a white, black, alpha, selection, or grayscale fill, optionally inverted, while keeping the layer's pixels intact.

Instructions

Add a mask to a layer or group. fill: 'white' (everything visible), 'black' (everything hidden), 'alpha' (from the layer's transparency), 'selection' (selected = visible; EMPTY_SELECTION if nothing is selected), 'grayscale' (from the layer's luminance). invert inverts it. Non-destructive: the layer's pixels are kept.

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": {
      "item": "<item>"
    },
    "name": "gimp_add_layer_mask"
  }
}

Input Schema

NameRequiredDescriptionDefault
fillNowhite
itemYesItem id (layer, group, mask...) e.g. 'item:5@a1b2c3d4'.
invertNo

Output Schema

NameRequiredDescriptionDefault
xYesOffset of the layer's top-left corner in image pixels.
yYes
idYes
kindYes
maskYes
modeYesGIMP layer mode nick, e.g. 'normal', 'multiply'.
nameYesLayer name. GIMP keeps names unique within an image ('Title #1').
locksYes
widthYes
heightYes
parentYesId of the parent group, null at the top level.
opacityYes0-100.
visibleYes
childrenNoChild layers of a group, top-most first; null for non-groups.
has_alphaYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.6.0
    • changedOutput schema / $defs / LayerNode / properties / kind / enum
      Previous value: -[
      -  "layer",
      -  "group",
      -  "text"
      -]New value: +[
      +  "layer",
      +  "group",
      +  "text",
      +  "vector",
      +  "link"
      +]
    • changedOutput schema / properties / kind / enum
      Previous value: -[
      -  "layer",
      -  "group",
      -  "text"
      -]New value: +[
      +  "layer",
      +  "group",
      +  "text",
      +  "vector",
      +  "link"
      +]
  2. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Beyond the annotations (which only say the call is not read-only and not destructive), the description discloses that the operation is non-destructive because the layer's pixels are kept, and it documents the EMPTY_SELECTION failure mode for fill='selection'. It stops short of describing behavior when a mask already exists or what the mask's initial dimensions are.

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 one short sentence, followed by compact parenthetical definitions for each fill mode and a closing behavioral note. There is no filler or repetition.

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?

With an output schema present, return values need no explanation, and the description fills the main gaps for a three-parameter mutation tool: fill semantics, invert, and non-destructiveness. Remaining gaps — replacing an existing mask, mask geometry, and undo-group expectations — are minor but real for a mutating call.

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 description coverage is low at 33% — only 'item' is documented in the schema — so the description carries the burden and does so well, spelling out the exact visual effect of each of the five fill enum values. 'invert' is only glossed as 'invert inverts it', which is weaker than the treatment given to fill.

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 opening sentence gives a specific verb and resource ('Add a mask to a layer or group'), which naturally separates it from the sibling verbs in gimp_remove_layer_mask and gimp_set_layer_mask. It does not explicitly name those alternatives, so the agent must infer the distinction from the verb alone.

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

Usage Guidelines2/5

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

The description never states when to use this tool rather than gimp_set_layer_mask, gimp_remove_layer_mask, or an undo checkpoint, nor does it list preconditions such as a selected item or an active undo group. Usage is only implied by the tool's name and the fill option list.

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