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

Copy Markdown View Source

Response shaping for the references tool.

This module does not classify. It takes the classification a caller already holds — %{source: source, recipe: recipe} — and renders it. That is not a style choice: YmerNode.References.list_classified/1 has to classify every candidate to apply a source filter, so a renderer that classified again would repeat that work per reference, and two derivations straddling an accept could disagree inside one response. Taking the answer as an argument makes both impossible rather than merely unlikely.

Source and recipe are still derived rather than stored — see YmerNode.References.Sources — so a read reflects the declarations in force at that moment. What changed is only where in the call that derivation happens: once, at the action, instead of once per rendered row.

A blank fragment, a nil recipe and empty tags are compacted away rather than sent as noise — the absent-when-empty wire contract.

Summary

Functions

One entry from YmerNode.References.list_classified/1, which already carries its own classification.

One find hit — a classified entry plus its score, which is absent in filter mode because nothing ranked.

What read answers for one reference: the entry's stamps and size, and what was served — a window of text, an image under image for the tool's own run/2 clause to lift out as image content, or a description with the path relative to the cache directory. fetched says whether this read ran the script.

One reference, rendered against a classification the caller has already made.

What refresh answers: the outcome, and the entry's stamps and size.

Functions

classified(map)

One entry from YmerNode.References.list_classified/1, which already carries its own classification.

find_hit(hit)

One find hit — a classified entry plus its score, which is absent in filter mode because nothing ranked.

read(reference, map)

What read answers for one reference: the entry's stamps and size, and what was served — a window of text, an image under image for the tool's own run/2 clause to lift out as image content, or a description with the path relative to the cache directory. fetched says whether this read ran the script.

reference(reference, map)

One reference, rendered against a classification the caller has already made.

refreshed(reference, map)

What refresh answers: the outcome, and the entry's stamps and size.