Skip to main content
Glama

photoshop_recipe_batch_mockup_replace

Destructive

Batch-replace a named Smart Object in a mockup PSD with each image from a folder, then export flattened JPEG variants while keeping perspective and warp intact.

Instructions

Iterate a directory of asset images, replace the contents of the named Smart Object in the active mockup PSD for each asset, and export a flattened JPEG per variant. The mockup's perspective/warp on the Smart Object is preserved.

Use when: the user has a mockup PSD and wants to render it once per design asset (logos, screens, product photos). Do NOT use when: the asset is not a single layer (use photoshop_place_image manually) or when the active document has no Smart Object with the requested name.

Returns: { ok, summary, output_paths, details: { variants: [{ source_asset, output_path }] } }.

Preconditions: active document containing a Smart Object layer named exactly as requested; assets_dir must exist and be readable. Side effects: writes one JPEG per asset; the active mockup PSD ends up with the LAST asset placed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qualityNoJPEG quality on the Photoshop 1-12 scale. Default 10.
assets_dirYesAbsolute path to the directory containing asset files. Subdirectories are NOT recursed. Allowed extensions: jpg/jpeg/png/tif/tiff/psd/psb/webp.
document_idYesPhotoshop 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.
smart_object_layer_nameYesExact name of the Smart Object layer in the active document. Case-sensitive.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.7.33
    • changedInput schema / properties / document_id / description
      Previous value: -"Photoshop document id from photoshop_get_state / photoshop_list_documents. Send null to use the active document. A number activates that document before the tool runs."New value: +"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."
  2. Changed4 schema fields changedv1.7.32
    • addedInput schema / additionalProperties
      Added value: +false
    • changedInput schema / properties / document_id / description
      Previous value: -"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."New value: +"Photoshop document id from photoshop_get_state / photoshop_list_documents. Send null to use the active document. A number activates that document before the tool runs."
    • changedInput schema / properties / document_id / type
      Previous value: -"number"New value: +[
      +  "number",
      +  "null"
      +]
    • changedInput schema / required
      Previous value: -[
      -  "smart_object_layer_name",
      -  "assets_dir"
      -]New value: +[
      +  "smart_object_layer_name",
      +  "assets_dir",
      +  "document_id"
      +]
  3. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and idempotentHint=false, but the description goes further by disclosing that perspective/warp is preserved, that one JPEG is written per asset, and critically that the active PSD ends up holding the LAST asset placed. That last detail is a non-obvious state side effect not captured by annotations. It could still say whether the source assets are modified or whether the export overwrites existing files, so it falls just short of the top mark.

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 the first sentence, followed by clearly labeled Use when / Do NOT use when / Returns / Preconditions / Side effects blocks. Every sentence carries distinct information with no filler.

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 no output schema, the description usefully inlines the return shape and covers preconditions and side effects for a multi-asset, state-mutating batch operation. Remaining minor gaps (behavior on a missing/invalid asset file mid-batch, whether outputs overwrite) keep it slightly short of fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so every parameter (quality scale, allowed extensions, non-recursion, document_id activation semantics, case-sensitive layer name) is already documented in the schema. The description adds only the preconditions that assets_dir must exist and be readable and that the layer name must match exactly, so the baseline 3 applies.

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?

The description opens with a precise chain of verbs and resources: iterate a directory, replace the named Smart Object's contents per asset, export a flattened JPEG per variant. This is clearly distinguishable from adjacent siblings like photoshop_recipe_batch_watermark or photoshop_replace_smart_object_contents, which operate on a single asset.

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?

It provides an explicit 'Use when' condition (user has a mockup PSD and wants one render per design asset) and a 'Do NOT use when' clause naming two failure conditions plus the fallback (photoshop_place_image manually). This is exactly the when/when-not/alternative structure an agent needs.

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

Deploy Server

Other Tools