Skip to content

[firebase_ai]: Grounding with Google not working in Flutter #17687

Description

@theshivamlko

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Other

Which platforms are affected?

Android

Description

I adding multiple tools with grounding using Firebase Ai Logic with Gemini API.

All tools are working but googleSearch fails,

Error: ServerException Tool use with function calling is unsupported

if i remove Tool.googleSearch(), everything works then.

  firebase_ai: ^3.2.0
  firebase_core: ^4.1.0

  final GenerativeModel _model = FirebaseAI.googleAI().generativeModel(
        model: modalName,
        generationConfig: GenerationConfig(),
        tools: [
          Tool.functionDeclarations([changeAppThemeTool, writeToTextFileTool]),
          Tool.googleSearch(),
        ],
      );

user Input

String text="Who won the recent cricket world cup?";

 String finalPrompt="""
      Follow the instructions give by user.
      
      ${text.trim()}
   
      Use the following tools or sequence of tools if needed:
      1. changeAppTheme: change the app theme colors based on user's request, notify
      2. Google Search if needed to get the latest information.
      3. 
      
      If no tool required treat normal text response.
      If tools is triggered the combine result of user query along with result return from tools
      """


Reproducing the issue

 modalName = 'gemini-2.5-flash';
prompt="Who won the recent cricket world cup?";

 final GenerativeModel _model = FirebaseAI.googleAI().generativeModel(
        model: modalName,
        generationConfig: GenerationConfig(),
        tools: [
          Tool.googleSearch(),
        ],
      );

      final content = [Content.text(prompt)];
      final response = await _model.generateContent(content);


Firebase Core version

3.2.0

Flutter Version

3.32.0

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

I/flutter (31342): Error generating content: Tool use with function calling is unsupported
I/flutter (31342): #0 DeveloperSerialization.parseGenerateContentResponse (package:firebase_ai/src/developer/api.dart:108:56)
I/flutter (31342):
I/flutter (31342): #1 GeminiAiServices.generateContent (package:flutter_app_vertex_ai_agent/services/gemini_ai_services.dart:29:24)
I/flutter (31342):
I/flutter (31342): #2 _GenerateContentPageState.generateContent (package:flutter_app_vertex_ai_agent/screens/generate_content_page.dart:437:29)
I/flutter (31342):
I/flutter (31342): Error generateContent: ServerException Tool use with function calling is unsupported

Activity

  1. added
    platform: androidIssues / PRs which are specifically for Android.
    plugin: ailabel issues for firebase_ai plugin
    on Sep 2, 2025
  2. SelaseKay commented on Sep 2, 2025

    @SelaseKay
    Contributor

    Hi @theshivamlko, thanks for the report. I was able to reproduce this issue. It appears only one tool is supported at a time per my research. The documentation should be updated to reflect this.

    Reference: google/adk-python#53 (comment)

    cc @kevinthecheung

  3. added
    type: documentationImprovements or additions to documentation
    and removed
    type: bugSomething isn't working
    on Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs AttentionThis issue needs maintainer attention.platform: androidIssues / PRs which are specifically for Android.plugin: ailabel issues for firebase_ai plugintype: documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions