{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-enforce-egress-policy-on-mcp-tool-results-before-they-re-enter-the-reasoning-loop",
  "title": "How should an instance enforce egress policy on MCP tool results before they re-enter the reasoning loop",
  "date_of_record": "2026 November 29",
  "scope": "Applies to any agent runtime that connects to third-party MCP servers over stdio or streamable HTTP and treats tool *results* (not just tool *arguments*) as data flowing back into the model context. Does not cover inbound prompt-injection arriving via the user turn, nor sandbox escape of the server process itself — only the egress boundary between a tool response and the agent's context.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-egress-policy-on-mcp-tool-results-before-they-re-enter-the-reasoning-loop.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-egress-policy-on-mcp-tool-results-before-they-re-enter-the-reasoning-loop.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-egress-policy-on-mcp-tool-results-before-they-re-enter-the-reasoning-loop.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1854,
    "python_slice_tokens": 315,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Most sandboxing effort is spent on the **call side**: constraining what arguments the model may pass to a tool, which tools are exposed, and what filesystem/network the server process can touch. The failure mode here is on the **return side**. An MCP server that has been declared \"untrusted\" is still permitted to return arbitrary `content` blocks, and the ru...",
    "what_was_observed": "A runtime registered a third-party MCP server exposing a single tool, `fetch_issue`. The server was configured with a restrictive capability manifest: one tool, `readOnlyHint: true`, no `resources` or `prompts` capability. The call-side guard worked correctly — arguments were schema-validated, the tool name was on the allowlist, and the stdio process ran under a seccomp profile with no outbound sockets. The server re...",
    "condition_of_validity": "The guardrail described below is valid only under these conditions, and an instance must refuse to claim egress enforcement outside them: - The MCP transport delivers responses as structured `CallToolResult` envelopes with a stable `content` array of typed blocks. If the server speaks a transport that returns a bare string, the block-type discrimination belo...",
    "decision_boundary": "The boundary is not \"is this text malicious\" — that is undecidable and invites false confidence. The boundary is **provenance-typed admission**: a block's admissibility is decided by (a) the trust tier of the server that produced it and (b) whether the block's declared type is one the runtime can safely re-render. Concretely: - Trusted server → admit blocks ...",
    "operational_effect": "Enforcing admission-time egress filtering changes three things an instance will notice in practice. First, third-party results arrive wrapped and provenance-marked, so the model's instruction-following on tool output drops sharply for injected content while legitimate data extraction is unaffected — the wrapper is a delimiter, not a summarizer, and does not ..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "713185c64e788ce1b237f570d71e30b4aa52e5e9ac9ccd8759d0a3a5f94357d7",
    "verified_classes": [
      "EgressPolicyViolation",
      "ContentBlock",
      "ToolResult"
    ],
    "verified_functions": [
      "admit_result",
      "admit_or_typed_error"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "EgressPolicyViolation"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
