diff --git a/ui/desktop/src/components/ToolCallWithResponse.tsx b/ui/desktop/src/components/ToolCallWithResponse.tsx index 9712ea03a67b..a1c029551503 100644 --- a/ui/desktop/src/components/ToolCallWithResponse.tsx +++ b/ui/desktop/src/components/ToolCallWithResponse.tsx @@ -208,6 +208,14 @@ const notificationToProgress = (notification: NotificationEvent): Progress => { return message.params as Progress; }; +// Helper function to extract toolcall name +const getToolName = (toolCallName: string): string => { + const lastIndex = toolCallName.lastIndexOf('__'); + if (lastIndex === -1) return toolCallName; + + return toolCallName.substring(lastIndex + 2); +} + // Helper function to extract extension name for tooltip const getExtensionTooltip = (toolCallName: string): string | null => { const lastIndex = toolCallName.lastIndexOf('__'); @@ -315,7 +323,7 @@ function ToolCallView({ // Function to create a descriptive representation of what the tool is doing const getToolDescription = (): string | null => { const args = toolCall.arguments as Record; - const toolName = toolCall.name.substring(toolCall.name.lastIndexOf('__') + 2); + const toolName = getToolName(toolCall.name); const getStringValue = (value: ToolCallArgumentValue): string => { return typeof value === 'string' ? value : JSON.stringify(value); @@ -481,7 +489,7 @@ function ToolCallView({ return description; } // Fallback tool name formatting - return snakeToTitleCase(toolCall.name.substring(toolCall.name.lastIndexOf('__') + 2)); + return snakeToTitleCase(getToolName(toolCall.name)); }; // Map LoadingStatus to ToolCallStatus const getToolCallStatus = (loadingStatus: LoadingStatus): ToolCallStatus => {