Skip to content

[PoC] feat(tools): images through tool results + MCP bridge - #38

Open
ayman3000 wants to merge 1 commit into
mainfrom
feat/tool-result-images
Open

[PoC] feat(tools): images through tool results + MCP bridge#38
ayman3000 wants to merge 1 commit into
mainfrom
feat/tool-result-images

Conversation

@ayman3000

Copy link
Copy Markdown
Owner

Proof-of-concept — the framework plumbing so a tool (native or MCP) can return an image that reaches a vision model on the next turn. Pairs with LLMProviderKit feat/tool-result-images.

Changes

  • AgentToolResult gains images: [LLMImage] (default [], Codable/Equatable) + .success(…, images:).
  • MCPToolBridge.execute captures .image content (base64 → LLMImage) instead of dropping all non-text — the ingestion point for a chrome-devtools screenshot.
  • AgentMessage.toLLMMessages() forwards tool-result images onto the .tool LLMMessage (via the full initializer, so it builds against released LLMProviderKit).

Status / scope

  • ✅ Full suite green (143 tests): images survive Codable, toLLMMessages forwards them, text-only carries none.
  • ⚠️ PoC — not for merge yet. Runtime image encoding needs LLMProviderKit's change published + a version bump here; then Naseem integration (gate on VisionRouting.canSee, since models can't swap mid-run). Provider generalization beyond Anthropic tracked in the LLMProviderKit PR.

🤖 Generated with Claude Code

Lets a tool return images (e.g. a browser screenshot) that reach a vision
model on the next turn, instead of being dropped.

- AgentToolResult gains `images: [LLMImage]` (default []), Codable/Equatable;
  `.success(…, images:)` convenience.
- MCPToolBridge.execute now captures `.image` content items (base64 → LLMImage)
  instead of dropping everything but text — the ingestion point for a
  chrome-devtools screenshot.
- AgentMessage.toLLMMessages() forwards tool-result images onto the `.tool`
  LLMMessage (uses the full LLMMessage initializer, so it builds against the
  released LLMProviderKit).

Tests: images survive Codable; toLLMMessages forwards them; text-only carries
none. Encoding to a provider's wire format is proven in LLMProviderKit.

PoC: pairs with LLMProviderKit feat/tool-result-images. Runtime image encoding
needs that published; provider generalization + Naseem integration follow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant