fix(agent): report uploaded image url in MCP image tool results - #1043
Merged
Merged
Conversation
When standard content blocks are disabled, MCP image tool results were converted into a lone `image_url` block after the binary was uploaded to the ChatLuna storage, so the model never learned the uploaded file name or url. Append a text block (`The <name> has been uploaded. Url: <url>`) next to the `image_url` block and widen the return type accordingly, matching how resource blocks already report their uploaded url (`Resource url: ...`). Verified with `yarn fast-build extension-agent` (exit 0).
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bump koishi-plugin-chatluna-agent from 1.0.45 to 1.0.46 so the MCP image result fix in this branch can be published to npm. Update the dependent references from ^1.0.45 to ^1.0.46 in koishi-plugin-chatluna-plugin-common (extension-tools) and koishi-plugin-chatluna-search-service (service-search), both in peerDependencies and devDependencies.
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.
MCP image tool results dropped the uploaded file info: after the binary was uploaded to ChatLuna storage, the converter returned only an
image_urlblock, so the model never learned the file name or url — unlike resource blocks, which already report where the file landed.Bug fixes
packages/extension-agent/src/mcp/content.ts: when standard content blocks are disabled, append a text block (The <name> has been uploaded. Url: <url>) next to theimage_urlblock, and widen the return type to includeMessageContentText. Image blocks are now consistent with resource blocks (Resource url: ...).Other Changes
koishi-plugin-chatluna-agent1.0.45->1.0.46so the fix is publishable, and align the^1.0.45->^1.0.46references inextension-toolsandservice-search(peer + dev dependencies).Verification
yarn fast-build extension-agentand the fullyarn buildboth pass (exit 0);yarn eslint packages/extension-agent/src/mcp/content.tsis clean.