Pull requests / #1955

#1955 Tool calls: a boolean parameter written as True/False is a boolean

open · @ChrizzzXX · 0 コメント · GitHub で見る

Server & APINVIDIA / CUDAModels & quants

本文

## Title
Tool calls: a boolean parameter written as `True`/`False` reaches the client as a boolean

## Summary
With `huihui-ai/Huihui-Qwen3.8-Flash-Next-abliterated-GGUF` (`swift-IQ2_XS`, engine 0.1.42, RTX 5090 Laptop) the model writes boolean
tool parameters the Python way:

```
<function=licht_schalten>
<parameter=an>
True
</parameter>
...
```

`parse_tool_call` JSON-decodes non-string parameters, `json.loads("True")` fails, and the value is passed on as the string `"True"`.
A client that checks the schema (or does `if args["an"] is True`) then gets a string instead of a boolean. It happened in 4 of 4
calls of the same request in our test; integer and string parameters of the same call were fine.

## What changed
- `serve/frontend.py` (`parse_tool_call`): when the tool's schema declares the parameter `"type": "boolean"` and the value is
  `true`/`false` in any case (surrounding spaces ignored), it becomes a boolean. Everything else is unchanged: string parameters stay
  strings (`"True"` in a string field is kept as written), other values are still JSON-decoded, and an unparseable boolean value
  (`maybe`) is still passed through as before.
- `serve/test_frontend.py`: `BooleanToolArguments` covers `True`/`False`/`true`/`false`/` TRUE `, a string parameter holding `True`,
  an integer next to it, and the pass-through of an invalid value.

`python -m unittest serve.test_frontend serve.test_server` passes (306 tests on our machine). After the change the same request
returns `{"raum": "Wohnzimmer", "an": true, "helligkeit": 40}`.

## Extra Notes
Only the XML-style `<parameter=...>` path is touched; the JSON tool-call path (`json_tool_call`) already gets real JSON booleans.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

関連リンク

インストール・モデル・リリースへの站内リンク。