{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-enforce-capability-scoped-sandboxing-when-an-mcp-server-s-declared-tool-schema-diverges-from-its-runtime-behavior-at-the-regist",
  "title": "How should an instance enforce capability-scoped sandboxing when an MCP server's declared tool schema diverges from its runtime behavior at the registration boundary",
  "date_of_record": "2026 November 27",
  "scope": "Applies to agent runtimes that admit third-party MCP servers through a registration handshake where capabilities are declared in `tools/list` and enforced by a capability token bound to the declared schema. Does not apply to first-party in-process tools or to servers whose transport is fully mediated by a trusted sidecar that re-validates every call.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-capability-scoped-sandboxing-when-an-mcp-server-s-declared-tool-schema-diverges-from-its-runtime-behavior-at-the-regist.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-capability-scoped-sandboxing-when-an-mcp-server-s-declared-tool-schema-diverges-from-its-runtime-behavior-at-the-regist.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-enforce-capability-scoped-sandboxing-when-an-mcp-server-s-declared-tool-schema-diverges-from-its-runtime-behavior-at-the-regist.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2440,
    "python_slice_tokens": 418,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"an untrusted MCP server does something malicious.\" That is expected and handled by the sandbox. The failure is subtler: **the capability grant is computed from the schema the server *declares*, but the sandbox intercepts the call the server *emits*, and those two artifacts are not required to agree.** A server can register a tool named `r...",
    "what_was_observed": "A registration flow admitted an MCP server advertising three tools. During `tools/list` the server returned: - `search_docs` with `inputSchema: {query: string, max_results: integer}` - `fetch_url` with `inputSchema: {url: string}` and a description noting \"read-only, HTTPS only\" - `summarize` with `inputSchema: {text: string}` The runtime minted a capability token per tool, embedding the declared schema hash and the ...",
    "condition_of_validity": "The invariant that must hold for capability scoping to mean anything: > For every `tools/call` the sandbox forwards, the tuple `(server_id, tool_name, canonical_schema_hash, arguments)` must be validated against a capability token that was minted from *that exact* `(server_id, tool_name, canonical_schema_hash)` and whose argument constraints are enforced wit...",
    "decision_boundary": "The runtime must decide, per `tools/call`, between three outcomes: **forward**, **reject-and-notify-agent**, or **reject-and-quarantine-server**. The boundary is drawn by which invariant component failed: The non-obvious boundary: **a schema-hash mismatch is not a validation failure, it is a provenance failure.** Treating it as a normal reject-and-notify (wh...",
    "operational_effect": "After the fix, the observed system's behavior changed in three measurable ways: 1. **Registration latency increased by ~180ms** per server because canonical schema hashing (sorted keys, normalized types) runs at mint time and again at each call. This is the cost of the invariant: you cannot check a hash you did not compute. 2. **Re-list events dropped from s..."
  },
  "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": "406a7793294ea755e929aed24597192f4e0e14a2d85024e533b73aea63ab9c08",
    "verified_classes": [
      "CapabilityProvenanceError",
      "CapabilityToken",
      "CapabilitySandbox"
    ],
    "verified_functions": [
      "canonical_schema_hash",
      "__init__",
      "register",
      "validate_and_forward"
    ],
    "verified_functions_count": 4,
    "defensive_guards_count": 4,
    "raised_exceptions": [
      "CapabilityProvenanceError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "dataclasses",
      "hashlib",
      "json",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
