feat(mcp): list links on lab and medication reads, ids on visit and condition rows

get_labs readings (the latest, earlier values in full, trajectory readings)
carry the fetch ids of what they link to, with linksTruncated; each linked
record is described once per answer in linkedRecords, because one report
usually holds a whole panel and would otherwise repeat on every reading.
fetch lab: and fetch med: list their links like the other record kinds, and
get_medication_schedule rows carry their id and links inline. get_visits and
get_illness_recovery rows carry visit: and condition: ids, so a row's links
are one fetch away. The labs and illness blocks gain an opt-in to carry row
ids; the Coach never asks for them.
This commit is contained in:
Marc-André Bombeck committed 2026-11-02 20:24:28 +01:00
1 parent ea7c6c860e
commit 34302867aa
15 files changed
+564 -88

No files matched your search

+6
View File
@@ -52,6 +52,12 @@ vi.mock("@/lib/ai/coach/tools/executor", () => ({ executeCoachTool }));
vi.mock("@/lib/ai/coach/tools/inventory", () => ({
buildCoachDataInventory: vi.fn(),
}));
// `get_labs` builds its labs block first and asks the Coach only on a miss;
// a miss keeps the health-reader case on the executor it asserts.
vi.mock("@/lib/ai/coach/labs-snapshot", async (importOriginal) => ({
...(await importOriginal<typeof import("@/lib/ai/coach/labs-snapshot")>()),
buildLabsSnapshotBlock: vi.fn(async () => null),
}));
vi.mock("@/lib/mcp/server", async (importOriginal) => {
const actual = await importOriginal<typeof import("@/lib/mcp/server")>();
return {