fix: handle toolnames without underscores (#6318)

Signed-off-by: Kyle Dunn <kdunn926@gmail.com>
This commit is contained in:
kdunn926
2026-01-01 18:22:18 -07:00
committed by GitHub
parent 5a5312a2e6
commit dd03d2aa95
@@ -208,6 +208,14 @@ const notificationToProgress = (notification: NotificationEvent): Progress => {
return message.params as 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 // Helper function to extract extension name for tooltip
const getExtensionTooltip = (toolCallName: string): string | null => { const getExtensionTooltip = (toolCallName: string): string | null => {
const lastIndex = toolCallName.lastIndexOf('__'); const lastIndex = toolCallName.lastIndexOf('__');
@@ -315,7 +323,7 @@ function ToolCallView({
// Function to create a descriptive representation of what the tool is doing // Function to create a descriptive representation of what the tool is doing
const getToolDescription = (): string | null => { const getToolDescription = (): string | null => {
const args = toolCall.arguments as Record<string, ToolCallArgumentValue>; const args = toolCall.arguments as Record<string, ToolCallArgumentValue>;
const toolName = toolCall.name.substring(toolCall.name.lastIndexOf('__') + 2); const toolName = getToolName(toolCall.name);
const getStringValue = (value: ToolCallArgumentValue): string => { const getStringValue = (value: ToolCallArgumentValue): string => {
return typeof value === 'string' ? value : JSON.stringify(value); return typeof value === 'string' ? value : JSON.stringify(value);
@@ -481,7 +489,7 @@ function ToolCallView({
return description; return description;
} }
// Fallback tool name formatting // Fallback tool name formatting
return snakeToTitleCase(toolCall.name.substring(toolCall.name.lastIndexOf('__') + 2)); return snakeToTitleCase(getToolName(toolCall.name));
}; };
// Map LoadingStatus to ToolCallStatus // Map LoadingStatus to ToolCallStatus
const getToolCallStatus = (loadingStatus: LoadingStatus): ToolCallStatus => { const getToolCallStatus = (loadingStatus: LoadingStatus): ToolCallStatus => {