adk_tool/builtin/
google_search.rs1use adk_core::{Result, Tool, ToolContext};
2use async_trait::async_trait;
3use serde_json::{Value, json};
4use std::sync::Arc;
5
6#[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 fn is_builtin(&self) -> bool {
30 true
31 }
32
33 fn declaration(&self) -> Value {
34 json!({
35 "name": self.name(),
36 "description": self.description(),
37 "x-adk-gemini-tool": {
38 "google_search": {}
39 }
40 })
41 }
42
43 async fn execute(&self, _ctx: Arc<dyn ToolContext>, _args: Value) -> Result<Value> {
44 Err(adk_core::AdkError::tool("GoogleSearch is handled internally by Gemini"))
47 }
48}