-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
Bug: Kimi Coding tool calls broken - returns text instead of executing tools #39882
Description
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
- Configure Kimi Coding provider with
api: "anthropic-messages" - Set
compat.supportsTools: truein model config - Enable exec tool with
tools.profile: "full" - 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
- Introduced in: [Bug]: anthropic-messages provider sends tool definitions in wrong format after v2026.3.2 upgrade — Kimi Coding API rejects with "23 validation errors" #37038 (commit 909f26a)
- CHANGELOG entry incorrectly states this "restores tool-call workflows"