Skip to main content

Module mcp_context

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/get messages into a labeled, untrusted-provenance block.
wrap_resource_contents
Wrap resources/read contents in a provenance block. Text content is scrubbed + length-bounded via sanitize_api_error; blobs are summarized, never dumped.