Skip to main content
Glama

squash_stretch_pass

Squash or stretch each frame's drawn shape around a fixed contact edge while preserving volume, adding impact weight to existing sprite animations.

Instructions

Squash or stretch a shape while the edge it rests on stays exactly where it is.

The weight in an impact: a body landing flattens against the ground and spreads
sideways. What makes it read is that the **contact edge does not move**. Scaling a
shape about its centre shortens it from both ends at once, so the thing lifts off the
surface at the very moment it should be pressed into it. Measured on a hand-built
squash before this existed: the contact row rose from 56 to 54, so the ball went *up*
two pixels on impact.

**Volume is preserved**: whatever the shape loses along the anchored axis it gains
across it, so a squash widens and a stretch narrows. That is the arithmetic a caller
would otherwise have to do twice and keep consistent.

**Which of these two tools you want.** `tween_cels` takes the drawing on the *first*
listed frame and resamples that one drawing across all of them, interpolating the
scale as it goes, which is how an inbetween is made. This takes *each frame's own*
drawing and deforms it in place by the same amount, which is how an animation that
already exists gets its weight: every frame of a walk keeps its own pose and is
pressed onto the ground.

Args:
    layer: The layer holding the shape (default: the top one). The drawn box on each
        frame is what gets deformed, not the canvas.
    frames: Which frames to work on, 1-based. Defaults to every frame. A frame with
        nothing drawn on it is reported as skipped rather than failing the pass.
    anchor: The edge that stays put: "bottom" (the usual contact edge), "top",
        "left" or "right". "bottom" and "top" squash vertically, "left" and "right"
        horizontally.
    amount: How much of the anchored axis is given up, 0 to 0.8. 0.2 is a firm
        landing. **Negative stretches** instead, which is the other half of the pair:
        -0.2 makes the shape 20 percent taller and correspondingly narrower, for the
        frames before and after an impact.

Resizing is nearest neighbour, always. Bilinear is what the editor would reach for and
it is wrong here: measured on a 5-colour sprite, it returned 50 colours and 40
semi-transparent pixels, so a single pass would cost the sprite its palette and fringe
its silhouette.

Returns the per-frame report: the box before, the box after, and the coordinate the
anchored edge kept.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "filename": "<filename>"
    },
    "name": "squash_stretch_pass"
  }
}

Input Schema

NameRequiredDescriptionDefault
layerNo
amountNoDefault: 0.2.
anchorNoDefault: "bottom".bottom
framesNo
filenameYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.11.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=false and openWorldHint=false; the description goes well beyond that with volume preservation, in-place per-frame deformation, nearest-neighbour resampling and why bilinear is rejected, and the fact that empty frames are reported as skipped rather than failing. It even describes the return report structure. The only thing left unsaid is whether/how the file is written back or what error conditions look like.

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?

Front-loaded with the core action, then uses bold lead-ins and a clean Args block, so it scans well. The measured anecdotes (contact row 56 to 54, 50 colours from a 5-colour sprite) justify design decisions but are longer than an agent strictly needs to select and call the tool.

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?

For a mutating, multi-parameter tool with no output schema and 40% schema coverage, the description covers behavior, defaults, edge cases, and the return shape (box before, box after, anchored coordinate). The unexplained required `filename` and the absence of any write/error semantics are the remaining gaps.

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

Parameters4/5

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

With schema coverage at 40%, the description carries the burden and mostly does: it documents layer (default top, and that the drawn box per frame is deformed, not the canvas), frames (1-based, default all, skipped-frame behavior), anchor (all four values with axis semantics), and amount (range 0 to 0.8, 0.2 as a firm landing, negatives stretch). The required `filename` parameter is never mentioned, and the layer/filename relationship is left implicit.

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 pair and resource ('Squash or stretch a shape') with the defining constraint up front: the edge it rests on stays exactly where it is. It then explicitly contrasts itself with the closest sibling (`tween_cels`), so an agent can separate the two without opening either 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?

There is a dedicated 'Which of these two tools you want' paragraph that names the alternative and the exact condition selecting it: `tween_cels` resamples one drawing across frames, this deforms each frame's own drawing in place. It also tells the agent when to use negative amounts (frames before/after an impact) and what the default anchor means.

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