anthropics / anthropics/claude-code

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

Aperta
#88,298 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area:mcp bug platform:macos
Lingua principale
Python
Stelle
145k
Fork
23.1k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Ambito
api, cli
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.