anomalyco / anomalyco/opencode
Anthropic MCP tools fail when input schema uses root-level anyOf/oneOf/allOf
@nexxeln is already working on this.
Since Sep 5, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Bug description
Anthropic rejects a tool input_schema that uses anyOf/oneOf/allOf at the root level — these combinators are only accepted nested inside properties. MCP servers commonly emit "exactly one of these fields" patterns (e.g. anyOf: [{required:["route"]}, {required:["file"]}]) as root-level combinators, which then fail Anthropic validation and take the whole tool down with a 400.
OpenCode has an existing OpenAI sanitizer (#32489) but nothing equivalent for the Anthropic family.
Steps to reproduce
- Expose an MCP tool whose
input_schemacontains a root-levelanyOf/oneOf/allOf(e.g. the schema in #35516 usedanyOf: [{required:["route"]},{required:["file"]}]). - Use it with an Anthropic model (or Copilot proxying Claude, or Vertex Anthropic).
Expected behavior
Tool continues to work; the schema is folded into the root object so Anthropic accepts it.
Actual behavior
The request fails with an Anthropic validation error and the tool is unusable.
Fix
fix(opencode): sanitize MCP tool schemas for Anthropic root combinators (#47542) adds a targeted sanitizer that folds root-level combinators into the root object schema while preserving nested content verbatim.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.