Repository navigation
Conversation
The host tool bridge only recognized a top-level `images` array, so MCP
results shaped as `content: [{ type: "image" }]` and plugin tools
returning a bare content-block array were flattened into JSON text;
vision models never saw the picture (vastsa#1360). Normalize both shapes:
render text blocks as text, emit well-formed image blocks when vision is
enabled, and carry imageCount in details. Apply the same restoration to
persisted bare arrays in toolResultFromUi so a restart keeps the image.
Validated: toolResultFromUi tests 3/3 in runtime.test.ts; remaining
agent-runtime tsc errors reproduce on pristine main (baseline noise).
Owner
|
Thanks for fixing MCP and plugin image normalization. The issue was real. I added a direct runtime-bridge regression for both content objects and bare plugin block arrays, plus the bridge contract, in #1372; that follow-up has merged. Closing this duplicate as superseded. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The host tool bridge only recognized a top-level
images: [{ data, mimeType }]array. MCP results shaped ascontent: [{ type: "image", ... }]and plugin tools returning a bare content-block array ([{ type: "text" }, { type: "image" }]) fell into theJSON.stringifybranch, so vision models never received an image block — the user believed the model had seen the picture (#1360).Fix
Normalize the two missing shapes in the host tool bridge (
runtime.ts):textblocks as text, collect well-formedimageblocks (vision enabled), setimageCountin details.content: [...](MCP): same treatment; details keep the rest of the payload plusimageCount.collectImageBlockshelper accepts only well-formed entries ({ type: "image", data, mimeType }); malformed ones are skipped, not fatal.toolResultFromUi(persisted-row restore) gains the same bare-array branch so a restart does not flatten the image back to JSON.The existing
images: [...]shape is untouched.Validation
toolResultFromUitests 3/3 inruntime.test.ts(incl. new bare-array regression)agent-runtimetsc --noEmit: remaining errors reproduce on pristine main (baseline noise)Fixes #1360