anthropics / anthropics/claude-code

[BUG] MCP tool calls with dict/array parameters serialized as strings, fails mid-session after working correctly

オープン
#93,179 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:mcp bug platform:macos
主要言語
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?

MCP tool calls with an object or array-shaped parameter fail validation with the parameter arriving as a JSON string instead of a parsed object/dict. Simple scalar-only parameters (plain strings/ints) continue to work normally. This matches the pattern already described in #5504, #3084, #2747, and #6249, but those threads are closed/locked, so filing fresh per the bot's own instruction on #5504.

### What Should Happen?

The tool call's object/array parameter should arrive at the MCP server as a parsed dict/array, not as a raw JSON string, so the server's schema validation succeeds.

### Error Messages/Logs

```shell
1 validation error for call[]
body
Input should be a valid dictionary or instance of [type=model_type, input_value='{"data": {...}}', input_type=str]
```

### Steps to Reproduce

1. In a long-running Claude Code session, call an MCP tool whose schema expects an object-shaped parameter (e.g. a "body" field containing a nested dict), passing a well-formed JSON object.
2. Observe the call succeeds initially.
3. Later in the same session (no code/prompt changes on the client side), call the same tool again with an equivalently-shaped object.
4. Observe it now fails with the error above, as if the object were stringified before reaching the server.
5. Restarting the session does not resolve it.
6. Tried multiple payload shapes/field names to rule out a schema mismatch; all fail identically, pointing at client-side serialization rather than the tool's own schema.

Affected in this case: two independent MCP servers (a Klaviyo integration and a separate image-generation service). Related closed/locked threads: #5504, #3084, #2747, #6249.

### Claude Model

Sonnet (default)

### Is this a regression?

Yes, this worked in a previous version

### Last Working Version

same session, no version change

### Claude Code Version

2.1.62 (Claude Code)

### Platform

Anthropic API

### Operating System

macOS

### Terminal/Shell

Terminal.app (macOS)

### Additional Information

_No response_

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

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

調査の方向性

No source file, test, or entry point is named. Start by reproducing the failure with an object-shaped MCP parameter in a long-running session, then trace where MCP tool-call parameters are serialized before reaching the server. Done means object and array parameters arrive parsed while scalar parameters continue to work and schema validation succeeds.

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

評価

領域
api, cli
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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