photoshop_create_clipping_mask
Creates a clipping mask on a layer so it shows only where the layer below has opaque pixels. Use to clip a layer to the shape beneath it.
Instructions
Create a clipping mask on the active layer (or a named layer).
Users often say: clip to layer below, clipping mask, clip this layer, mask to shape below.
Use when: the active layer should be visible only where the layer directly below it has opaque pixels. Do NOT use when: the layer is already clipped — returns success with already_clipping. Do NOT use when: the layer is the bottom-most layer — there is no base layer to clip into.
Returns: JSON { ok, summary, details: { layer_name, is_clipping, already_clipping? } }. Preconditions: active document; target layer must sit directly above the base layer below it in the same group/stack. Side effects: one history step (groupEvent).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layer_name | No | Optional exact layer name (recursive search). Default: active layer. | |
| document_id | Yes | Photoshop document id from photoshop_get_state / photoshop_list_documents. Send null or 0 to use the active document. A positive number activates that document before the tool runs. When no document is open, a stale id does not block the call. |