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

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.

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

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.

reference(reference, map)

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