MCP tool schemas using $ref/$defs cause 400 on every request with Moonshot/Kimi models
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Parti dal punto di ingresso cmd e segui come vengono convertiti gli schemi degli strumenti MCP prima dell'invio delle richieste al provider; l'issue non indica file o test del repository. Confronta il percorso Moonshot con i percorsi di Claude Code e Codex, quindi verifica che lo schema $ref/$defs segnalato non provochi più un 400 e che la sessione rimanga utilizzabile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
When an MCP server exposes a tool whose input schema uses $ref + $defs (valid JSON Schema, and valid per the MCP spec), Command Code passes the schema to the Moonshot/Kimi API in a form it rejects — and because tool definitions accompany every request, every turn of the session fails with a 400, making the CLI unusable with that MCP server attached.
Error
⚠ Error: 400 Invalid request: tools.function.parameters is not a valid moonshot flavored
json schema, details: <At path 'properties.external.$ref': $defs not found for reference:
#/$defs/IdentifySessionExternalParams>
Seen on v0.51.0 and still present after updating to v0.52.1, model moonshotai/Kimi-K2.7-Code-Highspeed.
Repro
- Configure any MCP server that emits a
$ref-based tool schema. In my case: the Solo app's MCP server, whoseidentify_sessiontool declares:
{
"$defs": {
"IdentifySessionExternalParams": {
"properties": {
"agent_id": {"type": "string"},
"metadata": {"additionalProperties": true, "default": {}, "type": "object"},
"name": {"type": "string"}
},
"required": ["name"],
"type": "object"
}
},
"properties": {
"external": {
"$ref": "#/$defs/IdentifySessionExternalParams",
"description": "External actor details for callers that are not Solo-managed processes."
},
"solo_process_id": {"format": "int64", "type": "integer"},
"pid": {"format": "uint32", "minimum": 0, "type": "integer"}
},
"type": "object"
}
- Start
cmdwith a Kimi model and send any message. - Every request 400s with the error above.
Note the schema does include a top-level $defs — the Moonshot error says $defs not found, which suggests the conversion layer strips/loses $defs while leaving the $ref dangling (or Moonshot's "flavored" schema simply doesn't support refs at all).
Expected
Command Code should dereference/inline $refs when converting MCP tool schemas for providers whose "flavored" JSON Schema doesn't support them (Moonshot at minimum). Claude Code and Codex handle the same MCP server fine because the Anthropic/OpenAI APIs accept $ref schemas.
A degraded-but-better alternative: drop the offending tool from the tool list with a warning, instead of letting one incompatible schema hard-fail the entire session.
Workaround
Disable the offending MCP server in ~/.commandcode/mcp.json ("enabled": false).
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 4k
- Fork
- 350
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di CommandCodeAI/command-code
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
CommandCodeAI/command-code#855 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
CommandCodeAI/command-code#841 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
CommandCodeAI/command-code#655 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
CommandCodeAI/command-code#608 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
CommandCodeAI/command-code#893 ·
Tutte le issue di CommandCodeAI/command-code
Issue simili
-
bug priority:normal ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
OpenHands/extensions#626 · 1 commento ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
avniproject/avni-client#2135 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
use-agent-os/agent-os#3276 ·