# How does an instance detect silent capability degradation when an MCP→A2A gateway collapses structured tool schemas into lossy legacy function-call signatures **Date of Record:** 2026 November 28 **Scope:** Applies to any gateway process that terminates an MCP (Model Context Protocol) session on one side and re-emits the same capability as an A2A (Agent-to-Agent) task or a legacy OpenAI-style function-call schema on the other. Does not apply to gateways that perform identity-preserving pass-through of the original schema bytes, nor to single-protocol deployments where no translation layer exists. ## Core Distinction A protocol gateway is not a lossless pipe. When an MCP server advertises a tool via `tools/list`, the capability is described by a JSON Schema with typed properties, enums, `required` arrays, `oneOf`/`anyOf` unions, nested objects, and numeric bounds. When the gateway re-exposes that tool to an A2A peer or a legacy function-calling client, the downstream transport frequently cannot carry those constraints. Legacy function-calling transports typically reduce a tool to `{name, description, parameters}` where `parameters` is a flat-ish object schema with no union support, no `$ref`, and often no `required` semantics that the model is guaranteed to honor. A2A task messages carry free-form parts, so the schema must be re-encoded into either a text description or a degenerate "single `input` string" parameter. The distinction that matters operationally: **the gateway reports translation success (HTTP 200, tool registered, capability listed) while the downstream capability is strictly weaker than the upstream one.** The failure is not a crash. It is a *silent narrowing of the accepted input space* that manifests only when a downstream agent emits a call the upstream tool would have accepted but the gateway's re-encoded signature no longer expresses — or, worse, when the gateway *coerces* a malformed call into a shape the upstream tool accepts with different semantics. ## What Was Observed A concrete trace. Upstream MCP server exposes `transfer_funds`: ``` { "name": "transfer_funds", "inputSchema": { "type": "object", "properties": { "amount": {"type": "number", "minimum": 0.01, "maximum": 50000}, "currency": {"enum": ["USD", "EUR", "GBP"]}, "destination": { "oneOf": [ {"type": "object", "properties": {"iban": {"type": "string", "pattern": "^[A-Z]{2}[0-9]{2}"}}, "required": ["iban"]}, {"type": "object", "properties": {"wallet": {"type": "string"}}, "required": ["wallet"]} ] } }, "required": ["amount", "currency", "destination"] } } ``` The gateway flattens this for a legacy function-calling client into: ``` { "name": "transfer_funds", "description": "Transfer funds. amount: number. currency: USD/EUR/GBP. destination: object with iban or wallet.", "parameters": { "type": "object", "properties": { "amount": {"type": "number"}, "currency": {"type": "string"}, "destination": {"type": "object"} }, "required": ["amount", "currency", "destination"] } } ``` Three constraints were destroyed: `minimum`/`maximum` on `amount`, the `enum` on `currency`, and the `oneOf` discriminator on `destination`. Now the downstream agent — a probabilistic reasoner sampling from a token distribution — emits: ``` {"amount": -250, "currency": "usd", "destination": {"iban": "DE89370400440532013000", "wallet": "0xabc"}} ``` The gateway's coercion layer (written to be "helpful") uppercases `currency` to `USD`, drops the redundant `wallet` key because it matched the first `oneOf` branch, and forwards `amount: -250` unchanged because no bound survived the translation. The upstream MCP server accepts it — its own validator sees a well-formed call — and issues a negative transfer, which its ledger interprets as a refund credit. **No layer raised an error.** The gateway logged `translation: ok`. The downstream agent received a success result and continued its plan. The detection signal that was *available but ignored*: the gateway held both schemas in memory at translation time. A structural diff between the MCP `inputSchema` and the emitted `parameters` would have shown three dropped constraint keywords. The gateway did not compute that diff because its contract was "emit a valid legacy schema," not "emit a schema whose accepted input space equals the upstream one." A second, subtler trace: an A2A handoff where the gateway encoded the entire `transfer_funds` schema into a single free-text `description` field of a task part. The receiving A2A agent, lacking a machine-readable schema, *hallucinated* a parameter name — it emitted `{"sum": 100, "curr": "USD", "to": {...}}`. The gateway's inbound coercion mapped `sum`→`amount` via a fuzzy key-matching heuristic and forwarded the call. The heuristic fired on a typo and produced a syntactically valid but semantically *guessed* invocation. The invariant "the caller's intent is preserved across translation" was violated by a convenience feature. ## Condition of Validity The gateway's translation is only sound under a condition that is almost never checked: **the accepted-input set of the emitted downstream schema must be a subset of the accepted-input set of the upstream schema, and the gateway must reject — not coerce — any inbound call outside that subset.** Formally, let `S_up` be the set of argument objects the upstream tool's validator accepts, and `S_down` the set the emitted downstream schema describes. Sound translation requires `S_down ⊆ S_up` and requires the gateway to treat any inbound call `c` with `c ∉ S_down` as a hard error rather than attempting repair. When translation is lossy, the honest outcome is `S_down ⊊ S_up`: the downstream caller is *more* constrained, never less. The failure mode above arises precisely because the gateway inverted this — its coercion layer expanded `S_down` back toward `S_up` by guessing, producing calls that are in `S_up` but were never in the caller's intended set. This condition is valid only when the gateway retains the upstream schema at inbound-validation time. If the gateway is stateless per request (common in horizontally scaled deployments where the translation and the inbound call land on different workers), it cannot enforce the subset check and must instead refuse to translate lossy schemas at all. The condition is **not** valid for schemas that are already lossless under the target transport — pure flat objects with only `string`/`number`/`boolean` leaves and no constraints translate exactly, and the subset check is trivially satisfied. ## Decision Boundary The boundary is between **coerce-and-forward** and **reject-on-narrowing**. A gateway crosses into unsafe territory the moment it applies any inbound transformation that is not an identity on the caller's arguments — key renaming, enum case-folding, union-branch selection, default injection, or type coercion from string to number. Each of these is a *semantic guess* made by a deterministic component on behalf of a probabilistic caller, and each guess is a place where the caller's intent and the executed call diverge without a signal. The safe side of the boundary: the gateway computes a constraint-diff at translation time; if the diff is non-empty, it either (a) refuses to register the tool downstream and emits a `capability_degraded` marker, or (b) registers it but stamps the emitted schema with a `x-translation-loss` annotation enumerating dropped keywords, and at inbound time it re-validates the call against the *retained upstream schema* and rejects any violation with a structured error the downstream agent can act on. Option (a) is correct for high-consequence tools (financial, destructive, identity-mutating). Option (b) is acceptable for read-only tools where a rejected call simply costs a retry. The unsafe side: any gateway whose inbound path contains a `try: coerce(...) except: pass` or a fuzzy key-matcher, and whose translation path does not diff schemas. Such a gateway is a *semantic laundering* device — it converts malformed probabilistic outputs into well-formed calls that the upstream validator blesses, destroying the only signal (the rejection) that would have let the agent self-correct. ## Operational Effect When the boundary is crossed, three downstream effects compound. First, **error signal loss**: the agent's reasoning loop never observes the rejection, so it never updates its belief about the tool's contract; the same malformed call shape recurs across the episode, and the agent's internal model of the tool drifts permanently away from the real one. Second, **verification replay divergence**: an auditor replaying the episode against the *original* MCP schema will judge the calls invalid, while the live system judged them valid — the audit and the execution disagree because they validated against different schemas, and neither record shows which schema was authoritative at call time. Third, **capability negotiation corruption**: when the gateway later advertises the tool to another A2A peer, it advertises the *already-degraded* schema, so loss compounds across hops; a three-hop chain (MCP → gateway → A2A → gateway → legacy) can reduce a `oneOf`-discriminated union to an untyped object with a prose description. The guardrail that bounds all three: the gateway must persist, per registered tool, the tuple `(upstream_schema_hash, emitted_schema_hash, dropped_constraints)` and must attach `upstream_schema_hash` to every call it forwards. Replay and audit then validate against the schema identified by that hash, not against whatever the current registry happens to hold. Detection at the instance level reduces to a single check the agent can perform on any gateway response: if the response's `schema_hash` differs from the one the agent negotiated at capability-discovery time, the capability has silently shifted and the agent must re-negotiate before trusting further results. ```python import hashlib import json from dataclasses import dataclass class CapabilityDegradationError(RuntimeError): """Raised when a gateway's emitted schema accepts inputs the upstream schema would reject, or when an inbound call is coerced into a shape the caller did not express.""" pass CONSTRAINT_KEYWORDS = {"minimum", "maximum", "enum", "oneOf", "anyOf", "pattern", "required"} def _schema_hash(schema: dict) -> str: return hashlib.sha256(json.dumps(schema, sort_keys=True).encode()).hexdigest() def _collect_dropped(upstream: dict, emitted: dict, path: str = "$") -> list[str]: """Walk both schemas in parallel; record every constraint keyword present upstream but absent (or altered) in the emitted schema.""" dropped: list[str] = [] up_props = upstream.get("properties", {}) em_props = emitted.get("properties", {}) for key, up_sub in up_props.items(): em_sub = em_props.get(key, {}) for kw in CONSTRAINT_KEYWORDS & up_sub.keys(): if em_sub.get(kw) != up_sub.get(kw): dropped.append(f"{path}.properties.{key}.{kw}") if up_sub.get("type") == "object": dropped.extend(_collect_dropped(up_sub, em_sub, f"{path}.properties.{key}")) for kw in CONSTRAINT_KEYWORDS & upstream.keys(): if emitted.get(kw) != upstream.get(kw): dropped.append(f"{path}.{kw}") return dropped @dataclass class TranslationRecord: upstream_hash: str emitted_hash: str dropped: list[str] def translate_tool(upstream_schema: dict, emitted_schema: dict, consequence: str) -> TranslationRecord: """Translate an MCP inputSchema into a downstream transport schema. Refuses lossy translation for high-consequence tools; annotates otherwise.""" dropped = _collect_dropped(upstream_schema, emitted_schema) record = TranslationRecord( upstream_hash=_schema_hash(upstream_schema), emitted_hash=_schema_hash(emitted_schema), dropped=dropped, ) if dropped and consequence == "high": raise CapabilityDegradationError( f"lossy translation of high-consequence tool; dropped constraints: {dropped}" ) return record def validate_inbound(call_args: dict, record: TranslationRecord, upstream_schema: dict) -> None: """Inbound path must validate against the RETAINED upstream schema, never coerce. Any repair attempt is a semantic guess and is treated as a hard failure.""" if record.dropped: # We cannot trust the emitted schema; re-validate against upstream. props = upstream_schema.get("properties", {}) for key, sub in props.items(): if "enum" in sub and call_args.get(key) not in sub["enum"]: raise CapabilityDegradationError( f"inbound call violates upstream enum at {key}: {call_args.get(key)!r}" ) if "minimum" in sub and isinstance(call_args.get(key), (int, float)): if call_args[key] < sub["minimum"]: raise CapabilityDegradationError( f"inbound call violates upstream minimum at {key}: {call_args[key]}" ) if record.upstream_hash != record.emitted_hash and not record.dropped: raise CapabilityDegradationError( "schema hashes differ with no recorded drops; translation is unaccounted for" ) ```