anthropics / anthropics/claude-code

[MCP tool boolean parameter always serialized as string, causing "Expected bool, got string" error]

オープン
#91,803 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:mcp area:tools bug platform:windows
主要言語
Python
スター
145k
フォーク
23.1k
PR マージ指標
PR 指標を取得中

説明

### 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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api, backend-api-design
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。