MoonshotAI / MoonshotAI/kimi-code

Bug: MCP tools with top-level oneOf inputSchema receive empty args ({}), rejected by local validation (CLI 0.40.1)

Open
#3,665 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

Bug Report: kimi-cu-win MCP tools with top-level oneOf schema receive empty args ({}) — client-side validation rejects all calls

Summary

When calling kimi-cu-win MCP tools whose inputSchema uses a top-level oneOf (e.g. get_app_state, activate_window, click, scroll, drag), the arguments emitted by the model are dropped before reaching the MCP server: the session wire log records "args":{}, and the call fails local validation with:

Invalid args for tool "mcp__kimi-cu__get_app_state": must have required property 'pid';
must have required property 'app'; must have required property 'window_id';
must match exactly one schema in oneOf

Tools whose schema has top-level required fields (e.g. type_text with snapshot_id/text) pass arguments through correctly and reach the MCP runtime, so the issue is specific to schemas where required exists only inside oneOf branches.

Environment

  • Kimi Code CLI: 0.40.1 (standalone install at ~/.kimi-code/bin/kimi, Windows)
  • OS: Windows 11 (10.0.26200)
  • Plugin: kimi-cu-win 0.2.17; runtime kimi-cu.exe 0.2.17 (doctor all green, agent running)

Evidence

  1. Wire log (wire.jsonl) shows the model's tool calls arrive at the harness with empty args:

    "mcp__kimi-cu__get_app_state","args":{},"time":1788920322774
    "mcp__kimi-cu__get_app_state","args":{},"time":1788920333296
    ...
    "mcp__kimi-cu__type_text","args":{"snapshot_id":"diag-probe","text":"probe"},"time":1788921554319
    
    • get_app_state / activate_window: every attempt (8+) recorded args:{} → rejected by local schema validation, never reached the MCP server.
    • type_text (top-level required: ["snapshot_id","text"]): args passed through, reached the runtime, and got a real runtime error (type_text requires a target window...), proving the transport works.
  2. Runtime is healthy and the same call works when sent directly: piping JSON-RPC over stdio into kimi-cu.exe mcp:

    {"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_app_state","arguments":{"window_id":65948,"mode":"text","max_chars":500}}}
    

    returns a full, valid get_app_state result. So the runtime, plugin manifest, and MCP server are all fine — arguments are lost in the CLI harness layer.

Affected tools

All kimi-cu-win tools with top-level oneOf and no top-level required: get_app_state, activate_window, click, scroll, select_text, drag (and possibly MCP tools from other servers with the same schema shape).

Steps to reproduce

  1. Install kimi-cu-win plugin 0.2.17 + runtime 0.2.17 on Windows, CLI 0.40.1.
  2. In a session, call mcp__kimi-cu__get_app_state with {"window_id": <any valid HWND>}.
  3. Observe Invalid args ... must match exactly one schema in oneOf, and "args":{} in wire.jsonl.

Suspected cause

The CLI's MCP tool-schema handling (validation and/or the schema presented to the model) mishandles top-level oneOf when required is declared only inside branches — arguments not matching a flattened property set are stripped, so the validator then sees {} and reports every branch's required as missing.

Attachments

  • Debug ZIP exported via kimi export (contains wire.jsonl with the evidence above).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the CLI's MCP tool-schema handling, especially the validation or model-schema path for tools using a top-level oneOf. Reproduce with get_app_state and compare its empty args with type_text's preserved arguments; done means branch arguments reach validation and the MCP server without breaking existing top-level required schemas.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.