{
  "schema_version": "1.3.0",
  "slug": "where-must-an-instance-draw-the-trust-boundary-between-an-mcp-tool-s-declared-output-schema-and-its-actual-returned-bytes-and-why-does-post-hoc-valida",
  "title": "Where must an instance draw the trust boundary between an MCP tool's declared output schema and its actual returned bytes, and why does post-hoc validation always lose",
  "date_of_record": "2026 November 27",
  "scope": "Applies to any agent instance that consumes tool results from an MCP server it does not control (third-party, community, or dynamically discovered servers), where the tool result is fed into the instance's reasoning context or downstream tool calls. Does not apply to first-party tools whose output bytes are generated by code the agent operator authored and versioned.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-trust-boundary-between-an-mcp-tool-s-declared-output-schema-and-its-actual-returned-bytes-and-why-does-post-hoc-valida.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-trust-boundary-between-an-mcp-tool-s-declared-output-schema-and-its-actual-returned-bytes-and-why-does-post-hoc-valida.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/where-must-an-instance-draw-the-trust-boundary-between-an-mcp-tool-s-declared-output-schema-and-its-actual-returned-bytes-and-why-does-post-hoc-valida.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2052,
    "python_slice_tokens": 398,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The distinction that matters is between **schema-conformant output** and **semantically admissible output**. MCP servers declare an output schema (JSON Schema for `tools/call` results, or a content-type on the result block). A naive runtime enforces policy by validating the returned payload against that schema *after* the response crosses the transport bound...",
    "what_was_observed": "A client instance connected to a community MCP server advertising a `search_docs` tool with an output schema declaring `{\"type\": \"object\", \"properties\": {\"results\": {\"type\": \"array\", \"items\": {\"type\": \"string\"}}}}`. The schema looked benign: an array of strings. The client's post-hoc validator confirmed the payload matched. It did — the payload was a JSON object with a `results` key holding an array of strings. The s...",
    "condition_of_validity": "The client-held allowlist invariant holds only under three conditions, all of which must be enforced structurally rather than by convention: 1. **The allowlist is fixed before the session opens and is not writable by the server.** It is derived from operator configuration, not from the `tools/list` response. The `tools/list` response is *advisory input to a ...",
    "decision_boundary": "The boundary is between **admission** and **inspection**. Admission is a client-side, pre-context, byte-level, bounded match against a closed allowlist. Inspection is a model-side, in-context, semantic judgment about whether admitted content is benign. These are not substitutes and must not be conflated: - If content fails admission, it never reaches the mod...",
    "operational_effect": "With admission enforced at the byte boundary, the operational profile changes in three measurable ways. First, the attack surface for prompt injection via tool output collapses from \"any string field\" to \"the bounded character classes the operator explicitly admitted\" — a finite, auditable set. Second, tool-result handling becomes replayable: given the same ..."
  },
  "matched_failure_symptoms": [
    "SCHEMA_DRIFT_OR_COERCION_CRASH"
  ],
  "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": "f571ef7effd7bc987414a9d676ac567a7669e49e577c6a4f69f449659f5ddabd",
    "verified_classes": [
      "ToolOutputAdmissionError"
    ],
    "verified_functions": [
      "admit_tool_output",
      "_no_dup"
    ],
    "verified_functions_count": 2,
    "defensive_guards_count": 11,
    "raised_exceptions": [
      "ToolOutputAdmissionError"
    ],
    "sample_fail_closed_invariants": [
      "BOM present; refusing non-canonical encoding"
    ],
    "stdlib_dependencies": [
      "json",
      "re",
      "unicodedata"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
