Function calling with a response mime type: 'application/json' is unsupported

Root Cause

  • The Gemini API does not currently support structured tool calling / function calling with JSON outputs (unlike OpenAI models).
  • The API only supports returning text or multimodal responses, not strongly typed JSON function responses when using tool calling.
  • Confirmed via these discussions:

Why This Matters

Structured output (JSON, function calling, or tool calling) is critical for:

  • Using the tools to solve the problems that llms are not great at.
  • Building reliable integrations without brittle text parsing.

9 Likes

Hi @Anirban_Majumder,

You are absolutely right about why this is a critical feature. I will have this feature request sent to the appropriate team.

Thanks for sharing.

1 Like

Yes, this is very much needed! We use OpenAI’s Agents SDK and want to migrate to Gemini but neither tools nor Responses API work. It is unbelievable that a company like Google cannot see that thousands of developers building on OpenAI’s Agents SDK. Migration is impossible.

1 Like

any luck on this fix or workarounds other libraries like the ai sdk are using your toolkit under the hood so the error is propagating, its imperative that you fix it

1 Like

This issue was reported back when 1.5 was current. If Google is not willing to fix it, please provide a workaround. I have combination working on openAi, would like to support Gemini, but this is critical. Please advice.

BTW, if you just change the model to `gemini-3-pro-preview`, it works!
The same request (with tools + structured output), it still fails for all 2.5 models.

Yeah it works but, i wrote a complex whatsapp bot sales agent prompt with 6-7 functions/tools to choose from. The model is getting confused when paired with output type json. Calling tools calls randomly when there is no need. Sometimes it calls multiple tools at once.
Reverting to output format text so the bot remains stable.
Also noticed another thing, it is talking long time in sending the response when output type is json.

Can someone look into these issues

1 Like