MCP tool schemas using $ref/$defs cause 400 on every request with Moonshot/Kimi models
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
Piste de recherche
Commencez au point d’entrée cmd et suivez la manière dont les schémas des outils MCP sont convertis avant l’envoi des requêtes au fournisseur ; l’issue ne mentionne aucun fichier ni test du dépôt. Comparez le chemin Moonshot avec ceux de Claude Code et de Codex, puis vérifiez que le schéma $ref/$defs signalé ne provoque plus de 400 et que la session reste utilisable.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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).
- Langage dominant
- Aucune donnée de langage
- Étoiles
- 4k
- Forks
- 350
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de CommandCodeAI/command-code
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
CommandCodeAI/command-code#855 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
CommandCodeAI/command-code#841 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
CommandCodeAI/command-code#655 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
CommandCodeAI/command-code#608 ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 70/100
CommandCodeAI/command-code#893 ·
Toutes les issues de CommandCodeAI/command-code
Issues similaires
-
[FEATURE]: Bump gitlab-ai-provider to 6.15.1 on v2 (Fable 5.1, GPT-6 Astra, workflow reconnect fix) Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
registrystack/registry-stack#1239 ·
-
bug priority:normal ready-for-dev
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
OpenHands/extensions#626 · 1 commentaire ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
avniproject/avni-client#2135 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100