Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions ui/desktop/src/components/ToolCallWithResponse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ function McpAppWrapper({
}
}

const extensionName =
requestWithMeta.toolCall.status === 'success'
? requestWithMeta.toolCall.value.name.split('__')[0]
: '';
// Tool names are formatted as "{extension_name}__{tool_name}".
// Extension names can contain underscores (special chars like parentheses are normalized to "_"),
// so we must use lastIndexOf to find the delimiter.
// e.g., "my_server(local)" -> "my_server_local_" -> "my_server_local___get_time"
const toolCallName =
requestWithMeta.toolCall.status === 'success' ? requestWithMeta.toolCall.value.name : '';
const delimiterIndex = toolCallName.lastIndexOf('__');
const extensionName = delimiterIndex === -1 ? '' : toolCallName.substring(0, delimiterIndex);
Comment on lines +105 to +106
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DOsinga I think this will work for double parentheses as well.

Since the delimiterIndex is the position of the last _ _ occurrence, this should successfully trim off the tool name while keeping the parentheses-to-underscores conversion intact.

extension(yeah) -> extension_yeah_ __tool_name
extension((yeah)) -> extension__yeah__ __tool_name

Do you agree?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh yeah. but I dont think there's anything stopping authors from putting underscores in toolnames. I think longer term we should just not concat this and then take it apart again (this also makes extension names no unqiue after normalization). we should just pass the original names of extensions and tools around


const toolArguments =
requestWithMeta.toolCall.status === 'success'
Expand Down
Loading