diff --git a/src/renderer/src/aiCore/clients/gemini/GeminiAPIClient.ts b/src/renderer/src/aiCore/clients/gemini/GeminiAPIClient.ts index 0f1bad0bf8..d32564d962 100644 --- a/src/renderer/src/aiCore/clients/gemini/GeminiAPIClient.ts +++ b/src/renderer/src/aiCore/clients/gemini/GeminiAPIClient.ts @@ -593,6 +593,13 @@ export class GeminiAPIClient extends BaseApiClient< } } as LLMWebSearchCompleteChunk) } + if (toolCalls.length > 0) { + controller.enqueue({ + type: ChunkType.MCP_TOOL_CREATED, + tool_calls: [...toolCalls] + }) + toolCalls.length = 0 + } controller.enqueue({ type: ChunkType.LLM_RESPONSE_COMPLETE, response: { diff --git a/src/renderer/src/utils/mcp-tools.ts b/src/renderer/src/utils/mcp-tools.ts index b39d9b6bc3..4b7a2e4735 100644 --- a/src/renderer/src/utils/mcp-tools.ts +++ b/src/renderer/src/utils/mcp-tools.ts @@ -391,7 +391,7 @@ export function geminiFunctionCallToMcpTool( ): MCPTool | undefined { if (!toolCall) return undefined if (!mcpTools) return undefined - const tool = mcpTools.find((tool) => tool.id === toolCall.name) + const tool = mcpTools.find((tool) => tool.id === toolCall.name || tool.name === toolCall.name) if (!tool) { return undefined }