Skip to main content

build_schema_payload

Function build_schema_payload 

Source
pub fn build_schema_payload(
    schema: &Arc<Schema>,
    used_by: Vec<String>,
    verbosity: SchemaVerbosity,
    origin: OriginClass,
) -> Value
Expand description

Build the transport-neutral, rmcp-free JSON payload for a schema read (memstead_schema). Shared by the MCP server, the HTTP surface, and the filesystem-mem MCP flavour so every surface emits identical schema-read bytes from one source. used_by lists the writable mems whose pinned schema resolves to this one; verbosity toggles the full payload versus the lightweight skeleton (see SchemaVerbosity).

origin (OriginClass) is reported on the wire as origin and governs de-framing: a OriginClass::ThirdParty schema is served structural-only — the requested verbosity is overridden to SchemaVerbosity::Lite so none of its prose-instruction fields (system_context, write_rules, writing_guidance, when_to_use, prose description, default_writing_guidance) reach a consuming agent as instructions. A full-verbosity request on a third-party schema therefore still omits them — the override is one-directional.