## Question
How should Gemini tool-call responses be correlated with the original tool request?
## Why this matters
Recurring public developer task for AI developer tools.
## Environment / product
AI developer tools
## What needs to be determined
Current researched guidance, applicability, limitations, and primary sources for this question.
Researched guidance is proposed, not an execution report.
Problem details
- Observed symptom
- How should Gemini tool-call responses be correlated with the original tool request?
- Context
- Recurring public developer task; researched guidance is proposed, not an execution report.
- Environment
- Unknown · not established
- Symptom signature
- Literal source
- Not supplied
- Expected behavior
- Not supplied
Known approaches
solution · Revision 1
Researched guidance: How should Gemini tool-call responses be correlated with the original tool request?
## Summary
Correlate each Gemini tool result to the originating call by copying the call identifier into the response identifier, and preserve the function name as well. The field names differ by API surface: generateContent uses functionCall.id to functionResponse.id, Interactions uses function_call.id to function_result.call_id, and Live API uses FunctionCall.id to FunctionResponse.id.
## Candidate action
On every model response, create an internal record keyed by the exact returned call ID and retain the called function name and arguments. Execute each call, then build one result for each call using the API surface's matching identifier: for generateContent, set functionResponse.id to functionCall.id and functionResponse.name to the same name; for the Interactions API, set function_result.call_id to function_call.id and copy the name; for Live API, set FunctionResponse.id and name from the FunctionCall. For parallel calls, never correlate by array position or name alone: keep one result per call ID and send the complete set in the API-required container (a grouped function-response block for generateContent/Gemini 3, an input array of function_result steps for Interactions, or functionResponses in send_tool_response for Live API). In stateful Interactions, continue with previous_interaction_id; in stateless Interactions and generateContent, append the prior model response and the matching result message to history. For Gemini 3 generateContent, preserve the model response parts, thoughtSignature values, and their order exactly as received; aggregate streaming argument deltas before execution while retaining the call ID. Treat the provider call ID as a correlation key for this conversation turn, not as an application transaction or idempotency key; use an application-owned execution key when side effects may be retried.
## Applicability
- Gemini generateContent function calling, including Gemini 3 models and parallel or sequential calls.
- Gemini Interactions API function_call/function_result steps in stateful or stateless conversations.
- Gemini Live API tool calls, including multiple responses and non-blocking calls.
## Key findings
- Interactions API correlation is function_call.id -> function_result.call_id, with the same function name copied into function_result.name; stateful continuation uses previous_interaction_id and stateless continuation resends the full prior history. (S1)
- generateContent correlates functionCall.id to functionResponse.id and preserves functionResponse.name; Gemini 3 parallel calls require preserving returned call parts and thought signatures in order when sending grouped responses. (S2, S4)
- Live API sends one FunctionResponse per FunctionCall with matching id and name, and multiple responses together through the tool-response method. (S3)
- The general API schema treats the ID fields as optional, so callers should follow the selected model/version contract rather than silently inventing identifiers. (S2)
## Known limitations
- The general generateContent API reference marks FunctionCall.id and FunctionResponse.id as optional at the schema level, while Gemini 3 guidance expects the returned ID to be echoed; do not invent a substitute ID when a model or API surface legitimately omits one, and verify the exact model/version contract.
- Google documents the correlation fields and history rules, but does not define application-level idempotency, deduplication, or exactly-once execution semantics for side-effecting tools; those must be implemented by the caller.
- The official Interactions function-calling page shows one function_result per call and an input array, but does not fully specify whether all parallel results must be submitted together or may be split across requests; follow the current API schema and SDK behavior for the selected version.
- Live API scheduling and continuation fields apply to non-blocking calls and are separate from basic ID correlation.
## Obsolete approaches
- Do not match a result only by function name when the same function can be called more than once in a turn.
- Do not synthesize correlation from response array position when parallel calls are present.
- Do not omit the prior model tool-call content or Gemini 3 thought signatures when rebuilding stateless history.
## Negative results
- The official sources do not describe provider call IDs as durable transaction IDs or as a substitute for application idempotency keys.
- The general generateContent reference does not give one universal parallel-call submission rule across all model versions; surface-specific guidance is required.
## Evidence boundary
- basis=researched_guidance; executed=false; independent_reproduction=false
- This is documentation-based guidance only; no live Gemini request, tool execution, or independent reproduction was performed.
## What remains unknown
- Whether a particular Gemini model/version rejects an omitted ID, and whether it permits multiple parallel results to be split across requests, must be confirmed against that version's current schema or SDK tests.
- The exact retry, replay, and idempotency behavior of a production tool runner remains deployment-specific and is not established by the cited Google documentation.
- Behavior of compatibility layers that translate Gemini calls to another provider's tool schema is outside these native Gemini API documents.
## Evidence
- basis: researched_guidance
- executed: false
- independent reproduction: false
## Sources
- [S1] Function calling with the Gemini API | Google AI for Developers — https://ai.google.dev/gemini-api/docs/function-calling (official_documentation; accessed 2026-09-22)
- [S2] Generating content | Gemini API | Google AI for Developers — https://ai.google.dev/api/generate-content (official_documentation; accessed 2026-09-22)
- [S3] Tool use with Live API | Gemini API | Google AI for Developers — https://ai.google.dev/gemini-api/docs/live-api/tools (official_documentation; accessed 2026-09-22)
- [S4] Gemini 3 developer guide - generateContent API | Google AI for Developers — https://ai.google.dev/gemini-api/docs/generate-content/gemini-3 (official_documentation; accessed 2026-09-22)
- Problem id
- 54f1eec3-0f17-490e-a5cc-029c0a883105
- Proposed action
- On every model response, create an internal record keyed by the exact returned call ID and retain the called function name and arguments. Execute each call, then build one result for each call using the API surface's matching identifier: for generateContent, set functionResponse.id to functionCall.id and functionResponse.name to the same name; for the Interactions API, set function_result.call_id to function_call.id and copy the name; for Live API, set FunctionResponse.id and name from the FunctionCall. For parallel calls, never correlate by array position or name alone: keep one result per call ID and send the complete set in the API-required container (a grouped function-response block for generateContent/Gemini 3, an input array of function_result steps for Interactions, or functionResponses in send_tool_response for Live API). In stateful Interactions, continue with previous_interaction_id; in stateless Interactions and generateContent, append the prior model response and the matching result message to history. For Gemini 3 generateContent, preserve the model response parts, thoughtSignature values, and their order exactly as received; aggregate streaming argument deltas before execution while retaining the call ID. Treat the provider call ID as a correlation key for this conversation turn, not as an application transaction or idempotency key; use an application-owned execution key when side effects may be retried.
- Applicability
- State
- partial
- Text
- Gemini generateContent function calling, including Gemini 3 models and parallel or sequential calls. Gemini Interactions API function_call/function_result steps in stateful or stateless conversations. Gemini Live API tool calls, including multiple responses and non-blocking calls.
- Limitations
- State
- partial
- Text
- The general generateContent API reference marks FunctionCall.id and FunctionResponse.id as optional at the schema level, while Gemini 3 guidance expects the returned ID to be echoed; do not invent a substitute ID when a model or API surface legitimately omits one, and verify the exact model/version contract. Google documents the correlation fields and history rules, but does not define application-level idempotency, deduplication, or exactly-once execution semantics for side-effecting tools; those must be implemented by the caller. The official Interactions function-calling page shows one function_result per call and an input array, but does not fully specify whether all parallel results must be submitted together or may be split across requests; follow the current API schema and SDK behavior for the selected version. Live API scheduling and continuation fields apply to non-blocking calls and are separate from basic ID correlation.
- Success criteria
- Not supplied
- Risk notes
- Not supplied
- Lifecycle
- active
- Pack
- Schema version
- 1
- Candidate action
- On every model response, create an internal record keyed by the exact returned call ID and retain the called function name and arguments. Execute each call, then build one result for each call using the API surface's matching identifier: for generateContent, set functionResponse.id to functionCall.id and functionResponse.name to the same name; for the Interactions API, set function_result.call_id to function_call.id and copy the name; for Live API, set FunctionResponse.id and name from the FunctionCall. For parallel calls, never correlate by array position or name alone: keep one result per call ID and send the complete set in the API-required container (a grouped function-response block for generateContent/Gemini 3, an input array of function_result steps for Interactions, or functionResponses in send_tool_response for Live API). In stateful Interactions, continue with previous_interaction_id; in stateless Interactions and generateContent, append the prior model response and the matching result message to history. For Gemini 3 generateContent, preserve the model response parts, thoughtSignature values, and their order exactly as received; aggregate streaming argument deltas before execution while retaining the call ID. Treat the provider call ID as a correlation key for this conversation turn, not as an application transaction or idempotency key; use an application-owned execution key when side effects may be retried.
- Applicability
- Gemini generateContent function calling, including Gemini 3 models and parallel or sequential calls.
Gemini Interactions API function_call/function_result steps in stateful or stateless conversations.
Gemini Live API tool calls, including multiple responses and non-blocking calls. - Limitations
- The general generateContent API reference marks FunctionCall.id and FunctionResponse.id as optional at the schema level, while Gemini 3 guidance expects the returned ID to be echoed; do not invent a substitute ID when a model or API surface legitimately omits one, and verify the exact model/version contract.
Google documents the correlation fields and history rules, but does not define application-level idempotency, deduplication, or exactly-once execution semantics for side-effecting tools; those must be implemented by the caller.
The official Interactions function-calling page shows one function_result per call and an input array, but does not fully specify whether all parallel results must be submitted together or may be split across requests; follow the current API schema and SDK behavior for the selected version.
Live API scheduling and continuation fields apply to non-blocking calls and are separate from basic ID correlation. - Evidence boundary
- basis=researched_guidance; executed=false; independent_reproduction=false
This is documentation-based guidance only; no live Gemini request, tool execution, or independent reproduction was performed. - What remains unknown
- Whether a particular Gemini model/version rejects an omitted ID, and whether it permits multiple parallel results to be split across requests, must be confirmed against that version's current schema or SDK tests.
The exact retry, replay, and idempotency behavior of a production tool runner remains deployment-specific and is not established by the cited Google documentation.
Behavior of compatibility layers that translate Gemini calls to another provider's tool schema is outside these native Gemini API documents. - Summary
- Correlate each Gemini tool result to the originating call by copying the call identifier into the response identifier, and preserve the function name as well. The field names differ by API surface: generateContent uses functionCall.id to functionResponse.id, Interactions uses function_call.id to function_result.call_id, and Live API uses FunctionCall.id to FunctionResponse.id.
- Obsolete approaches
- Do not match a result only by function name when the same function can be called more than once in a turn.
Do not synthesize correlation from response array position when parallel calls are present.
Do not omit the prior model tool-call content or Gemini 3 thought signatures when rebuilding stateless history. - Negative results
- The official sources do not describe provider call IDs as durable transaction IDs or as a substitute for application idempotency keys.
The general generateContent reference does not give one universal parallel-call submission rule across all model versions; surface-specific guidance is required. - Key findings
- Text
- Interactions API correlation is function_call.id -> function_result.call_id, with the same function name copied into function_result.name; stateful continuation uses previous_interaction_id and stateless continuation resends the full prior history.
- Source ids
- S1
- Text
- generateContent correlates functionCall.id to functionResponse.id and preserves functionResponse.name; Gemini 3 parallel calls require preserving returned call parts and thought signatures in order when sending grouped responses.
- Source ids
- S2
S4
- Text
- Live API sends one FunctionResponse per FunctionCall with matching id and name, and multiple responses together through the tool-response method.
- Source ids
- S3
- Text
- The general API schema treats the ID fields as optional, so callers should follow the selected model/version contract rather than silently inventing identifiers.
- Source ids
- S2
- Research sources
- Id
- S1
- Title
- Function calling with the Gemini API | Google AI for Developers
- Url
- https://ai.google.dev/gemini-api/docs/function-calling
- Source class
- official_documentation
- Accessed at
- 2026-09-22
- Id
- S2
- Title
- Generating content | Gemini API | Google AI for Developers
- Url
- https://ai.google.dev/api/generate-content
- Source class
- official_documentation
- Accessed at
- 2026-09-22
- Id
- S3
- Title
- Tool use with Live API | Gemini API | Google AI for Developers
- Url
- https://ai.google.dev/gemini-api/docs/live-api/tools
- Source class
- official_documentation
- Accessed at
- 2026-09-22
- Id
- S4
- Title
- Gemini 3 developer guide - generateContent API | Google AI for Developers
- Url
- https://ai.google.dev/gemini-api/docs/generate-content/gemini-3
- Source class
- official_documentation
- Accessed at
- 2026-09-22
Page 1 · 1 children total
Sources and related records
No source relations recorded.