Gemini Function Calling: Verify Actions, Not Just Requests
When AI says, “Checking your order status,” should we assume the system has checked? That depends on whether a program actually receives the request, calls the API, and returns the result.

Check the destination system before confirming a function call succeeded
The documentation on Gemini Function Calling explains that a model can select a function and prepare arguments, while the developer-controlled system executes database access, API calls, and changes. A function name in a response does not establish that an action occurred.
Suppose a user asks, “Where is order A-104?” The model might propose this function call.
get_order_status({"order_id":"A-104"})
The server then checks the user’s permissions and the order ID format. It calls the service and returns the result, “In transit,” for the model to put into words.
SDK behavior varies: An SDK or framework may take on the task of automatically looping function calls, for example: Automatic function calling in the Python SDK for GenerateContent as Google documents. The absence of visible looping code does not prove that no function ran. Developers must still enforce permissions and validation inside invoked functions. This article concerns application functions, not every provider-executed tool.
What to check from the proposed function call to the system response
- Declare the tools: The system names the functions, their meanings, and the types of parameters the model is allowed to see.
- The model proposes a call: Responses may include function names and arguments that the model expects to match the task.
- Validate and execute in the app: The program checks permissions, scope, inputs, and potential harm before contacting the API
- Return results and answer the user: Return only necessary API data to the conversation, clearly separating success, failure, and uncertain status
Do not substitute model text for actual system status, especially for payments, email delivery, data deletion, or permission changes. These tasks should include user confirmation and auditable execution records.
These are conceptual steps, not ready-to-use API payloads. Responses may propose multiple or sequential function calls. Validate each request, do not assume one tool per response, and do not replace business authorization with function schemas.
Report failed or uncertain actions without inventing success
| 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 |
For requests that change data, design safe repeat calls, for example with unique request IDs and database result checks before resubmitting, to reduce duplicate transactions caused by retries
Example of timeout management: Suppose a user requests cancellation of order A-104 and the API times out. The order may be “canceled, but the response was lost” or “not yet canceled.” KrobClick's proposed design is to store a request ID and check the destination's status before retrying. If it cannot be verified, report “not yet confirmed” instead of claiming success or immediately submitting again.
Check response formats and function-result pairing
Google documentation says some API formats require call IDs, function names, and result counts to match the model's requests. Assuming a single function or reading only the last message part may miss other calls. See Function Response pairing instructions. Behavior and SDK may vary by version and API used.
This explanation is based on documentation, not KrobClick API tests. Use a test account, hypothetical data, and limited permissions before connecting a live system.
Separate Identification from Permission to make transactions: Being able to log in does not automatically authorize a user to read others' orders, and a model-supplied customer ID is not proof of permission. Treat API responses and external documents as data, not new instructions expanding tool scope.
If you are unsure how well model output follows a structure, read Examining the syntax, schema, and meaning of JSON as supporting information. Service keys should be stored according to Keep API keys outside the browser
Before launch, verify permissions and destination records
- 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?
Tool calls need permission checks, parameter validation, and evidence from the destination system. These let the application tell users which actions succeeded, failed, or remain unverified.
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.