[MCP tool boolean parameter always serialized as string, causing "Expected bool, got string" error]
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When calling an MCP tool that requires a boolean parameter, the value is always sent to the MCP server as a string ("true", "True", "1"), never as a native JSON boolean — the tool rejects the call with a type validation error.
Affected tool: ads_boost_ig_post, from the Meta Ads MCP (server id 97087554-d6e2-4022-b05d-0d227ea3758a), parameter confirmed.
What Should Happen?
The confirmed parameter should be serialized as a native JSON boolean when the tool call is sent, so the MCP server accepts it and the tool call succeeds.
Error Messages/Logs
Invalid value for `confirmed`. Got: 'true'. Error: Expected bool, got string
Steps to Reproduce
- Connect to an MCP server that exposes a tool with a required boolean parameter (in this case, ads_boost_ig_post from the Meta Ads MCP, parameter
confirmed) - Call the tool with confirmed=true
- Observe the error: "Invalid value for
confirmed. Got: 'true'. Error: Expected bool, got string" - Retry with confirmed=True and confirmed=1 — same error in both cases
- Note: the tool's schema, when inspected via ToolSearch, appears generic ({"type": "object"}, no per-field types) — this may be why the client doesn't know to serialize this field as a boolean
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.232 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
Full investigation writeup available if needed — happy to share more context/repro details.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗