YmerNode.Mcp.Tools.References.Validate (Ymer Node v0.5.0)

Copy Markdown View Source

Value validation for the references tool's params.

The dispatch layer checks that a required param is PRESENT but is blind to what it holds, so these functions are the boundary's value checks: every extracted scalar is type-checked before use, and each failure is a distinct atom so YmerNode.Mcp.Tools.References.Errors can render specific recovery guidance rather than one shrug for everything.

Summary

Functions

A watch's cadence and lifetime as integers. Only their type is judged here: which values a watch takes is YmerNode.Schedules.watch/3's to refuse, by name.

The character of a cut line a read window goes on from, from 1 — 1 when absent.

Normalizes a limit.

How many lines a read window holds at most — as many as fit when absent.

The line a read window starts at, from 1 — 1 when absent. A positive numeric string is taken, as limit/1 takes one.

find needs at least one criterion — an empty find is not a table dump; that is list.

Checks a source token against the vocabulary the caller's declarations imply.

Functions

cadence(minutes)

A watch's cadence and lifetime as integers. Only their type is judged here: which values a watch takes is YmerNode.Schedules.watch/3's to refuse, by name.

column(column)

The character of a cut line a read window goes on from, from 1 — 1 when absent.

hours(hours)

id(id)

limit(n)

Normalizes a limit.

The declared integer type is advisory — the dispatch gate checks presence, not value type — so a positive numeric string is accepted, and an over-max value CLAMPS to the maximum rather than bouncing. A caller that asks for 500 wants as many as it can have, and refusing the call teaches it nothing it can act on.

lines(lines)

How many lines a read window holds at most — as many as fit when absent.

offset(offset)

The line a read window starts at, from 1 — 1 when absent. A positive numeric string is taken, as limit/1 takes one.

optional_query(query)

some_criterion(arg1, tags, arg3)

find needs at least one criterion — an empty find is not a table dump; that is list.

source(source, declarations)

Checks a source token against the vocabulary the caller's declarations imply.

The declarations travel in rather than being fetched here: the action has read the seam already, and reading it again to validate one string would be a second query per call — for a token that is checked against the same answer the rest of the call is using.

The token stays a string all the way through. It cannot become an atom: a declared source is an accepted script's name, which is user data, so String.to_existing_atom/1 would fail on every newly accepted script and String.to_atom/1 would let a caller grow the atom table at will.

tags(tags)