From 3a421bc4763112be50a50f80c16bb039582a5654 Mon Sep 17 00:00:00 2001 From: samanhappy Date: Thu, 5 Jun 2025 15:34:49 +0800 Subject: [PATCH] fix: update tool name formatting from '/' to '-' in ToolCard and mcpService (#164) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- frontend/src/components/ui/ToolCard.tsx | 4 ++-- src/services/mcpService.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/ui/ToolCard.tsx b/frontend/src/components/ui/ToolCard.tsx index 2f5a485..c9a6656 100644 --- a/frontend/src/components/ui/ToolCard.tsx +++ b/frontend/src/components/ui/ToolCard.tsx @@ -137,7 +137,7 @@ const ToolCard = ({ tool, server, onToggle, onDescriptionUpdate }: ToolCardProps >

- {tool.name.replace(server + '/', '')} + {tool.name.replace(server + '-', '')} {isEditingDescription ? ( <> @@ -229,7 +229,7 @@ const ToolCard = ({ tool, server, onToggle, onDescriptionUpdate }: ToolCardProps {/* Run Form */} {showRunForm && (
-

{t('tool.runToolWithName', { name: tool.name.replace(server + '/', '') })}

+

{t('tool.runToolWithName', { name: tool.name.replace(server + '-', '') })}

} serverInfo.tools = tools.tools.map((tool) => ({ - name: name + '/' + tool.name, + name: `${name}-${tool.name}`, description: tool.description || '', inputSchema: tool.inputSchema || {}, })); @@ -699,8 +699,8 @@ export const handleCallToolRequest = async (request: any, extra: any) => { `Invoking tool '${toolName}' on server '${targetServerInfo.name}' with arguments: ${JSON.stringify(finalArgs)}`, ); - toolName = toolName.startsWith(`${targetServerInfo.name}/`) - ? toolName.replace(`${targetServerInfo.name}/`, '') + toolName = toolName.startsWith(`${targetServerInfo.name}-`) + ? toolName.replace(`${targetServerInfo.name}-`, '') : toolName; const result = await client.callTool({ name: toolName, @@ -721,8 +721,8 @@ export const handleCallToolRequest = async (request: any, extra: any) => { throw new Error(`Client not found for server: ${request.params.name}`); } - request.params.name = request.params.name.startsWith(`${serverInfo.name}/`) - ? request.params.name.replace(`${serverInfo.name}/`, '') + request.params.name = request.params.name.startsWith(`${serverInfo.name}-`) + ? request.params.name.replace(`${serverInfo.name}-`, '') : request.params.name; const result = await client.callTool(request.params); console.log(`Tool call result: ${JSON.stringify(result)}`);