Hi
I’ve been building something and I’ve been using my platform to test various models in a real life agentic workflow.
I ran into a few issues using Google’s API and Gemini 2.5 models here they are:
1. Tool call ID is missing
I use the OpenAI compatibility endpoint, one of the problems I’m finding is that the id
in the tool call is empty.
{
"messages": [
{
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"body\":{\"query\":\"Disney movies\",\"_source\":[\"id\",\"title\",\"overview\",\"poster_path\"]},\"path\":{\"index\":\"tama-movie-db-movie-details\"}}",
"name": "search-index_text-based-vector-search"
},
"id": "",
"type": "function"
}
]
},
{
"code": 200,
"content": "{\"_shards\":{\"failed\":0,\"skipped\":0,\"successful\":1,\"total\":1},\"hits\":{\"hits\":[{\"_id\":\"762509\",\"_index\":\"tama-movie-db-movie-details-1751527871\",\"_score\":1.4414322,\"_source\":{\"id\":762509,\"overview\":\"Mufasa, a cub lost and alone, meets a sympathetic lion named Taka, the heir to a royal bloodline. The chance meeting sets in motion an expansive journey of a group of misfits searching for their destiny.\",\"poster_path\":\"/lurEK87kukWNaHd0zYnsi3yzJrs.jpg\",\"title\":\"Mufasa: The Lion King\"}},{\"_id\":\"1241982\",\"_index\":\"tama-movie-db-movie-details-1751527871\",\"_score\":1.344223,\"_source\":{\"id\":1241982,\"overview\":\"After receiving an unexpected call from her wayfinding ancestors, Moana journeys alongside Maui and a new crew to the far seas of Oceania and into dangerous, long-lost waters for an adventure unlike anything she's ever faced.\",\"poster_path\":\"/aLVkiINlIeCkcZIzb7XHzPYgO6L.jpg\",\"title\":\"Moana 2\"}}],\"max_score\":1.4414322,\"total\":{\"relation\":\"eq\",\"value\":2}},\"timed_out\":false,\"took\":1706}",
"content_type": "application/json",
"name": "search-index_text-based-vector-search",
"role": "tool",
"tool_call_id": ""
}
]
}
2. Unable to correctly generate arguments for function call
Second problem I ran into is none of the Gemini models I’ve tried is able to successfully generate a proper query for a certain specific case. I’m not sure if this is some kind of bug or a limitation of the model itself. However the exact same prompt has been fed into other models like mistral-small-3.2
grok-3-mini
claude-3-5-haiku-latest
gpt-4.1
command-a-03-2025
all were able to generate queries successfully and consistently without errors.
This is an example of a successful tool call with mistral-small-3.2
, I also get the same response from the models I mentioned above.
{
"messages": [
{
"content": "",
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"path\": {\"index\": \"tama-movie-db-movie-details\"}, \"body\": {\"query\": {\"bool\": {\"filter\": [{\"term\": {\"id\": 1241982}}], \"must\": [{\"nested\": {\"path\": \"movie-credits.cast\", \"query\": {\"wildcard\": {\"movie-credits.cast.character\": \"*Maui*\"}}, \"inner_hits\": {\"_source\": [\"movie-credits.cast.name\", \"movie-credits.cast.character\", \"movie-credits.cast.profile_path\"]}}}]}}, \"_source\": [\"id\", \"title\"]}}",
"name": "search-index_search-and-sort-based-search"
},
"id": "hfQRO8fgZ",
"index": 0,
"type": "function"
}
]
},
{
"code": 200,
"content": "{\"_shards\":{\"failed\":0,\"skipped\":0,\"successful\":1,\"total\":1},\"hits\":{\"hits\":[{\"_id\":\"1241982\",\"_index\":\"tama-movie-db-movie-details-1751527871\",\"_score\":1.0,\"_source\":{\"id\":1241982,\"title\":\"Moana 2\"},\"inner_hits\":{\"movie-credits.cast\":{\"hits\":{\"hits\":[{\"_id\":\"1241982\",\"_index\":\"tama-movie-db-movie-details-1751527871\",\"_nested\":{\"field\":\"movie-credits.cast\",\"offset\":1},\"_score\":1.0,\"_source\":{\"character\":\"Maui (voice)\",\"name\":\"Dwayne Johnson\",\"profile_path\":\"/5QApZVV8FUFlVxQpIK3Ew6cqotq.jpg\"}}],\"max_score\":1.0,\"total\":{\"relation\":\"eq\",\"value\":1}}}}}],\"max_score\":1.0,\"total\":{\"relation\":\"eq\",\"value\":1}},\"timed_out\":false,\"took\":15}",
"content_type": "application/json",
"name": "search-index_search-and-sort-based-search",
"role": "tool",
"tool_call_id": "hfQRO8fgZ"
}
]
}
Here is an example of the problematic output from gemini-2.0-flash
{
"messages": [
{
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"body\":{\"_source\":[\"id\",\"title\"],\"query\":{},\"sort\":[],\"parent_entity_id\":\"0197cf34-a0a1-74cb-986a-ee9ef867e213\"},\"path\":{\"index\":\"tama-movie-db-movie-details\"}}",
"name": "search-index_search-and-sort-based-search"
},
"id": "",
"type": "function"
}
]
},
{
"code": 400,
"content": "{\"error\":{\"col\":46,\"line\":1,\"reason\":\"Unknown key for a VALUE_STRING in [parent_entity_id].\",\"root_cause\":[{\"col\":46,\"line\":1,\"reason\":\"Unknown key for a VALUE_STRING in [parent_entity_id].\",\"type\":\"parsing_exception\"}],\"type\":\"parsing_exception\"},\"status\":400}",
"content_type": "application/json",
"name": "search-index_search-and-sort-based-search",
"role": "tool",
"tool_call_id": ""
}
]
}
Notice the query in the arguments
is an empty object "query": {}
.
I also did another call using gemini-2.5-pro
what’s fascinating is during reasoning it seems to understand what it’s supposed to do, but the output is just an empty query object just like gemini-2.0-flash
. Note that the sample below is called using openrouter
so the tool correctly contains the id
{
"messages": [
{
"content": "",
"reasoning": "**Identifying the Actor**\n\nI've pinpointed the core task: determining the actor who portrays Maui in Moana 2. The need is clear, and I'm leaning towards the \"search\\_index\\_search\\_and\\_sort\\_based\\_search\" tool to address the user's inquiry efficiently.\n\n\n**Constructing the Query**\n\nI'm refining the search query now. I'm structuring the `search_index_search_and_sort_based_search` tool's `body` parameter. I've figured out the `path` and the basics of the `_source`. The `query` parameter's becoming more complex. I'm implementing a nested query within a bool query to accurately pinpoint the actor.\n\n\n**Assembling the Parameters**\n\nI'm now assembling the JSON for the `search_index_search_and_sort_based_search` tool's body. I'm leveraging a `bool` query, filtering by the movie ID. A nested query targeting \"Maui\" within the `movie-credits.cast` field is also in progress. I'll incorporate a wildcard query to manage variations in the character name.\n\n\n**Query Refinement and Execution**\n\nI'm now fine-tuning the JSON payload. It includes a nested query to target the character \"Maui\" within the `movie-credits.cast` field, using a wildcard to allow for variations. The `inner_hits` option is specified to pull actor details. The final tool call parameters, including the path and body, are being formulated for immediate use.\n\n\n**Query Formulation Completion**\n\nI've successfully constructed the JSON payload for the `search_index_search_and_sort_based_search` tool. The `body` parameter now features a `bool` query, incorporating filtering by movie ID and a nested query to search the `movie-credits.cast` field for \"Maui.\" The `inner_hits` configuration ensures actor details are extracted, and the query is finalized, making me ready for the call.\n\n\n",
"refusal": null,
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"body\":{\"sort\":[],\"query\":{},\"_source\":[\"id\",\"title\"]},\"path\":{\"index\":\"tama-movie-db-movie-details\"}}",
"name": "search-index_search-and-sort-based-search"
},
"id": "tool_0_search-index_search-and-sort-based-search",
"index": 0,
"type": "function"
}
]
},
{
"code": 400,
"content": "{\"error\":{\"reason\":\"query malformed, empty clause found at [1:36]\",\"root_cause\":[{\"reason\":\"query malformed, empty clause found at [1:36]\",\"type\":\"illegal_argument_exception\"}],\"type\":\"illegal_argument_exception\"},\"status\":400}",
"content_type": "application/json",
"name": "search-index_search-and-sort-based-search",
"role": "tool",
"tool_call_id": "tool_0_search-index_search-and-sort-based-search"
}
]
}
I used gemini-2.0-flash
in another function call and it was able to correctly generate the query:
{
"messages": [
{
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{\"body\":{\"query\":\"Disney movies\",\"_source\":[\"id\",\"title\",\"overview\",\"poster_path\"]},\"path\":{\"index\":\"tama-movie-db-movie-details\"}}",
"name": "search-index_text-based-vector-search"
},
"id": "",
"type": "function"
}
]
},
{
"code": 200,
"content": "{\"_shards\":{\"failed\":0,\"skipped\":0,\"successful\":1,\"total\":1},\"hits\":{\"hits\":[{\"_id\":\"762509\",\"_index\":\"tama-movie-db-movie-details-1751527871\",\"_score\":1.4414322,\"_source\":{\"id\":762509,\"overview\":\"Mufasa, a cub lost and alone, meets a sympathetic lion named Taka, the heir to a royal bloodline. The chance meeting sets in motion an expansive journey of a group of misfits searching for their destiny.\",\"poster_path\":\"/lurEK87kukWNaHd0zYnsi3yzJrs.jpg\",\"title\":\"Mufasa: The Lion King\"}},{\"_id\":\"1241982\",\"_index\":\"tama-movie-db-movie-details-1751527871\",\"_score\":1.344223,\"_source\":{\"id\":1241982,\"overview\":\"After receiving an unexpected call from her wayfinding ancestors, Moana journeys alongside Maui and a new crew to the far seas of Oceania and into dangerous, long-lost waters for an adventure unlike anything she's ever faced.\",\"poster_path\":\"/aLVkiINlIeCkcZIzb7XHzPYgO6L.jpg\",\"title\":\"Moana 2\"}}],\"max_score\":1.4414322,\"total\":{\"relation\":\"eq\",\"value\":2}},\"timed_out\":false,\"took\":1706}",
"content_type": "application/json",
"name": "search-index_text-based-vector-search",
"role": "tool",
"tool_call_id": ""
}
]
}
The problem seems to specifically be just that search-index_search-and-sort-based-search
tool.
I do believe Gemini family of models are very strong and believe that this is some sort of bug.