Skip to content

[ENHANCEMENT] Support Gemini 3 Built-in and Custom Tool Combinations (Tool Context Circulation) #11966

@KuroZantetsuken

Description

@KuroZantetsuken

Problem (one or two sentences)

Users using Gemini 3 models in Roo Code cannot combine Gemini's powerful server-side built-in tools (like Google Search, URL Context, and Code Execution) with Roo Code's client-side custom tools (like reading/writing local files or terminal commands) in a single generation.

Context (who is affected and when)

This affects users who configure Roo Code to use Gemini 3 models. It happens when attempting complex, agentic workflows that require both real-time external data grounding (e.g., searching the web for the latest API docs) and local codebase operations (e.g., implementing that API in the project).

Desired behavior (conceptual, not technical)

Roo Code should enable "tool context circulation" when using Gemini 3 models. This means allowing the Gemini model to perform built-in server-side actions (like running a Google Search) and then seamlessly passing that context into Roo Code's local custom tools so the model can complete the user's task in one continuous workflow.

Constraints / preferences (optional)

  • This must only be enabled for Gemini 3 models, as it is a preview feature specific to that generation.
  • Must correctly preserve and return the API's required hidden context data (thought_signatures, id, tool_type) in the chat history to prevent the model from erroring out.
  • Keep token limits in mind, as intermediate tool context will count towards the prompt token count (excluding Google Search queries).

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear context and impact

Roo Code Task Links (optional)

No response

Acceptance criteria (optional)

Given a user has configured Roo Code to use a Gemini 3 model
When the user asks a prompt requiring both a built-in Gemini tool (e.g., web search) and a Roo Code custom tool (e.g., editing a file)
Then Roo Code sets include_server_side_tool_invocations to true in the API configuration
And the extension successfully circulates the toolCall and toolResponse parts alongside Roo Code's functionCall and functionResponse parts
And all parts containing thoughtSignature, id, and toolType are accurately preserved and passed back to the model in subsequent conversational turns
But this change should not break or interfere with the tool-calling logic of other providers (like OpenAI, Claude, or older Gemini models).

Proposed approach (optional)

  1. Update the Gemini API provider configuration in Roo Code to include toolConfig: { includeServerSideToolInvocations: true } when a Gemini 3 model is selected.
  2. Update the Gemini message builder/history mapper in Roo Code to capture toolCall, toolResponse, executableCode, and codeExecutionResult parts.
  3. Ensure that when Roo Code constructs the message history for subsequent turns, it passes back the exact thoughtSignature and id fields embedded in the API's previous responses, which are critical for the Gemini 3 context circulation to function.

Trade-offs / risks (optional)

  • Token Consumption: Adding toolCall and toolResponse history to the prompt increases prompt_token_count on subsequent turns, potentially driving up costs or hitting context limits faster.
  • Provider Complexity: Roo Code's message history parsing will need specialized handling just for Gemini 3's unique thoughtSignature and combined tool architecture, adding slight complexity to the tool-calling abstraction layer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions