fix(Google Gemini Node): Error when used as tool with "Message a model" operation (#17491)

This commit is contained in:
RomanDavydchuk
2025-07-23 20:43:13 +03:00
committed by GitHub
parent 3825f8a806
commit f30cc7b6cf
2 changed files with 5 additions and 1 deletions

View File

@@ -51,6 +51,7 @@ describe('GoogleGemini Node', () => {
return undefined; return undefined;
} }
}); });
executeFunctionsMock.getNodeInputs.mockReturnValue([{ type: 'main' }, { type: 'ai_tool' }]);
getConnectedToolsMock.mockResolvedValue([]); getConnectedToolsMock.mockResolvedValue([]);
apiRequestMock.mockResolvedValue({ apiRequestMock.mockResolvedValue({
candidates: [ candidates: [

View File

@@ -236,7 +236,10 @@ export async function execute(this: IExecuteFunctions, i: number): Promise<INode
responseMimeType: jsonOutput ? 'application/json' : undefined, responseMimeType: jsonOutput ? 'application/json' : undefined,
}; };
const availableTools = await getConnectedTools(this, true); const nodeInputs = this.getNodeInputs();
const availableTools = nodeInputs.some((i) => i.type === 'ai_tool')
? await getConnectedTools(this, true)
: [];
const tools: Tool[] = [ const tools: Tool[] = [
{ {
functionDeclarations: availableTools.map((t) => ({ functionDeclarations: availableTools.map((t) => ({