Skip to main content
Glama

transform_layer

Destructive

Transform one layer (layer / layer_id, else the active layer): op selects fit | scale | move | rotate | flip | skew | free, each documented on op. Rotate, skew and free grow the layer so nothing clips; a layer with no transparency gets one (alpha_added). REFUSES when the layer, or the layers inside a group target, carries a masked filter or an unmasked effect this transform cannot keep locked to the content.

Input Schema

NameRequiredDescriptionDefault
opYes'fit' scales the layer to fit (letterbox) or fill (cover) the canvas, preserving aspect, and centers it (mode fit|fill, idempotent). 'scale' is uniform (scale_percent) or non-uniform (scale_x_percent/scale_y_percent) — multiplicative, anchored at the layer's own center; a NON-uniform scale is refused while an unmasked position/direction-dependent effect filter (vignette/motion_blur/drop_shadow) is present. 'move' translates — pass exactly ONE of delta (relative), absolute (top-left target), or center_on (center target), each a {x, y} object (flat delta_x/absolute_x fields are not accepted); mixing modes is refused. 'rotate' rotates by relative degrees (positive clockwise) around the layer's own center; the layer GROWS to fit the rotated content — nothing is clipped; an arbitrary (non-90°-multiple) angle is refused while such an effect is present. 'flip' mirrors horizontal|vertical in place (axis). 'skew' slants the layer (skew_h_degrees/skew_v_degrees) around its own center. 'free' is a numeric free transform in one matrix: scale_x_percent/scale_y_percent + degrees + offset_x/offset_y. skew and free are always refused while such an effect is present (no angle is safe for either). A text layer stays a text layer through every op, never rasterized.
axisNoflip only. 'horizontal' mirrors left-right; 'vertical' mirrors top-bottom.
modeNofit only. 'fit' letterboxes inside the canvas (shorter edge touches); 'fill' covers it (longer edge touches, overflow is left outside the canvas, not cropped). Defaults to 'fit'.
deltaNoA document-pixel point: {x, y}. move, RELATIVE mode: offset from the layer's current top-left. Mutually exclusive with absolute/center_on.
imageYesImage id, as returned by open_photo.
layerNoLayer name. Defaults to the selected layer, or the topmost layer if none is selected. Ignored when layer_id is given.
degreesNorotate: relative rotation angle, positive clockwise, around the layer's own center. free: relative rotation angle (default 0), applied in the same combined matrix as the scale and offset.
absoluteNoA document-pixel point: {x, y}. move, ABSOLUTE mode: target for the layer's top-left corner. Mutually exclusive with delta/center_on.
layer_idNoLayer id, as inspect (and any tool that creates a layer) reports it. Takes priority over `layer`, and is the only way to address one of two layers that share a name.
offset_xNofree only. Horizontal translation in document pixels, applied last. Defaults to 0.
offset_yNofree only. Vertical translation in document pixels, applied last. Defaults to 0.
center_onNoA document-pixel point: {x, y}. move, CENTER mode: target for the layer's center point. Mutually exclusive with delta/absolute.
interpolationNoResampling filter for this call, every op. Always set explicitly here — never carried over from a previous transform_layer call.cubic
scale_percentNoscale only. Uniform scale percentage (100 = unchanged). 1..10000.
skew_h_degreesNoskew only. Horizontal slant angle in degrees — positive slants the top edge right. At least one of skew_h_degrees/skew_v_degrees is required.
skew_v_degreesNoskew only. Vertical slant angle in degrees — positive slants the left edge down.
scale_x_percentNoscale/free: horizontal scale percentage (100 = unchanged), 1..10000. scale: pair with scale_y_percent for non-uniform stretch/squash; the other axis defaults to scale_percent, or 100 if that is absent too.
scale_y_percentNoscale/free: vertical scale percentage. See scale_x_percent.

Output Schema

NameRequiredDescriptionDefault
axisNo
modeNo
boundsNo
degreesNo
layer_idNo
offset_xNo
offset_yNo
text_layerNo
alpha_addedNo
interpolationNo
scale_percentNo
skew_h_degreesNo
skew_v_degreesNo
scale_x_percentNo
scale_y_percentNo
effect_update_failuresNoNames of effect filters (position/direction/size-dependent ones tracked through geometry changes — a center, an angle, an offset, or a size-dependent blur radius under resize) whose own params could not be updated for this transform (a live update failure) -- they were restored to their OLD values in manage_filters's own ledger (guaranteed), and the live render was also asked to restore those same OLD values (best effort — it can, rarely, also fail). Omitted when every filter updated cleanly.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior5/5

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

Annotations already declare destructive=true and idempotent=false, but the description adds substantial context beyond them: rotate/skew/free grow the layer so nothing clips, a layer without transparency gains one (alpha_added), and the precise refusal conditions for masked filters / unmasked effects. This tells the agent about side effects and failure modes the annotations do not.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, no filler, with the layer-resolution rule and op list front-loaded ahead of side effects and refusals. The first sentence is dense with stacked clauses and backticked tokens, but every element earns its place.

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?

An output schema exists, so return values need no explanation, and annotations cover the safety profile. Combined with coverage of side effects (alpha_added, layer growth), refusal preconditions, and the op selector, an agent has everything needed to invoke this 18-parameter tool correctly.

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% and the schema itself is unusually rich (per-op semantics, mutual exclusions, interpolation carry-over caveat), so the baseline is 3. The description mostly restates the op enum and points to 'each documented on op' rather than adding syntax or format meaning beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (transform) and a clearly scoped resource (one layer, resolved via layer/layer_id or the active layer), and enumerates the op selector values. The 'one layer' scope implicitly separates it from image-level siblings like transform_image, but no sibling is named explicitly, so it stops short of full differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit when-not: it REFUSES when the layer or a group's inner layers carry a masked filter or an unmasked effect that cannot stay locked to the content. That is a real applicability gate. It does not, however, route the agent to an alternative tool (e.g. bake, add_effect) when refusal occurs, leaving some inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources