Function calling error with Gemini 2.0 Flash

I have this error when using function call in a Tool Agent using gemini-2.0-flash (Gemini 2.5 Flash didn’t output this error). The tool is a workflow sub-node and the webhook input is on the same workflow.

Bad request - please check your parameters
[GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:streamGenerateContent?alt=sse: [400 Bad Request]
Unable to submit request because `Comanda` functionDeclaration `parameters.Comanda` schema didn't specify the schema type field.
Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling

This is the schema that gemini is expecting for function calling:

{
  "contents": ...,
  "tools": [
    {
      "function_declarations": [
        {
          "name": "find_movies",
          "description": "find movie titles currently playing in theaters based on any description, genre, title words, etc.",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616"
              },
              "description": {
                "type": "string",
                "description": "Any kind of description including category or genre, title words, attributes, etc."
              }
            },
            "required": [
              "description"
            ]
          }
        },
        {
          "name": "find_theaters",
          "description": "find theaters based on location and optionally movie title which are is currently playing in theaters",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616"
              },
              "movie": {
                "type": "string",
                "description": "Any movie title"
              }
            },
            "required": [
              "location"
            ]
          }
        },
        {
          "name": "get_showtimes",
          "description": "Find the start times for movies playing in a specific theater",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "The city and state, e.g. San Francisco, CA or a zip code e.g. 95616"
              },
              "movie": {
                "type": "string",
                "description": "Any movie title"
              },
              "theater": {
                "type": "string",
                "description": "Name of the theater"
              },
              "date": {
                "type": "string",
                "description": "Date for requested showtime"
              }
            },
            "required": [
              "location",
              "movie",
              "theater",
              "date"
            ]
          }
        }
      ]
    }
  ]
}

In general it’s very frustrating to work with Gemini in n8n. It looks like only ChatGPT is well covered but we can’t/shouldn’t use that in Europe for security reasons. Besides I foresee Gemini becoming the frontier model sooner than later.

Information on your n8n setup

  • n8n version: 1.90.1
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): queue
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: ubuntu 24.04

Hey @Dogway, maybe a silly question but did you try to get it to work via an HTTP node already?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.