Skip to main content
Glama

measure_tonal_presence

Quantify tonal separation between subject and background in an image. Measures metrics like separation, core brightness, faint-structure visibility, and subject fraction to assess contrast and presence.

Instructions

Measure subject and background tones. Every 8th pixel is subject when its luminance is above the background (luminance of the channel medians) + 5 x (median |luminance - background| on a 32 px grid) and at least 2 of its 4 neighbours 3 px away are too; every other sample is background. separation = subject median / background median; core_brightness = mean of the brightest 5% of subject samples; core_to_disk = core_brightness / subject median; faint_structure_visibility = (subject P10 - background P90) / background P90; subject_fraction = subject samples / all samples; roi_mode is compound_roi when a second luminance-weighted cluster, outside 0.15 x width of the centroid and holding over 15% of the weight, lies more than 0.25 x width away, else single. Denominators are held to at least 0.001. Returns JSON: separation, subject_median, background_median, core_brightness, faint_structure_visibility, core_to_disk, subject_fraction, roi_mode, subject_pixel_count. luminance is 0.2126R + 0.7152G + 0.0722B.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
view_idYesView to measure

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.1

TDQS

A3.5/5.0
Behavior4/5

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

With no annotations, the description carries the full behavioral burden and does an unusually thorough job: it specifies pixel classification thresholds, all output metrics, denominator clamping, and the exact luminance formula. The only gap is that it never explicitly states whether the operation is read-only or modifies the view, which is relevant given annotations are absent.

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?

The description is long but every sentence carries substantive algorithmic content; it is front-loaded with the core purpose and then systematically details the calculation. It could be more readable with structure, but for the complexity involved there is little waste.

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?

The description fully enumerates return fields, defines formulas, handles edge cases like denominators clamped to 0.001, and specifies the luminance formula, compensating for the lack of an output schema. It is incomplete only in not stating prerequisites or when to select this tool among the extensive sibling measurement family.

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?

The schema already provides 100% coverage for the single parameter view_id by describing it as 'View to measure', so the baseline is 3. The description adds no additional parameter-level guidance, such as whether the view must be open or what type of image is expected.

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?

The description states a specific verb and resource: 'Measure subject and background tones', and then provides a precise algorithm and metric definitions. It does not explicitly contrast itself with sibling measurement tools, but the subject/background framing and metric names make the tool's function reasonably unambiguous.

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 implies the tool is for measuring tonal separation between subject and background, but it gives no explicit guidance on when to use this tool versus the many sibling measure_* tools, nor any prerequisites or exclusions. An agent would have to infer selection criteria from the algorithm alone.

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