Skip to content

Anthropic API rejects MCP tools with anyOf in input_schema #35516

Description

@KamilKleina

Description

Claude models in opencode fails with:
tools.36.custom.input_schema: input_schema does not support oneOf, allOf, or anyOf at the top level
Same error as the one in anthropics/claude-code#4886 (anthropics/claude-code#4886).

OpenCode adds anyOf to the input_schema of some MCP tools. For example, gitnexus_api_impact gets:
"anyOf": [{"required": ["route"]}, {"required": ["file"]}]
The Anthropic API does not allow anyOf (or oneOf/allOf) at the top level of a tool schema. Same restriction as OpenAI.

PR #32489 (#32489) (shipped in v1.17.8) sanitizes tool schemas for OpenAI models by dropping composition keywords. But that sanitization only runs for OpenAI/Azure adapters. It never touches the Anthropic path.

Plugins

gitnexus

OpenCode version

1.17.13

Steps to reproduce

  1. install gitnexus
  2. pick claude models
  3. run anything

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions