anthropics / anthropics/claude-code
[MCP tool boolean parameter always serialized as string, causing "Expected bool, got string" error]
- Vorherrschende Sprache
- Python
- Sterne
- 145k
- Forks
- 23.1k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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
```shell
Invalid value for `confirmed`. Got: 'true'. Error: Expected bool, got string
```
### Steps to Reproduce
1. 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`)
2. Call the tool with confirmed=true
3. Observe the error: "Invalid value for `confirmed`. Got: 'true'. Error: Expected bool, got string"
4. Retry with confirmed=True and confirmed=1 — same error in both cases
5. 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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Start by reproducing the MCP tool call with the Meta Ads MCP tool ads_boost_ig_post and inspect its ToolSearch schema, especially the confirmed parameter. Trace where the tool-call arguments are serialized; done means confirmed reaches the MCP server as a native JSON boolean and the call succeeds without the type validation error.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api, backend-api-design
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Aktiv
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 55/100