Skip to main content
Glama

set_stf

Set a view's display stretch (ScreenTransferFunction) without altering pixel data, either by copying another view or computing PixInsight auto-stretch values.

Instructions

Set the ScreenTransferFunction (display stretch) of a view without changing its pixels, and return it as rows [m, c0, c1, r0, r1] for R, G, B (K for mono) and luminance. Either copy the STF of from_view_id, or compute PixInsight's auto-stretch exactly as auto_stretch does (per channel sigma = 1.4826 × MAD; c0 = median + shadows_clipping × sigma; m = MTF(target_bg, median − c0); linked: one set of values for R, G and B from the mean clipping point and mean median). An STF is stored with the view and saved in XISF files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
linkedNoColour images: true computes one set of values for R, G and B; false one per channel. Ignored for mono images
view_idYesView whose STF is set
target_bgNoTarget background level, strictly between 0 and 1
from_view_idNoCopy this view's STF instead of computing one; target_bg, shadows_clipping and linked are then not allowed
shadows_clippingNoClipping point relative to the median, in units of sigma = 1.4826 × MAD

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.4.1

TDQS

A4.4/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 well: it discloses that pixels are untouched (display-only mutation), the exact return row layout, and that the STF persists with the view and in XISF files. It omits permission/error behavior, keeping it short of a 5.

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-loads the core purpose before the mode details, and every sentence contributes. The embedded formula is dense but justified for a precision-sensitive stretch operation, though it slightly lengthens the definition.

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?

No output schema exists, yet the description explicitly documents the return value ([m, c0, c1, r0, r1] per channel). Combined with behavior, parameter math, and persistence notes, an agent has everything needed to call it correctly.

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?

Schema coverage is 100% (baseline 3), but the description goes further by explaining the underlying math for shadows_clipping (sigma = 1.4826 × MAD), target_bg (MTF target), and linked (one set of R/G/B values from mean clipping point and median). This adds real meaning beyond the schema's field 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?

States a specific verb (Set) and resource (the ScreenTransferFunction/display stretch of a view), plus a key scope qualifier (without changing its pixels). An agent can distinguish this from siblings like auto_stretch and robust_median_stretch without opening any schema.

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?

Clearly lays out the two operational modes ('Either copy the STF of from_view_id, or compute ... exactly as auto_stretch does') and the mutual exclusion captured in the schema. It gives strong context but does not explicitly state when to prefer this tool over the referenced sibling auto_stretch.

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