Expand description
Shared health composer used by the memstead_health MCP tool and any
non-MCP caller (CLI, a future HTTP surface).
Lifted from memstead-mcp/src/server.rs::memstead_health_unified so the
health read-envelope is produced by one transport-neutral builder with no
rmcp type in the path — the MCP wrapper handles drift collection, the
schema anchor, the mem_changed notice channel, and CallToolResult
wrapping; none of that lives here.
The composer returns the complete health payload as a serde_json::Value
(warnings embedded, every include detail section applied). Surface state
the engine does not own — the [mutations] posture and the opaque
[plugin.*] map — is passed in via HealthConfig as prebuilt JSON so
this crate stays free of the MCP server’s config types and the wire bytes
stay identical to the pre-lift handler.
Structs§
- Health
Args - Composer input — packed from the MCP
HealthParams(or a CLIArgs) at the call site. Mirrors the field set the pre-lift handler read offHealthParams. - Health
Config - Surface-owned config the engine does not carry — supplied prebuilt so the
composer inserts the bytes verbatim.
mutationsis{"require_notes": …};pluginis the opaque[plugin.*]pass-through object. Only consulted whenargs.include_configis set.
Enums§
- Compose
Health Error - Typed input failures the composer surfaces. The MCP wrapper maps each
variant to its existing envelope (
UNKNOWN_MEM,INVALID_INPUT) and the engine fault to its typed translator, so the wirecodestays put.
Functions§
- compose_
health - Build the complete health payload.
drift_warningsare the reload warnings the wrapper collected before calling in; the composer extends them with the health report’s own warnings, the limit-clamp notice, and unknown-include notices, then embeds the lot underwarnings. - render_
health_ markdown - Render a composed health payload as a human-readable markdown report
for the MCP text channel.
structured_contentremains the source of truth (this is never parsed back); the markdown exists so the text channel is chunkable likememstead_overviewinstead of a wall of JSON that overflows the response cap under several includes. The size-driving include arrays each render as their own section so the chunker can split a large report cleanly.