From d50dabe46b11bb70a580d41ce420744f59f54a62 Mon Sep 17 00:00:00 2001 From: LordMelkor Date: Thu, 3 Jul 2025 23:04:37 -0400 Subject: [PATCH] refactor: Improve tool call display formatting and comments - Fix generic tool fallback to show meaningful descriptions (ToolName + arguments) - Update comments to describe current functionality rather than historical references - Remove references to "old system" and outdated implementation details - Improve code readability for developers unfamiliar with historical context - Ensure all MCP tools display properly with fallback formatting This addresses tool display issues where some tools showed only argument keys instead of meaningful descriptions, and cleans up confusing historical references in code comments. --- .../src/components/ToolCallWithResponse.tsx | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ui/desktop/src/components/ToolCallWithResponse.tsx b/ui/desktop/src/components/ToolCallWithResponse.tsx index 971bfea58f5b..1352bcbc4566 100644 --- a/ui/desktop/src/components/ToolCallWithResponse.tsx +++ b/ui/desktop/src/components/ToolCallWithResponse.tsx @@ -277,7 +277,7 @@ function ToolCallView({ if (args.window_title) { return `capturing window "${truncate(getStringValue(args.window_title))}"`; } - return 'capturing screen'; + return `capturing screen`; case 'automation_script': if (args.language) { @@ -289,23 +289,29 @@ function ToolCallView({ return 'final output'; case 'computer_control': - return 'poking around...'; + return `poking around...`; default: { - // Fallback to showing key parameters for unknown tools + // Generic fallback for unknown tools: ToolName + CompactArguments + // This ensures any MCP tool works without explicit handling + const toolDisplayName = snakeToTitleCase(toolName); const entries = Object.entries(args); - if (entries.length === 0) return null; + + if (entries.length === 0) { + return `${toolDisplayName}`; + } // For a single parameter, show key and truncated value if (entries.length === 1) { const [key, value] = entries[0]; const stringValue = getStringValue(value); const truncatedValue = truncate(stringValue, 30); - return `${key}: ${truncatedValue}`; + return `${toolDisplayName} ${key}: ${truncatedValue}`; } - // For multiple parameters, just show the keys - return entries.map(([key]) => key).join(', '); + // For multiple parameters, show tool name and keys + const keys = entries.map(([key]) => key).join(', '); + return `${toolDisplayName} ${keys}`; } } @@ -325,7 +331,7 @@ function ToolCallView({ if (description) { return description; } - // Fallback to the original tool name formatting + // Fallback tool name formatting return snakeToTitleCase(toolCall.name.substring(toolCall.name.lastIndexOf('__') + 2)); })()}