Enhance LanguageModelToolsService to handle image file widgets in tool invocation messages#301595
Merged
Enhance LanguageModelToolsService to handle image file widgets in tool invocation messages#301595
Conversation
…l invocation messages
justschen
previously approved these changes
Mar 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the chat LanguageModelToolsService so tool invocations that already surface image outputs via markdown “file pill” links don’t also force-enable toolResultDetails purely due to image data in the tool result. This aims to reduce duplicated UI output when tools provide image files as inline file widgets.
Changes:
- Passes the current
ChatToolInvocationintoensureToolDetailsso it can inspect the invocation message. - Adds detection for empty-text markdown links (
[](uri)/[ ](uri)) that point to image files. - Skips auto-populating
toolResultDetailsfor image outputs when the invocation message already contains image file widgets.
Comments suppressed due to low confidence (1)
src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.ts:989
- This introduces new behavior around suppressing
toolResultDetailswhen the invocation message contains image file widgets, but there are no corresponding tests. There’s already a dedicatedlanguageModelToolsService.test.ts; please add coverage for (1) an imagetoolResult.contentwith atoolResultMessage/pastTenseMessagecontaining[](file:///...png)sotoolResultDetailsstays unset, and (2) the same with query/fragment in the URI to ensure detection still works.
private ensureToolDetails(dto: IToolInvocation, toolResult: IToolResult, toolData: IToolData, toolInvocation: ChatToolInvocation | undefined): void {
if (!toolResult.toolResultDetails && (toolData.alwaysDisplayInputOutput || (this.toolResultHasImages(toolResult) && !this.toolInvocationMessageHasImageFileWidgets(toolInvocation)))) {
toolResult.toolResultDetails = {
joshspicer
approved these changes
Mar 13, 2026
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.
No description provided.