anthropics / anthropics/claude-code

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

Ouverte
#88,298 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area:mcp bug platform:macos
Langage dominant
Python
Étoiles
145k
Forks
23.1k
Métriques de merge des PR
Métriques de PR en attente

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Domaine
api, cli
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.