diff --git a/src/renderer/src/utils/mcp-tools.ts b/src/renderer/src/utils/mcp-tools.ts index ca3e355768..e575917f7a 100644 --- a/src/renderer/src/utils/mcp-tools.ts +++ b/src/renderer/src/utils/mcp-tools.ts @@ -417,10 +417,12 @@ export function geminiFunctionCallToMcpTool( ): MCPTool | undefined { if (!toolCall) return undefined if (!mcpTools) return undefined - const tool = mcpTools.find((tool) => tool.id === toolCall.name || tool.name === toolCall.name) - if (!tool) { - return undefined - } + + const toolName = toolCall.name || toolCall.id + if (!toolName) return undefined + + const tool = mcpTools.find((tool) => tool.id.includes(toolName) || tool.name.includes(toolName)) + return tool }