Skip to content

feat(js/plugins/google-genai)!: built-in tools only via config.tools - #7377

Merged
ifielker merged 2 commits into
v2from
if-V2Todos
Dec 3, 2026
Merged

ifielker merged 2 commits into
v2from
if-V2Todos

Conversation

@ifielker

@ifielker ifielker commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

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 doing
it:

  • googleAI Deep Research took built-in tools as separate config options
    (googleSearch, urlContext, codeExecution, fileSearch,
    mcpServers), while vertexAI Deep Research, Antigravity and Gemini models
    take them in config.tools. A config.tools given to googleAI Deep
    Research wasn't converted, and replaced the request's function tools.
  • Built-in tools from config.tools had every key converted to snake_case,
    including nested ones. That changed values with keys chosen by the user:
    an MCP server's header names (Authorization was sent as
    _authorization) and a passed-through function tool's parameters
    schema (property names converted, required not). This affected Gemini
    models 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:

    // before
    config: {
      googleSearch: true,
      fileSearch: { fileSearchStoreNames: [store] },
      mcpServers: [{ name, url, headers, allowedTools }],
    }
    // after
    config: {
      tools: [
        { googleSearch: {} },
        { fileSearch: { fileSearchStoreNames: [store] } },
        { mcpServer: { name, url, headers, allowedTools } }, // one per server
      ],
    }

    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.tools have only their own keys converted
    to snake_case
    (new toSnakeCaseKeys). Values, including nested
    objects, 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.

  • retrieval is converted at every level, because its nested configs
    (ragStoreConfig, vertexAiSearchConfig, ...) are API objects too, and
    the server accepts only snake_case names inside them (camelCase gets
    400 "Unknown parameter"). The exception is customConfig of Exa and
    Parallel search: it holds the search provider's own parameters, which
    are sent as given.

Breaking changes

  • googleAI Deep Research config: googleSearch, urlContext,
    codeExecution, fileSearch and mcpServers removed. Use
    config.tools as shown above.

Testing

  • Unit tests:
    • googleAI Deep Research: config.tools converted and sent before the
      function tools; every built-in tool shape (Google Search, URL context,
      code execution, file search, MCP with allowedTools and a mode).
    • toInteractionConfigTool: MCP header names unchanged; a passed-through
      tool's parameters schema unchanged; snake_case input unchanged;
      nested retrieval configs (RAG Engine fields) converted to snake_case;
      Exa / Parallel customConfig keys unchanged.
    • toSnakeCaseKeys.
  • Live, basic-gemini testapp (Gemini API):
    • Deep Research with URL context and code execution in config.tools:
      the request carried both tools and the research completed.
    • Deep Research with Google Search, URL context, code execution and an
      MCP server with headers and allowedTools, all in config.tools:
      sent with the header names unchanged and allowed_tools in
      snake_case; the server accepted it.
    • Gemini with Google Search in config.tools plus a function tool: the
      model searched, then called the function.
  • Live, basic-gemini testapp (Gemini Enterprise Agent Platform, Gemini
    3.8 Flash):
    • A retrieval tool with a RAG Engine config written in camelCase was
      sent 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'".
    • Exa search with a customConfig: its keys were sent unchanged and the
      server passed them on to Exa (which rejected the check's placeholder
      API key).
  • Build, unit tests and the testapp type check pass.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@pavelgj pavelgj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with comments

.optional(),
codeExecution: z
.union([z.boolean(), z.looseObject({})])
tools: z

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Base automatically changed from if-V2fixCasts to v2 December 2, 2026 20:50
@ifielker
ifielker merged commit df3f971 into v2 Dec 3, 2026
15 checks passed
@ifielker
ifielker deleted the if-V2Todos branch December 3, 2026 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants