adk-go icon indicating copy to clipboard operation
adk-go copied to clipboard

feat: Add missing built-in gemini tools

Open kaugesaar opened this issue 1 week ago • 1 comments

Overview

This PR adds support for Gemini's built-in grounding tools to bring adk-go to feature parity with adk-python. These tools enable URL content retrieval, Google Maps grounding, enterprise web search, and Vertex AI Search integration.

Changes

New Built-in Tools

Added 4 new built-in Gemini tools in tool/geminitool/:

  1. GoogleMaps (google_maps.go)

    • Grounds query results with Google Maps for location-based information
    • Zero configuration required
  2. EnterpriseWebSearch (enterprise_web_search.go)

    • Web search with enterprise compliance and security features
    • Zero configuration required
  3. URLContext (url_context.go)

    • Retrieves and analyzes content from URLs to inform model responses
    • Zero configuration required
  4. VertexAiSearch (vertex_ai_search.go)

    • Custom Vertex AI Search integration with configurable data stores or search engines
    • Supports configuration via struct literals
    • Runtime validation in ProcessRequest() method

Example Usage:

// Simple tools (no configuration)
agent.Tools = []tool.Tool{
    geminitool.URLContext{},
    geminitool.GoogleMaps{},
    geminitool.EnterpriseWebSearch{},
}

// Configured tool
agent.Tools = []tool.Tool{
    &geminitool.VertexAiSearch{
        DataStoreID: "projects/my-project/locations/us/collections/default/dataStores/my-store",
        Filter:      "status:active",
        MaxResults:  genai.Ptr(int32(10)),
    },
}

Testing Plan

Unit Tests

cd tool/geminitool
go test -v

Result:

=== RUN   TestSimpleTools_ProcessRequest
=== RUN   TestSimpleTools_ProcessRequest/GoogleMaps
=== RUN   TestSimpleTools_ProcessRequest/EnterpriseWebSearch
=== RUN   TestSimpleTools_ProcessRequest/URLContext
--- PASS: TestSimpleTools_ProcessRequest (0.00s)
=== RUN   TestVertexAiSearch_ProcessRequest
=== RUN   TestVertexAiSearch_ProcessRequest/add_to_empty_request_with_DataStoreID
=== RUN   TestVertexAiSearch_ProcessRequest/add_to_empty_request_with_SearchEngineID
=== RUN   TestVertexAiSearch_ProcessRequest/error_when_both_DataStoreID_and_SearchEngineID_are_specified
=== RUN   TestVertexAiSearch_ProcessRequest/error_when_neither_DataStoreID_nor_SearchEngineID_are_specified
--- PASS: TestVertexAiSearch_ProcessRequest (0.00s)
PASS
ok      google.golang.org/adk/tool/geminitool   0.004s

E2E Test

cd examples/tools/geminitools
export GOOGLE_API_KEY=your-api-key
go run main.go console

Test Prompt:

> What does https://golang.org/doc/ say about getting started?

Expected Behavior: The agent retrieves content from the URL and provides a comprehensive summary of Go's getting started documentation.

Alignment with adk-python

This implementation aligns with adk-python's built-in tools:

  • UrlContextToolURLContext
  • GoogleMapsGroundingToolGoogleMaps
  • EnterpriseWebSearchToolEnterpriseWebSearch
  • VertexAiSearchToolVertexAiSearch

Files Changed

  • tool/geminitool/google_search.go (fixed lint warning)
  • tool/geminitool/google_maps.go (new)
  • tool/geminitool/enterprise_web_search.go (new)
  • tool/geminitool/url_context.go (new)
  • tool/geminitool/vertex_ai_search.go (new)
  • tool/geminitool/tool_test.go (expanded)
  • examples/tools/geminitools/main.go (new)

kaugesaar avatar Nov 23 '25 09:11 kaugesaar

Summary of Changes

Hello @kaugesaar, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands the adk-go library by integrating Gemini's native grounding tools. These additions empower the model with advanced capabilities such as retrieving content from URLs, leveraging Google Maps for location-based information, performing enterprise-compliant web searches, and integrating with Vertex AI Search. The changes aim to provide a richer, more context-aware experience for users by allowing the model to interact with external data sources seamlessly and internally, without requiring local code execution for these specific tools.

Highlights

  • New Gemini Built-in Tools: Introduced four new built-in Gemini tools: GoogleMaps, EnterpriseWebSearch, URLContext, and VertexAiSearch, to enhance grounding capabilities.
  • Feature Parity with adk-python: This update brings adk-go to feature parity with adk-python regarding Gemini's built-in grounding tools.
  • Configurable Vertex AI Search: The VertexAiSearch tool supports configuration via struct literals, allowing specification of DataStoreID or SearchEngineID, filters, and max results, with runtime validation.
  • Comprehensive Testing: New unit tests have been added for all new tools, and an end-to-end example demonstrates their usage.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

gemini-code-assist[bot] avatar Nov 23 '25 09:11 gemini-code-assist[bot]