Skip to main content
Glama

continuous_clamp

Prevents highlight clipping by adaptively compressing bright values above a per-pixel knee derived from blurred luminance, with soft exponential or hard cutoff modes.

Instructions

Compress bright values in place above a knee that varies per pixel. A luminance image (Rec.709 weights for colour) is blurred with a Gaussian of sigma blur_sigma and divided by its maximum, giving L in [0,1]; the knee is min_clamp + (max_clamp − min_clamp)·(1 − L), so it equals min_clamp where L = 1 and max_clamp where L = 0. mode soft: a value above the knee becomes knee + headroom·(1 − exp(−rate·(value − knee)/headroom)); mode hard: min(value, knee). The same expression is applied to every channel and the result is truncated to [0,1].

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeYessoft: exponential compression above the knee; hard: values above the knee are set to the knee
rateNoSoft mode, required there: steepness of the exponential compression
view_idYesTarget view to clamp (modified in place)
headroomNoSoft mode, required there: the most the output can exceed the knee
max_clampYesKnee where the blurred luminance is 0
min_clampYesKnee where the blurred luminance is at its maximum
blur_sigmaNoGaussian blur sigma of the luminance mask, in pixels; omitted = max(60, round(image width / 100))

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.1

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and fully pays it: it reveals in-place mutation, Rec.709 luminance weighting, Gaussian blur normalization, the exact knee formula, both mode equations, per-channel application, and final truncation to [0,1].

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 main intent is front-loaded, and the remaining sentences are dense with necessary mathematical detail rather than filler. Despite its length, it is an efficient specification for a complex operation.

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?

The algorithmic behavior and all seven parameters are covered, and in-place modification makes a return-value description less important. The formula, modes, parameter roles, and side effects are self-contained enough for an agent to invoke the tool correctly.

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

Parameters5/5

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

Although schema coverage is 100%, the description adds substantial parameter meaning: it maps min_clamp/max_clamp to the knee endpoints, explains blur_sigma's role in the mask, and defines how rate and headroom shape the soft-mode curve. This goes well beyond the short schema descriptions.

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 opening sentence states a specific verb and resource: it compresses bright values in place above a per-pixel knee. The detailed luminance/blur/knee formula further distinguishes this from generic curve/clamp siblings, so an agent can tell exactly what it does.

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

Usage Guidelines2/5

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

The description gives no when-to-use guidance or alternatives. It never says when continuous_clamp should be chosen over run_curves, run_pixelmath, or auto_stretch, and it does not mention prerequisites or excluded cases.

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