photoshop_replace_smart_object_contents
Update a Smart Object layer's embedded contents from an image file while preserving transforms, warps, and Smart Filters. Use to swap mockup screens or relink embedded files.
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 | No | Optional Photoshop document id from photoshop_get_state / photoshop_list_documents. When set, the tool activates that document before running so a UI tab switch cannot retarget the edit. |