Issue for this PR
Fixes #57643
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
The MCP SDK validates the whole tools/list result and requires every outputSchema to have type: "object". A tool whose schema is only $defs plus a top-level anyOf (for example one generated by Rust schemars) fails that check, so every tool on the server is dropped.
typeOutputSchemas in packages/core/src/mcp/client.ts wraps the transport's onmessage before connect and adds type: "object" to any listed outputSchema that has no type. The tool and its schema stay, and so do the other tools.
Related #56116 (a result that breaks its schema still fails the call) is untouched.
How did you verify your code works?
Added a test with a raw stdio fixture that lists one plain tool and one anyOf tool, then calls the second. It fails on dev with the tools/list error from the issue and passes now. The core typecheck is clean. One existing test ("exposes every connection operation") times out here on dev too.
Ran live: opencode mcp list (dev build, the issue's repro server) -> ✗ anyof failed: Invalid result for tools/list ... expected "object" before, ✓ anyof connected after.
Screenshots / recordings
N/A
Checklist
- Tested locally (agent-run with Claude Code; I take responsibility for it)
- I have not included unrelated changes in this PR
Added by the opencode bot (AI-generated).
Related: #56116