What happens when an instance translates MCP tool-call state into an A2A task envelope and the capability schema silently widens
**Date of Record:** 2026 December 2 **Scope:** Applies to gateway/translator instances that terminate an MCP session on one side and emit or consume A2A `Task` envelopes on the other, where the MCP server advertises tools via `tools/list` and the A2A peer resolves capability from the envelope's `skills`/`parts`. Does not apply to homogeneous MCP-to-MCP proxying or to A2A-to-A2A routers that never cross the transport boundary.
Core Distinction
The failure is not "the gateway crashed" or "the schema didn't match." It is that the MCP→A2A translation is *lossy in the permissive direction*: an MCP `inputSchema` that constrains a tool call with `required` fields, `additionalProperties: false`, and enum bounds has **no faithful encoding** in an A2A `Task` envelope, whose `parts` are typed content blobs (`TextPart`, `DataPart`, `FilePart`) carrying no schema authority. The gateway therefore forwards the *arguments as data* and the *capability as prose*. The A2A peer re-derives its own interpretation of what the arguments mean. When the two interpretations differ, the tool executes on a request the MCP server would have rejected at the JSON-Schema layer — but the MCP server never sees it, because the call arrived as an A2A task, not as an MCP `tools/call`.
This is a *schema-authority handoff gap*, distinct from ordinary schema mismatch. A mismatch fails loudly at validation. This gap fails silently because validation on the A2A side is advisory (a `skill` description string), not structural.
What Was Observed
A gateway instance (`gw-7`) fronted an MCP file-mutation server exposing `write_file(path: string, content: string, mode: enum["create","overwrite"])` with `additionalProperties: false` and `mode` required. The gateway exposed this to an A2A orchestrator as a `skill` named `file_write` with a `DataPart` schema hint embedded in the skill description text.
Trace of the failing sequence:
- MCP client issued `tools/call` with `{"path": "/etc/app/conf.yaml", "content": "...", "mode": "overwrite"}`. Gateway accepted, validated against `inputSchema`, and began translation.
- The gateway's A2A emit step serialized arguments into a `DataPart` with key `args`, but its serializer dropped keys whose value equaled the enum default it had cached from a *prior* `tools/list` refresh — a stale-cache bug in the gateway's default-elision path. `mode` was elided because the cached default for `mode` was `"overwrite"`.
- The A2A orchestrator received a `DataPart` with `{"path": ..., "content": ...}` and no `mode`. Its own skill handler interpreted absent `mode` as `"create"` (its documented default) and dispatched to a downstream writer.
- Downstream writer, seeing `create` on an existing path, failed with `EEXIST`, retried twice under the orchestrator's retry policy, then the orchestrator emitted a *second* A2A task with `mode: "overwrite"` inferred from the error — writing the file twice and appending a duplicate block on the second pass because the writer's `overwrite` semantics were actually *append-on-conflict* in that build.
- MCP client received a success `Task` result. No error surfaced. The file contained a duplicated configuration stanza that later caused a parse failure in an unrelated service.
The observable signature: gateway logs show a clean `tools/call` → `Task` emission with no validation error; A2A logs show a valid task with a defaulted field; the divergence is only visible by diffing the MCP `inputSchema` `required` set against the A2A `DataPart` key set on each hop.
Condition of Validity
The gap only opens under a conjunction:
- The MCP tool's `inputSchema` declares a field as `required` **and** that field has a server-side default that the gateway caches (so elision is possible).
- The A2A skill handler supplies its own default for the same field, and that default differs from the MCP default.
- The gateway performs default-elision (key omission) rather than default-materialization (key inclusion with explicit value) when serializing to `DataPart`.
If any one is absent, the failure does not manifest: materializing defaults (always emitting `mode: "overwrite"`) closes it; matching defaults closes it; a non-required field closes it because omission is then semantically correct. The invariant that must hold is: **the A2A `DataPart` emitted by a gateway MUST be a superset of the MCP `inputSchema` `required` keys, with values materialized, never elided.** Elision is only safe when the receiving side's default is provably identical to the sender's, which across a protocol boundary is never provable from the envelope alone.
Decision Boundary
The gateway must choose, per field, between *elide* and *materialize*. The correct rule is not "elide when value == default" but "elide only when the field is not in `inputSchema.required` AND the A2A skill declares no conflicting default." Since the A2A skill's defaults are not machine-readable (they live in prose or in the peer's handler code), the only sound rule at the boundary is: **materialize every `required` field unconditionally; elide only optional fields.** A gateway that cannot read the peer's handler must treat every `required` key as carrying a warrant that must survive translation intact — the A2A envelope is a *state transfer* surface, and state that was required to authorize the call must not be dropped in transit.
A secondary boundary: on the return path, an A2A `Task` failure (`state: "failed"`) must not be translated into an MCP success with a defaulted result. The gateway observed here translated the orchestrator's post-retry success as success, masking the double-write. The guardrail is that any A2A task that required an internal retry must surface as a `Task` with `state: "completed"` **and** a `metadata.retried: true` flag the MCP side can inspect; the gateway must refuse to flatten retried tasks into clean successes.
Operational Effect
The practical consequence is that a gateway instance can pass every unit test — schema validation, transport, serialization round-trip — and still corrupt state, because the corruption happens in the *semantic default resolution* between two valid messages. Detection requires comparing, per hop, the MCP `required` key set against the A2A `DataPart` key set and flagging any `required` key present on one side and absent on the other. This check is cheap and should run as a gateway invariant, not a test. The failure is invisible to both endpoints individually; it is only visible at the seam, which is exactly where no single agent's logs live.
The durable lesson for an agent operating across this boundary: an A2A envelope is not a validated message, it is a *claim about a message*. Required state must be carried as materialized data, and any translation that elides a required field is a state-transfer defect regardless of whether the defaults happen to agree today.
from dataclasses import dataclass, field
from typing import Any
class SchemaAuthorityGap(RuntimeError):
"""Raised when a gateway elides a required MCP field into an A2A DataPart."""
pass
@dataclass
class McpToolSchema:
required: set[str]
defaults: dict[str, Any] = field(default_factory=dict)
@dataclass
class A2ADataPart:
args: dict[str, Any]
retried: bool = False
def translate_tool_call(
schema: McpToolSchema,
call_args: dict[str, Any],
peer_defaults: dict[str, Any],
) -> A2ADataPart:
# Materialize every required key; never elide a required field even if it
# equals a cached default -- the peer's default is not provable from here.
materialized: dict[str, Any] = {}
for key in schema.required:
if key in call_args:
materialized[key] = call_args[key]
elif key in schema.defaults:
materialized[key] = schema.defaults[key]
else:
raise SchemaAuthorityGap(
f"required field '{key}' absent from call and no server default; "
f"cannot emit A2A envelope without dropping a warrant"
)
# Optional fields may be elided only if the peer declares no conflicting default.
for key, val in call_args.items():
if key in schema.required:
continue
if key in peer_defaults and peer_defaults[key] != val:
materialized[key] = val
elif key not in peer_defaults:
materialized[key] = val
return A2ADataPart(args=materialized)
def verify_envelope_invariant(
schema: McpToolSchema, part: A2ADataPart
) -> None:
missing = schema.required - set(part.args.keys())
if missing:
raise SchemaAuthorityGap(
f"A2A DataPart missing required keys {sorted(missing)}; "
f"peer will default them and diverge from MCP semantics"
)
def translate_task_result(task_state: str, retried: bool) -> dict[str, Any]:
if task_state == "failed":
raise SchemaAuthorityGap("A2A task failed; must not flatten to MCP success")
if retried:
# Surface retry so the MCP side can detect double-effect writes.
return {"status": "completed", "metadata": {"retried": True}}
return {"status": "completed"}