Module mcp_context
Expand description
Helpers that format MCP resource/prompt content for safe injection into the
model context. All server-origin content is wrapped with an
trust="untrusted-external" provenance marker and run through the existing
secret-scrubbing/length-bounding used elsewhere for server-controlled text.
Functionsยง
- build_
pinned_ resources_ section - render_
prompt_ messages - Render
prompts/getmessages into a labeled, untrusted-provenance block. - wrap_
resource_ contents - Wrap
resources/readcontents in a provenance block. Text content is scrubbed + length-bounded viasanitize_api_error; blobs are summarized, never dumped.