fix: update tool name formatting from '/' to '-' in ToolCard and mcpService (#164)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
samanhappy
2025-06-05 15:34:49 +08:00
committed by GitHub
parent 503b60edb7
commit 3a421bc476
2 changed files with 7 additions and 7 deletions

View File

@@ -203,7 +203,7 @@ export const initializeClientsFromSettings = (isInit: boolean): ServerInfo[] =>
}
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)}`);