From b5084bfc5625b0ead8257222c1fee1132f8b99d3 Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Thu, 14 May 2026 15:36:22 -0400 Subject: [PATCH] fix(ui): show tool name in approval prompt (#9216) Signed-off-by: Douwe Osinga Co-authored-by: Douwe Osinga --- .../src/components/ToolCallConfirmation.tsx | 24 ++++++++++++------- ui/desktop/src/i18n/messages/en.json | 8 +++---- ui/desktop/src/i18n/messages/zh-CN.json | 8 +++---- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/ui/desktop/src/components/ToolCallConfirmation.tsx b/ui/desktop/src/components/ToolCallConfirmation.tsx index 487902ccf0..a91f75955b 100644 --- a/ui/desktop/src/components/ToolCallConfirmation.tsx +++ b/ui/desktop/src/components/ToolCallConfirmation.tsx @@ -1,18 +1,25 @@ import { ActionRequired } from '../api'; import { defineMessages, useIntl } from '../i18n'; +import { snakeToTitleCase } from '../utils'; import ToolApprovalButtons from './ToolApprovalButtons'; const i18n = defineMessages({ - allowToolCall: { - id: 'toolConfirmation.allowToolCall', - defaultMessage: 'Do you allow this tool call?', + allowToolCallWithName: { + id: 'toolConfirmation.allowToolCallWithName', + defaultMessage: 'Allow {toolName}?', }, - gooseWouldLikeToCall: { - id: 'toolConfirmation.gooseWouldLikeToCall', - defaultMessage: 'Goose would like to call the above tool. Allow?', + gooseWouldLikeToCallWithName: { + id: 'toolConfirmation.gooseWouldLikeToCallWithName', + defaultMessage: 'Goose would like to call {toolName}. Allow?', }, }); +function formatToolName(fullName: string): string { + const delimiterIndex = fullName.lastIndexOf('__'); + const shortName = delimiterIndex === -1 ? fullName : fullName.substring(delimiterIndex + 2); + return snakeToTitleCase(shortName); +} + type ToolConfirmationData = Extract; interface ToolConfirmationProps { @@ -29,13 +36,14 @@ export default function ToolConfirmation({ const intl = useIntl(); const data = actionRequiredContent.data as ToolConfirmationData; const { id, toolName, prompt } = data; + const displayName = formatToolName(toolName); return (
{prompt - ? intl.formatMessage(i18n.allowToolCall) - : intl.formatMessage(i18n.gooseWouldLikeToCall)} + ? intl.formatMessage(i18n.allowToolCallWithName, { toolName: displayName }) + : intl.formatMessage(i18n.gooseWouldLikeToCallWithName, { toolName: displayName })}