fix(GeminiAPIClient, mcp-tools): enhance tool call handling and lookup logic (#8009)

* fix(GeminiAPIClient, mcp-tools): enhance tool call handling and lookup logic

* fix: unuse log
This commit is contained in:
SuYao 2025-07-10 15:16:23 +08:00 committed by GitHub
parent f85f46c248
commit 3350c3e2e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -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: {

View File

@ -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
}