Skip to main content
Glama

photoshop_fit_layer_to_document

Destructive

Scale the active layer to fit or fill the document canvas while preserving aspect ratio. Use it when a placed layer must match canvas size.

Instructions

Scale the active layer to the document canvas, keeping aspect ratio. fillDocument: false (default) fits inside and may letterbox; true covers the canvas and may crop the layer.

Use when: a placed layer should match the canvas size. Do NOT use when: you want a specific percent — use photoshop_scale_layer. Do NOT use when: the document canvas itself should change size — use photoshop_resize_image or photoshop_crop_document.

Returns: confirmation of the fit. Preconditions: active document and active layer. Side effects: transforms that layer. Does not change document dimensions. Reversible with photoshop_undo.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
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.
fillDocumentNoIf true, fills entire canvas (may crop). If false, fits within canvas (may have margins). Default: false

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"
      +]
    • addedInput schema / required
      Added value: +[
      +  "document_id"
      +]
  3. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/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: it states preconditions (active document and active layer), the exact side effect (transforms that layer, does not change document dimensions), that the operation is reversible via photoshop_undo, and that fillDocument=true may crop the layer — consistent with the destructive annotation.

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?

Front-loaded with the core action, then a clean labeled block (Use when / Do NOT use when / Returns / Preconditions / Side effects). Every sentence carries distinct, actionable information with no padding.

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 mutating tool with no output schema, the description covers return value ('confirmation of the fit'), preconditions, side effects, reversibility, and the destructive crop case. Nothing an agent needs to invoke it correctly is missing.

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 the baseline is 3. The description's explanation of fillDocument (fits inside and may letterbox vs covers the canvas and may crop) largely restates what the schema already documents for that parameter, adding only a framing of the default's consequences.

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 (scale) plus resource (active layer) and scope (to the document canvas, keeping aspect ratio), and explicitly names the sibling tools it is not (photoshop_scale_layer, photoshop_resize_image, photoshop_crop_document). An agent can distinguish it from the ~120 siblings without opening a schema.

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?

Provides explicit 'Use when' and two 'Do NOT use when' clauses, each routing to a named alternative (photoshop_scale_layer for a specific percent; photoshop_resize_image / photoshop_crop_document for changing canvas size). Nothing is left to inference.

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