Skip to content

Commit bbdb4b4

Browse files
authored
fix(agenticChat): UX fixes for MCP (#1661)
* fix: setting mute as false for mcp tools * fix: set muted as false for mcp
1 parent 1991658 commit bbdb4b4

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

chat-client/src/client/mynahUi.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -995,11 +995,9 @@ export const createMynahUi = (
995995
* Creates a properly formatted chat item for MCP tool summary with accordion view
996996
*/
997997
const createMcpToolSummaryItem = (message: ChatMessage, isPartialResult?: boolean): Partial<ChatItem> => {
998-
const muted = message.summary?.content?.header?.status !== undefined
999998
return {
1000999
type: ChatItemType.ANSWER,
10011000
messageId: message.messageId,
1002-
muted,
10031001
summary: {
10041002
content: message.summary?.content
10051003
? {
@@ -1028,7 +1026,7 @@ export const createMynahUi = (
10281026
: undefined,
10291027
fullWidth: true,
10301028
padding: false,
1031-
muted: true,
1029+
muted: false,
10321030
wrapCodes: item.header?.body === 'Parameters' ? true : false,
10331031
codeBlockActions: { copy: null, 'insert-to-cursor': null },
10341032
})) || [],

server/aws-lsp-codewhisperer/src/language-server/agenticChat/agenticChatController.ts

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -941,14 +941,18 @@ export class AgenticChatController implements ChatHandlers {
941941
toolUse: ToolUse,
942942
resultStream: AgenticChatResultStream,
943943
promptBlockId: number,
944-
session: ChatSessionService
944+
session: ChatSessionService,
945+
toolName: string
945946
) {
946947
const deferred = this.#createDeferred()
947948
session.setDeferredToolExecution(toolUse.toolUseId!, deferred.resolve, deferred.reject)
948-
this.#log(`Prompting for tool approval for tool: ${toolUse.name}`)
949+
this.#log(`Prompting for tool approval for tool: ${toolName ?? toolUse.name}`)
949950
await deferred.promise
950951
// Note: we want to overwrite the button block because it already exists in the stream.
951-
await resultStream.overwriteResultBlock(this.#getUpdateToolConfirmResult(toolUse, true), promptBlockId)
952+
await resultStream.overwriteResultBlock(
953+
this.#getUpdateToolConfirmResult(toolUse, true, toolName),
954+
promptBlockId
955+
)
952956
}
953957

954958
/**
@@ -1054,7 +1058,13 @@ export class AgenticChatController implements ChatHandlers {
10541058
)
10551059
}
10561060
if (requiresAcceptance) {
1057-
await this.waitForToolApproval(toolUse, chatResultStream, cachedButtonBlockId, session)
1061+
await this.waitForToolApproval(
1062+
toolUse,
1063+
chatResultStream,
1064+
cachedButtonBlockId,
1065+
session,
1066+
toolUse.name
1067+
)
10581068
}
10591069
if (isExecuteBash) {
10601070
this.#telemetryController.emitInteractWithAgenticChat(
@@ -1098,7 +1108,8 @@ export class AgenticChatController implements ChatHandlers {
10981108
toolUse,
10991109
chatResultStream,
11001110
cachedButtonBlockId,
1101-
session
1111+
session,
1112+
toolName
11021113
)
11031114
}
11041115

@@ -1230,7 +1241,7 @@ export class AgenticChatController implements ChatHandlers {
12301241
// Handle ToolApprovalException for any tool
12311242
if (err instanceof ToolApprovalException && cachedButtonBlockId) {
12321243
await chatResultStream.overwriteResultBlock(
1233-
this.#getUpdateToolConfirmResult(toolUse, false),
1244+
this.#getUpdateToolConfirmResult(toolUse, false, toolUse.name),
12341245
cachedButtonBlockId
12351246
)
12361247
if (err.shouldShowMessage) {
@@ -1525,8 +1536,13 @@ export class AgenticChatController implements ChatHandlers {
15251536
* @param toolType Optional tool type for specialized handling
15261537
* @returns ChatResult with appropriate confirmation UI
15271538
*/
1528-
#getUpdateToolConfirmResult(toolUse: ToolUse, isAccept: boolean, toolType?: string): ChatResult {
1529-
const toolName = toolType || toolUse.name
1539+
#getUpdateToolConfirmResult(
1540+
toolUse: ToolUse,
1541+
isAccept: boolean,
1542+
originalToolName: string,
1543+
toolType?: string
1544+
): ChatResult {
1545+
const toolName = originalToolName ?? (toolType || toolUse.name)
15301546

15311547
// Handle bash commands with special formatting
15321548
if (toolName === 'executeBash') {
@@ -1585,15 +1601,15 @@ export class AgenticChatController implements ChatHandlers {
15851601
break
15861602

15871603
default:
1588-
// Default tool (not MCP)
1604+
// Default tool (not only MCP)
15891605
return {
15901606
type: 'tool',
15911607
messageId: toolUse.toolUseId!,
15921608
summary: {
15931609
content: {
15941610
header: {
15951611
icon: 'tools',
1596-
body: `${toolUse.name}`,
1612+
body: `${toolName}`,
15971613
status: {
15981614
status: isAccept ? 'success' : 'error',
15991615
icon: isAccept ? 'ok' : 'cancel',

0 commit comments

Comments
 (0)