Skip to content

Enhance LanguageModelToolsService to handle image file widgets in tool invocation messages#301595

Merged
rebornix merged 2 commits intomainfrom
rebornix/diverse-hawk
Mar 13, 2026
Merged

Enhance LanguageModelToolsService to handle image file widgets in tool invocation messages#301595
rebornix merged 2 commits intomainfrom
rebornix/diverse-hawk

Conversation

@rebornix
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 13, 2026 20:52
@rebornix rebornix self-assigned this Mar 13, 2026
@rebornix rebornix requested a review from justschen March 13, 2026 20:52
@rebornix rebornix marked this pull request as ready for review March 13, 2026 20:53
justschen
justschen previously approved these changes Mar 13, 2026
@vs-code-engineering vs-code-engineering bot added this to the 1.112.0 milestone Mar 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ChatToolInvocation into ensureToolDetails so it can inspect the invocation message.
  • Adds detection for empty-text markdown links ([](uri) / [ ](uri)) that point to image files.
  • Skips auto-populating toolResultDetails for 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 toolResultDetails when the invocation message contains image file widgets, but there are no corresponding tests. There’s already a dedicated languageModelToolsService.test.ts; please add coverage for (1) an image toolResult.content with a toolResultMessage/pastTenseMessage containing [](file:///...png) so toolResultDetails stays 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 = {

Comment thread src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.ts Outdated
Comment thread src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.ts Outdated
@rebornix rebornix merged commit 1037a02 into main Mar 13, 2026
20 checks passed
@rebornix rebornix deleted the rebornix/diverse-hawk branch March 13, 2026 21:50
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.

4 participants