Gemini Function Calling: Verify Actions, Not Just Requests
A user asks about order A-104 and Gemini says it is checking. That can look like progress on screen, but the app still has work to do before the order status is known.

A function-call request is not an order status
In this hypothetical example, a user asks, “Where is order A-104?” Gemini might choose a function name and arguments as described in Google's function-calling documentation as follows:
get_order_status({"order_id":"A-104"})
This text does not show that a database was queried or that a “shipping” status came back. The app must check the format of A-104 and the user's permissions, call the order service, and pass the actual status to the model. Without a result from that service, the status remains unconfirmed.
There is an exception concerning who performs the call: The GenerateContent Python SDK can loop through automatic function calls. A code example without a visible loop may still execute a function. Functions exposed to the SDK still need their own input and authorization checks. This article concerns application functions, not every provider-run tool.
Trace the request through four points
- The app declares the function name, purpose and allowed argument types to the model.
- The model proposes a function and arguments it considers relevant to the question.
- The app checks the input, scope, permissions and consequences before calling an API.
- The app returns only the necessary API result, distinguishing success, failure and uncertainty.
This is a conceptual sequence, not a ready-to-use API payload. A response may contain several function calls or a sequence of them. Check each request. Payments, email, deletion and permission changes should require user confirmation and an auditable record. A schema does not prove that the account owner authorized an action.
When an API goes quiet, do not guess that an action succeeded
| Scenario | Information that the system should return | appropriate answer |
|---|---|---|
| Code not found | not_found | This item was not found. Please check the code. |
| Timed out | timeout | Still can't confirm status. It shouldn't be said that it was successful. |
| Not authorized | forbidden | Cannot access this data with current permissions |
| Success | Status from the live system | Status report with reference time |
The table separates the status the app gives the model from what it should tell the user. For a write operation, plan for retries: use a unique request ID and inspect the database result before retrying to reduce duplicate actions.
Suppose a user asks to cancel A-104 and the API times out. The cancellation might have succeeded with a lost response, or it might never have happened. KrobClick's suggested design is to keep the request ID, check the downstream status before retrying, and say “not yet confirmed” if the result is still unknown. Do not blindly repeat the request.
Response matching and authorization are separate checks
Google's function-response guidance says some API formats require matching call IDs, function names and the number of responses to the model's requests. Do not read only the last part and assume there was a single call. Check requirements for your model ID and SDK. This is based on documentation, not a KrobClick API test; use a test account, hypothetical data and restricted permissions before connecting production.
Signing in establishes identity, not permission to read someone else's order. A customer ID supplied by the model is not proof of authorization. Treat text from APIs and external documents as data, not instructions to expand tool permissions. For result structure, see JSON syntax, schema and meaning; for service credentials, see keeping an API key out of the browser
Which cases should you test before connecting a real system?
- What data does each function allow to read or modify?
- Have the model's proposed parameters been checked for type, scope, and user rights?
- Does the system report errors without allowing AI to invent status?
- Do important changes require confirmation, and are destination-system results recorded?
- Can the system pause and check status before retrying after a network failure or duplicate request?
Test success alongside insufficient permissions, unknown IDs, timeouts and repeated requests. Compare displayed messages with downstream records before telling users what actually happened.
Sources
- Google AI for Developers: Function calling with the Gemini API
- Google AI for Developers: Function response matching and model guidance
- Google: GenerateContent Python SDK automatic function calling
- Google: How function calling works
Google documentation reviewed October 16, 2026, Thailand time. Order IDs and statuses are hypothetical; no actual API test was performed.