Repository navigation
feat(js/plugins/google-genai)!: built-in tools only via config.tools - #7377
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the tool configuration in the Google GenAI plugin by replacing individual tool fields with a unified tools array schema and introducing a toSnakeCaseKeys utility to convert only top-level keys to snake_case. It also removes the unused contextCache configuration. The review feedback points out an inconsistency in toInteractionConfigTool where some built-in tools support both camelCase and snake_case keys, while others only support camelCase, which could cause errors if users pass them in snake_case.
| .optional(), | ||
| codeExecution: z | ||
| .union([z.boolean(), z.looseObject({})]) | ||
| tools: z |
There was a problem hiding this comment.
The old options had real types (fileSearchStoreNames: string[], the allowedTools mode enum), and Record<string, unknown>[] loses that autocomplete. A typed union of built-in tools shared by Gemini, Antigravity and both Deep Research models would bring it back. Fine as a follow-up issue.
Also worth calling this out in the v2 migration notes and on the docsite Deep Research page.
There was a problem hiding this comment.
I looked into it and I think it might not be worth it. The same config.tools key carries two different wire shapes (generateContent vs Interactions), the passthrough for new tools has to stay, and the backends accept different tools. So a shared type would be a lot of work, partly wrong on one path, and wouldn't catch much beyond the tool name, which the plugin already rejects at runtime with a clear error. The README and the schema description list the shapes. What do you think?
feat(js/plugins/google-genai)!: built-in tools only via config.tools
Why
A
TODO(v2)item in the google-genai plugin, and a bug found while doingit:
(
googleSearch,urlContext,codeExecution,fileSearch,mcpServers), while vertexAI Deep Research, Antigravity and Gemini modelstake them in
config.tools. Aconfig.toolsgiven to googleAI DeepResearch wasn't converted, and replaced the request's function tools.
config.toolshad every key converted to snake_case,including nested ones. That changed values with keys chosen by the user:
an MCP server's header names (
Authorizationwas sent as_authorization) and a passed-through function tool'sparametersschema (property names converted,
requirednot). This affected Geminimodels on both plugins, Antigravity and vertexAI Deep Research.
What changed
googleAI Deep Research takes built-in tools only in
config.tools,the same as vertexAI Deep Research and Antigravity: built-in tools first,
then the request's function tools. The five separate options are
removed:
As before, the agent uses Google Search, URL context and code execution
when no tools are given, and any tool given replaces them.
Built-in tools from
config.toolshave only their own keys convertedto snake_case (new
toSnakeCaseKeys). Values, including nestedobjects, are sent as given. A tool's own keys are API field names, so
input already in snake_case is unchanged, and header names and schemas
keep their keys.
retrievalis converted at every level, because its nested configs(
ragStoreConfig,vertexAiSearchConfig, ...) are API objects too, andthe server accepts only snake_case names inside them (camelCase gets
400 "Unknown parameter"). The exception is
customConfigof Exa andParallel search: it holds the search provider's own parameters, which
are sent as given.
Breaking changes
googleSearch,urlContext,codeExecution,fileSearchandmcpServersremoved. Useconfig.toolsas shown above.Testing
config.toolsconverted and sent before thefunction tools; every built-in tool shape (Google Search, URL context,
code execution, file search, MCP with
allowedToolsand a mode).toInteractionConfigTool: MCP header names unchanged; a passed-throughtool's
parametersschema unchanged; snake_case input unchanged;nested
retrievalconfigs (RAG Engine fields) converted to snake_case;Exa / Parallel
customConfigkeys unchanged.toSnakeCaseKeys.config.tools:the request carried both tools and the research completed.
MCP server with headers and
allowedTools, all inconfig.tools:sent with the header names unchanged and
allowed_toolsinsnake_case; the server accepted it.
config.toolsplus a function tool: themodel searched, then called the function.
3.8 Flash):
retrievaltool with a RAG Engine config written in camelCase wassent in snake_case and passed the server's request validation (the
corpus used for the check doesn't exist, so the request failed later,
at the lookup). The same config with its nested keys in camelCase, as
the earlier one-level conversion sent it, was rejected with 400
"Unknown parameter 'tools[0].rag_store_config.ragResources'".
customConfig: its keys were sent unchanged and theserver passed them on to Exa (which rejected the check's placeholder
API key).