From b62e569643ab4fa0f5bbd25db6dc40e7458db66c Mon Sep 17 00:00:00 2001 From: waleed Date: Wed, 4 Feb 2026 01:28:48 -0800 Subject: [PATCH] chore(gemini): remove dead executeToolCall function --- apps/sim/providers/gemini/core.ts | 100 +----------------------------- 1 file changed, 1 insertion(+), 99 deletions(-) diff --git a/apps/sim/providers/gemini/core.ts b/apps/sim/providers/gemini/core.ts index 8328183ac..5abe2ab61 100644 --- a/apps/sim/providers/gemini/core.ts +++ b/apps/sim/providers/gemini/core.ts @@ -32,7 +32,7 @@ import { prepareToolsWithUsageControl, } from '@/providers/utils' import { executeTool } from '@/tools' -import type { ExecutionState, GeminiProviderType, GeminiUsage, ParsedFunctionCall } from './types' +import type { ExecutionState, GeminiProviderType, GeminiUsage } from './types' /** * Creates initial execution state @@ -78,104 +78,6 @@ function createInitialState( } } -/** - * Executes a tool call and updates state - */ -async function executeToolCall( - functionCallPart: Part, - functionCall: ParsedFunctionCall, - request: ProviderRequest, - state: ExecutionState, - forcedTools: string[], - logger: ReturnType -): Promise<{ success: boolean; state: ExecutionState }> { - const toolCallStartTime = Date.now() - const toolName = functionCall.name - - const tool = request.tools?.find((t) => t.id === toolName) - if (!tool) { - logger.warn(`Tool ${toolName} not found in registry, skipping`) - return { success: false, state } - } - - try { - const { toolParams, executionParams } = prepareToolExecution(tool, functionCall.args, request) - const result = await executeTool(toolName, executionParams) - const toolCallEndTime = Date.now() - const duration = toolCallEndTime - toolCallStartTime - - const resultContent: Record = result.success - ? ensureStructResponse(result.output) - : { error: true, message: result.error || 'Tool execution failed', tool: toolName } - - const toolCall: FunctionCallResponse = { - name: toolName, - arguments: toolParams, - startTime: new Date(toolCallStartTime).toISOString(), - endTime: new Date(toolCallEndTime).toISOString(), - duration, - result: resultContent, - } - - const updatedContents: Content[] = [ - ...state.contents, - { - role: 'model', - parts: [functionCallPart], - }, - { - role: 'user', - parts: [ - { - functionResponse: { - name: functionCall.name, - response: resultContent, - }, - }, - ], - }, - ] - - const forcedToolCheck = checkForForcedToolUsage( - [{ name: functionCall.name, args: functionCall.args }], - state.currentToolConfig, - forcedTools, - state.usedForcedTools - ) - - return { - success: true, - state: { - ...state, - contents: updatedContents, - toolCalls: [...state.toolCalls, toolCall], - toolResults: result.success - ? [...state.toolResults, result.output as Record] - : state.toolResults, - toolsTime: state.toolsTime + duration, - timeSegments: [ - ...state.timeSegments, - { - type: 'tool', - name: toolName, - startTime: toolCallStartTime, - endTime: toolCallEndTime, - duration, - }, - ], - usedForcedTools: forcedToolCheck?.usedForcedTools ?? state.usedForcedTools, - currentToolConfig: forcedToolCheck?.nextToolConfig ?? state.currentToolConfig, - }, - } - } catch (error) { - logger.error('Error processing function call:', { - error: error instanceof Error ? error.message : String(error), - functionName: toolName, - }) - return { success: false, state } - } -} - /** * Executes multiple tool calls in parallel and updates state. * Per Gemini docs, all function calls from a single response should be executed