webclaw/crates/webclaw-mcp
Valerio 884f06a5d3 fix(mcp): accept boolean params sent as JSON strings (#62)
Follow-up to #58/#59, which fixed numeric params but left the booleans.
MCP clients (e.g. Claude Desktop) send `true` as the JSON string `"true"`,
which serde's default bool deserializer rejects with
`invalid type: string "true", expected a boolean`, failing the call.

Adds a `deser_opt_bool_or_str` helper (same untagged pattern as the #59
numeric helpers) that accepts a JSON boolean OR "true"/"false"
(case-insensitive, trimmed) and rejects anything else with a clear error.
Numeric-looking strings like "1" are intentionally NOT coerced to bool.

Applied to every Option<bool> tool param:
- scrape   -> only_main_content
- crawl    -> use_sitemap
- research -> deep
- search   -> scrape   (added by the standalone-search slice, #63)

16 unit tests (bool / "true"-string / absent->None / garbage->error per
field). No new dependencies.

Fixes #62.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 15:37:36 +02:00
..
src fix(mcp): accept boolean params sent as JSON strings (#62) 2026-06-17 15:37:36 +02:00
Cargo.toml refactor(cloud): consolidate CloudClient + smart_fetch into webclaw-fetch 2026-04-22 16:05:44 +02:00