@@ -201,7 +201,10 @@ import { URI } from 'vscode-uri'
201201import { CommandCategory } from './tools/executeBash'
202202import { UserWrittenCodeTracker } from '../../shared/userWrittenCodeTracker'
203203import { CodeReview } from './tools/qCodeAnalysis/codeReview'
204- import { FINDINGS_MESSAGE_SUFFIX } from './tools/qCodeAnalysis/codeReviewConstants'
204+ import {
205+ CODE_REVIEW_FINDINGS_MESSAGE_SUFFIX ,
206+ DISPLAY_FINDINGS_MESSAGE_SUFFIX ,
207+ } from './tools/qCodeAnalysis/codeReviewConstants'
205208import { McpEventHandler } from './tools/mcp/mcpEventHandler'
206209import { enabledMCP , createNamespacedToolName } from './tools/mcp/mcpUtils'
207210import { McpManager } from './tools/mcp/mcpManager'
@@ -225,6 +228,7 @@ import { getLatestAvailableModel } from './utils/agenticChatControllerHelper'
225228import { ActiveUserTracker } from '../../shared/activeUserTracker'
226229import { UserContext } from '../../client/token/codewhispererbearertokenclient'
227230import { CodeWhispererServiceToken } from '../../shared/codeWhispererService'
231+ import { DisplayFindings } from './tools/qCodeAnalysis/displayFindings'
228232
229233type ChatHandlers = Omit <
230234 LspHandlers < Chat > ,
@@ -1764,7 +1768,8 @@ export class AgenticChatController implements ChatHandlers {
17641768 break
17651769 }
17661770 case CodeReview . toolName :
1767- // no need to write tool message for code review
1771+ case DisplayFindings . toolName :
1772+ // no need to write tool message for CodeReview or DisplayFindings
17681773 break
17691774 // — DEFAULT ⇒ Only MCP tools, but can also handle generic tool execution messages
17701775 default :
@@ -1940,11 +1945,27 @@ export class AgenticChatController implements ChatHandlers {
19401945 ) {
19411946 await chatResultStream . writeResultBlock ( {
19421947 type : 'tool' ,
1943- messageId : toolUse . toolUseId + FINDINGS_MESSAGE_SUFFIX ,
1948+ messageId : toolUse . toolUseId + CODE_REVIEW_FINDINGS_MESSAGE_SUFFIX ,
19441949 body : ( codeReviewResult . output . content as any ) . findingsByFile ,
19451950 } )
19461951 }
19471952 break
1953+ case DisplayFindings . toolName :
1954+ // no need to write tool result for code review, this is handled by model via chat
1955+ // Push result in message so that it is picked by IDE plugin to show in issues panel
1956+ const displayFindingsResult = result as InvokeOutput
1957+ if (
1958+ displayFindingsResult ?. output ?. kind === 'json' &&
1959+ displayFindingsResult . output . success &&
1960+ displayFindingsResult . output . content !== undefined
1961+ ) {
1962+ await chatResultStream . writeResultBlock ( {
1963+ type : 'tool' ,
1964+ messageId : toolUse . toolUseId + DISPLAY_FINDINGS_MESSAGE_SUFFIX ,
1965+ body : JSON . stringify ( displayFindingsResult . output . content ) ,
1966+ } )
1967+ }
1968+ break
19481969 // — DEFAULT ⇒ MCP tools
19491970 default :
19501971 await this . #handleMcpToolResult( toolUse , result , session , chatResultStream )
0 commit comments