anthropics / anthropics/claude-code

MCP tool results missing content blocks: accessibility tree never surfaced, screenshot intermittently dropped

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

説明

## Environment

- Claude Code version: 2.1.237 (terminal CLI)
- Platform: macOS 26.3.1 (Darwin 25.3.0), Apple Silicon
- Model: claude-fable-5
- MCP server involved: a local stdio computer-use server ("codex-computer-use", wrapping the Codex CLI 0.147.0-alpha.6.5 computer-use broker)

## Summary

When driving a desktop app through this MCP server in Claude Code, tool results appear to be missing content blocks that the server is expected to return. This looks like a Claude Code problem in how multi-block MCP tool results are surfaced to the model, rather than a server problem.

Two related symptoms in a single session:

### 1. Accessibility tree never surfaced

The server's `get_app_state` tool is documented (in its own tool description) to return **both a screenshot and an accessibility tree**, and its other tools (`scroll`, `set_value`, `select_text`, `click`) accept an `element_index` parameter that refers to elements in that tree.

In Claude Code, every `get_app_state` / `click` / `press_key` result contained only:

- one screenshot image block, and
- one JSON status text block (runId, method, outcome, timing, etc.)

No accessibility tree content ever appeared in any tool result across the session. As a consequence, all `element_index`-based tools were unusable, and the model had to fall back to raw pixel coordinates and keyboard input for everything.

### 2. Screenshot image block intermittently dropped

One `click` call returned **only** the JSON status text block, with the screenshot image missing entirely, even though the JSON reported `"outcome":"ok"`. An identical `click` on the same coordinates immediately afterwards returned the screenshot normally. All other calls in the session (~7 of them) included the image.

This intermittent case is what makes me suspect content blocks are being dropped somewhere in Claude Code's MCP result handling, and that the always-missing accessibility tree in (1) may be the same underlying issue rather than server behavior.

## Steps to reproduce

1. Configure a computer-use style MCP server whose tool results contain multiple content blocks (image + one or more text blocks) in Claude Code.
2. Call a tool like `get_app_state` that should return screenshot + accessibility tree.
3. Observe that only the image and a single trailing text block reach the model; make repeated calls and observe that occasionally the image block is missing too.

## Expected behavior

All content blocks of an MCP tool result (images and all text blocks, including large accessibility trees) are surfaced to the model consistently on every call.

## Actual behavior

The accessibility tree text block never reached the model, and the screenshot image block was dropped on one call out of ~8 despite the tool reporting success.

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

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

調査の方向性

Start by reproducing the issue with a computer-use MCP server that returns multiple image and text content blocks, including an accessibility tree. Trace Claude Code's MCP tool-result handling and verify that every block reaches the model consistently, including repeated calls where the screenshot is intermittently missing.

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

評価

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

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

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