The Google grounding, that should be "addable" easily, but the model as I understand it is somewhat flexible on when it uses it, and this element should be part of the prompt (up to here I am talking from experience).
Now, the below is not tested, and is ChatGPT's opinion but within a framework setup to assist with creating AI backed Call Flow scripts:
You can enable Google Search grounding in every Gemini API call, but enabling it does not force Gemini to search. Google explicitly says the model still decides whether to use it.
Google documentation
For a generateContent REST request, add:
"tools": [
{ "google_search": {} }
]
That makes search available. An instruction such as “Always search Google before answering” encourages its use but isn’t a hard guarantee. The function-calling ANY setting is documented for forcing function calls; it should not be treated as a guaranteed switch for built-in Google Search grounding.
Grounding documentation,
function-calling documentation
To enforce this in your application, enable search, explicitly request it, then check the returned groundingMetadata—including webSearchQueries, groundingChunks, and groundingSupports. Reject or retry responses that lack the grounding evidence you require. This guarantees your application only accepts grounded responses, though a retry may still fail to produce one.
Response metadata