MoonshotAI / MoonshotAI/kimi-code
Anthropic provider: 400 on MCP tools with top-level oneOf/anyOf/allOf in input_schema (and [tools].disabled doesn't filter MCP tools from the wire)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Bug: MCP tool schemas with top-level oneOf/anyOf/allOf are rejected by the Anthropic API (400)
Summary
When using an anthropic-type provider (Claude models), any MCP server that exposes a tool whose inputSchema has a top-level oneOf/anyOf/allOf combinator makes every request fail with a 400 from the Anthropic API — even the first "hello" of a fresh session, because the full tool list is sent on every call. Kimi models tolerate these schemas; the Anthropic Messages API does not.
Error
provider.api_error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"tools.92.custom.input_schema: input_schema does not support oneOf, allOf, or anyOf at the top level"},
"request_id":"req_011CdUrw2Nqi8JkRad2CvumV"}
Steps to reproduce
- Configure an
anthropicprovider + model alias inconfig.toml(e.g.claude-sonnet-5). - Add an MCP server whose tools include a top-level combinator in
inputSchema. In my case the Higgsfield MCP server (https://mcp.higgsfield.ai/mcp) — itsvideo_analysis_createtool declares:
at the root of{ "oneOf": [ { "required": ["video_input_id"] }, { "required": ["youtube_url"] } ] }inputSchema(verified via raw JSON-RPCtools/list; it is the only one of the server's 86 tools with a root-level combinator). - Run
kimi -m claude-sonnet-5 -p "coucou"→ 400 on the very first request. The same session works fine with a Kimi model.
Expected
The CLI sanitizes/wraps tool schemas before sending them to the Anthropic API (e.g. hoisting a root-level oneOf into a plain object schema with optional properties, or dropping/replacing the offending tool with a warning), so one non-conforming MCP tool cannot brick the entire session.
Workarounds found
disabledTools: ["video_analysis_create"]on the server entry inmcp.json→ session works. ✅ (only fix that works)[tools].disabled = ["mcp__higgsfield__*"]inconfig.tomldoes not help: MCP tools are still sent on the wire despite the global tool switch. This looks like a second, related bug — the global[tools]filter does not apply to MCP tools (at least for request shaping).
Environment
- kimi-code 0.29.2
- Linux (WSL2, Ubuntu 24.04)
- Provider:
anthropic(official API, modelclaude-sonnet-5)
Happy to email a debug ZIP (kimi export) or the raw tools/list dump if useful — not attaching here since they may contain session data.
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.
Research direction
Start by tracing the Anthropic provider's request shaping for MCP tool schemas, then inspect how the global [tools].disabled setting is applied compared with disabledTools in mcp.json. Reproduce with the Higgsfield tools/list schema and an Anthropic model; done means the request no longer fails on a top-level combinator and disabled MCP tools are absent from the wire.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100