@Dev Structured outputs with tools is only available since gemini 3 series according to Google’s documentation: https://ai.google.dev/gemini-api/docs/structured-output?example=recipe#structured_outputs_with_tools
So any model from 2.5 series won’t work.
However, you tried it with gemini 3.0 flash, but what happened is:
response_format=… in LangChain is not a cross-provider contract. It works for OpenAI because OpenAI supports response_format natively. Gemini’s native mechanism is response_mime_type=“application/json” + response_json_schema=… (JSON Schema / Pydantic).
For Gemini, “tools + native structured output” is still constrained by the provider. Google’s docs i provided above only explicitly advertise combining structured outputs with built-in tools (Google Search, URL context, code execution, file search) as a Gemini 3 preview feature, and do not show custom function tools + JSON schema together in one call.
So my recommendation would be keep a two-node StateGraph:
- Tool node: model bound only with your tools (planning + tool calling).
- Formatting node: a separate model call that formats the final answer into your Pydantic schema (Gemini JSON schema mode if you want strictness).
This is actually a very common production pattern when providers can’t reliably do tool calling AND hard JSON-schema constrained final output in one request.