Skip to content

Bug: Kimi Coding tool calls broken - returns text instead of executing tools #39882

@dunci

Description

@dunci

Bug: Kimi Coding tool calls broken - returns text instead of executing tools

Description

When using Kimi Coding provider with anthropic-messages API, tools (like exec) are not being called. Instead, the model returns text descriptions of what it would do, rather than actual tool_use responses.

Steps to Reproduce

  1. Configure Kimi Coding provider with api: "anthropic-messages"
  2. Set compat.supportsTools: true in model config
  3. Enable exec tool with tools.profile: "full"
  4. Ask the model to execute a command like "执行whoami命令"

Expected: Model returns tool_use block and tool gets executed
Actual: Model returns text like "让我执行 whoami 命令:exec(command: "whoami")" without calling the tool

Root Cause

Commit 909f26a26 (2026-03-05) introduced a transformation that converts Anthropic tool format to OpenAI format for Kimi Coding endpoints. However, this is incorrect:

  • Kimi Coding's anthropic-messages endpoint expects standard Anthropic format (name + input_schema)
  • The transformation to OpenAI format (type: function + function.parameters) causes the model to return text instead of tool_use

Evidence

Testing with curl directly to Kimi API:

With OpenAI format (current broken behavior):

curl -X POST https://api.kimi.com/coding/v1/messages \
  -H "x-api-key: $KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "k2p5",
    "messages": [{"role": "user", "content": "执行whoami命令"}],
    "tools": [{
      "type": "function",
      "function": {
        "name": "exec",
        "parameters": {"type": "object", "properties": {"command": {"type": "string"}}}
      }
    }]
  }'

Result: Returns text simulation, no tool_use ❌

With Anthropic format (correct):

curl -X POST https://api.kimi.com/coding/v1/messages \
  -H "x-api-key: $KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "k2p5",
    "messages": [{"role": "user", "content": "执行whoami命令"}],
    "tools": [{
      "name": "exec",
      "input_schema": {"type": "object", "properties": {"command": {"type": "string"}}}
    }]
  }'

Result: Returns proper tool_use with stop_reason: "tool_use" ✅

Solution

Remove the tool format transformation in createKimiCodingAnthropicToolSchemaWrapper. Kimi Coding works correctly with native Anthropic format.

Impact

  • All tool calling functionality is broken for Kimi Coding users since v2026.3.2
  • Affects exec, file operations, and any other tools
  • Users see text descriptions instead of actual tool execution

Environment

  • OpenClaw version: 2026.3.7+
  • Provider: kimi-coding
  • API: anthropic-messages
  • Model: k2p5

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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