Skip to main content
Glama

ps_layer_mask

Destructive

Create, delete, apply, or gradient-fade a Photoshop layer mask to reveal selections, hide areas, and blend edges; use gradient for fade-outs and apply only when baking destructively.

Instructions

Manage the active layer's mask — choose with op. create: add a layer mask; if a selection is active it reveals the selection and hides the rest (the one-call "mask the placed image to the frame opening" — make the selection first, then create); with no selection, a reveal-all mask; adjustment layers load the current selection into their built-in mask. delete: remove the mask (layer pixels preserved). apply: DESTRUCTIVE — permanently bake the mask into the pixels (outside-mask pixels lost). gradient: draw a linear fade into the mask (fade_to names the side that ends hidden; start/end place the fade; auto-creates the mask; replaces existing mask content and clears any active selection first) — the standard fade for reflections, sky blends, and soft edge falloff. Verify with ps_get_preview. Prefer keeping masks non-destructive unless flattening for export. Prefer this tool over a hand-written mask script; it already handles masks and gradients.

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": {
      "op": "<op>"
    },
    "name": "ps_layer_mask"
  }
}

Input Schema

NameRequiredDescriptionDefault
opYescreate: add a layer mask on the active layer (if a selection is active it reveals the selection — the "mask to the frame opening" answer; adjustment layers load the selection into their built-in mask). delete: remove the mask (layer pixels preserved). apply: DESTRUCTIVE — bake the mask into pixels (pixels outside the mask are lost). gradient: draw a linear white→black fade INTO the mask (auto-creates a reveal-all mask if none) — the universal fade-out primitive (reflections, sky blends, edge feathering). REPLACES existing mask content.
endNoop=gradient: 0-1 fraction where the fade completes — fully hidden from here on. Must be greater than start.
startNoop=gradient: 0-1 fraction along the fade direction where the fade begins — the layer stays fully visible up to here.
extentNoop=gradient: measure start/end over the active layer's pixel bounds (default) or the whole canvas. A layer with no pixel bounds falls back to canvas.layer
fade_toNoop=gradient: the side that ends fully HIDDEN (mask black). The opposite side stays fully visible. E.g. a water reflection fades with fade_to=bottom.bottom

Output Schema

NameRequiredDescriptionDefault
toNoop=gradient: fully-hidden end of the drawn fade, doc pixels.
fromNoop=gradient: fully-visible end of the drawn fade, doc pixels.
extentNoop=gradient: 'layer' or 'canvas' — reports the extent actually used.
contextNo
fade_toNo
layer_nameNo
bounds_usedNo
maskAppliedNo
maskCreatedNo
maskDeletedNo
created_maskNoop=gradient: true when the reveal-all mask had to be created first.
hadSelectionNo
mask_gradientNo
activeLayerKindNo
modifiedExistingMaskNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.2

TDQS

A4.6/5.0
Behavior4/5

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

Annotations only declare destructiveHint=true, and the description goes well beyond that by localizing the destructiveness to `apply` ('outside-mask pixels lost'), asserting `delete` preserves layer pixels, and warning that `gradient` replaces existing mask content and clears any active selection. It does not discuss permissions or undo/redo interaction, which keeps it short of the top score.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the resource and the controlling `op` parameter, then broken into per-operation clauses that each carry distinct information. The prose is dense in places, with long compound sentences, but there is no filler or repetition of the title.

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 five-parameter, four-mode mutation tool with an output schema and partial annotations, the description covers the mode semantics, the destructive path, mask replacement behavior, prerequisites, and a verification step via ps_get_preview. Nothing an agent needs before calling it correctly is missing.

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, and the description still adds meaning: it explains the semantics of each `op` value in workflow terms and clarifies `fade_to` as the side that ends hidden, with a concrete reflection example. The start/end/extent parameters are only described in the schema, not the description.

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?

States a specific verb and resource ('Manage the active layer's mask') and immediately partitions it into four named operations via `op`, so the agent knows exactly which capability it is calling. It is also distinguishable from the sibling ps_vector_mask, which handles a different mask type.

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?

Gives per-operation when-to-use guidance: 'create' with a selection for the mask-to-frame-opening case, 'apply' only for flattening for export, 'gradient' for reflections and sky blends. It also states the ordering prerequisite (make the selection first, then create) and an explicit preference rule over hand-written mask scripts.

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