Preserve structured MCP tool schemas in the host-visible tool catalog
Problem
Complex MCP inputs can be projected into the host-visible tool catalog as an unknown argument type even when the server advertises a structured JSON Schema. In a current LeanToken integration, the server-side context request has a typed object schema with required fields, defaults, conditional constraints, and additionalProperties: false, while the active host projection renders the callable arguments as unknown rather than preserving that structure.
The result is that an agent cannot reliably discover valid fields and may send stale or invalid parameters. The resulting validation errors look like server bugs even though the loss occurs at the host/catalog boundary.
Proposed outcome
Preserve the original structured inputSchema from MCP tools/list through host registration, deferred discovery, and agent-visible tool declarations. If a schema cannot be represented by a host surface, preserve a documented lossless/raw schema path and make the degradation explicit rather than silently replacing the input with unknown.
Decisive diagnostic
The implementation should compare:
- the raw server
tools/listresponse; - the host's stored/deferred tool record; and
- the active callable declaration.
If the raw response is structured but the latter is unknown, the adapter should retain the structure. If the raw response is already incomplete, the issue should be routed to the MCP server instead.
This is related to #19155 and #19425, but is specifically about schema preservation rather than restart invalidation or tool exposure.
Acceptance criteria
- Object, array, enum, required, default, and conditional schemas survive catalog projection.
- Deferred tools and reconnects use the same schema as the raw
tools/listresponse. - A regression test fails when a structured schema is projected as
unknown. - Any unavoidable host limitation is surfaced with an actionable diagnostic.