adk_tool/builtin/
google_search.rs

1use adk_core::{Result, Tool, ToolContext};
2use async_trait::async_trait;
3use serde_json::Value;
4use std::sync::Arc;
5
6/// GoogleSearch is a built-in tool that is automatically invoked by Gemini
7/// models to retrieve search results from Google Search.
8/// The tool operates internally within the model and does not require or
9/// perform local code execution.
10#[derive(Default)]
11pub struct GoogleSearchTool;
12
13impl GoogleSearchTool {
14    pub fn new() -> Self {
15        Self
16    }
17}
18
19#[async_trait]
20impl Tool for GoogleSearchTool {
21    fn name(&self) -> &str {
22        "google_search"
23    }
24
25    fn description(&self) -> &str {
26        "Performs a Google search to retrieve information from the web."
27    }
28
29    async fn execute(&self, _ctx: Arc<dyn ToolContext>, _args: Value) -> Result<Value> {
30        // Google Search is handled internally by Gemini models
31        // This should not be called directly
32        Err(adk_core::AdkError::Tool("GoogleSearch is handled internally by Gemini".to_string()))
33    }
34}