Feat: add bypassMultiToolsLimit and model constructor options to GoogleSearchTool - #714
Open
AmaadMartin wants to merge 2 commits into
Open
Feat: add bypassMultiToolsLimit and model constructor options to GoogleSearchTool#714AmaadMartin wants to merge 2 commits into
AmaadMartin wants to merge 2 commits into
Conversation
added 2 commits
August 6, 2026 03:58
Give GoogleSearchTool an optional options-object constructor so callers can skip the Gemini 1.x multi-tool guard and pin the tool to a specific model. Both fields are read in processLlmRequest. Zero-argument construction and the GOOGLE_SEARCH singleton are unchanged.
Append eight cases for the bypass flag, the model override and the defaults. The makeRequest tools parameter is widened to Tool[] so the new multi-tool cases type-check; no existing test is modified.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
N/A
Problem:
adk-python'sGoogleSearchTool.__init__acceptsbypass_multi_tools_limitandmodel.adk-jsexposes neither, so a user cannot attach Google Search alongside other tools on a Gemini 1.x model, and cannot pin the tool to a model other than the one on the request.Solution:
GoogleSearchToolnow takes an optionalGoogleSearchToolParamsobject.bypassMultiToolsLimitgates the Gemini 1.x multi-tool throw, andmodeloverwritesllmRequest.modelas the first statement ofprocessLlmRequest, before the early-return guard, so an override works on a request that carries no model.new GoogleSearchTool()and theGOOGLE_SEARCHsingleton are unchanged, and no existing test was modified.Parity note:
modelmatchesadk-pythonexactly.bypassMultiToolsLimitfollows theadk-jsVertexAiSearchToolmeaning (skip the Gemini 1.x multi-tool guard), not theadk-pythonmeaning (opt in to agent-tool wrapping inLlmAgent), becauseadk-jshas no such wrapping path. Reference:src/google/adk/tools/google_search_tool.pyandtests/unittests/tools/test_google_search_tool.pyingoogle/adk-python.Collision check: I listed the open pull requests on this fork before starting. #614 edits the same method for
ADK_DISABLE_GEMINI_MODEL_ID_CHECK, and #638 and #332 touch neighbouring lines. None of them adds a constructor option, so this branches frommain. The new tests sit at the end of theprocessLlmRequestdescribe block to keep the overlap with #614 to one insertion point.Testing Plan
Please describe the tests that you ran to verify your changes. This is required for all PRs that are not small documentation or typo fixes.
Unit Tests:
[x] I have added or updated unit tests for my change.
[x] All unit tests pass locally.
npx vitest run --project unit:core core/test/tools/google_search_tool_test.ts— 15 passed.npx vitest run --project unit:core core/test/tools/vertex_ai_search_tool_test.ts— 10 passed (the sibling tool that shares the flag name is untouched).Coverage of
core/src/tools/google_search_tool.ts: 100% branch, 95.65% line. The two uncovered lines are the pre-existingrunAsync()body, which this change does not touch. Every new line and branch is covered.Mutation testing. I ran each mutation, confirmed the failure, then reverted:
&& !this.bypassMultiToolsLimit— "skips the Gemini 1.x multi-tool check when bypassMultiToolsLimit is true" fails withGoogle search tool can not be used with other tools in Gemini 1.x.if (this.model !== undefined)block — 3 tests fail: "applies a Gemini 1.x model override to a Gemini 2+ request", "applies a Gemini 2+ model override to a Gemini 1.x request", "applies the model override when the request carries no model".if (!llmRequest.model) return;guard — "applies the model override when the request carries no model" fails withexpected [] to deeply equal [ { googleSearch: {} } ]. This is the ordering the other two mutations do not catch.Manual End-to-End (E2E) Tests:
Please provide instructions on how to manually test your changes, including any necessary setup or configuration.
npm run ts:checkreports 279 errors, all pre-existing and unrelated. The same command onmainreports 280. This branch removes one of them: widening themakeRequesttoolsparameter toTool[]fixes thenever[]inference that already broke the line-46 test.Checklist
[x] I have read the CONTRIBUTING.md document.
[x] I have performed a self-review of my own code.
[x] I have commented my code, particularly in hard-to-understand areas.
[x] I have added tests that prove my fix is effective or that my feature works.
[x] New and existing unit tests pass locally with my changes.