photoshop_replace_smart_object_contents
Swap the embedded image inside a Photoshop Smart Object while preserving transforms, warps, and Smart Filters. Use it to update mockups or templates with a new asset file.
Instructions
Replace the embedded contents of a Smart Object layer from an image file. Preserves transforms, warps, and Smart Filters on the layer.
Users often say: replace smart object, swap mockup screen, relink embedded file.
Use when: updating a mockup or template Smart Object with a new asset file. Do NOT use when: the target is not a Smart Object — convert first or use photoshop_place_image. Do NOT use for linked Smart Objects that need Relink to File — this replaces embedded contents.
Returns: JSON { ok, summary, details: { layer_name, file_path } }. Preconditions: Smart Object layer active or named; file_path must exist (absolute). Side effects: replaces embedded pixels.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Absolute path to the replacement image file (JPEG, PNG, PSD, etc.) | |
| layer_name | No | Optional exact Smart Object layer name. 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. |