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 {
16 Self
17 }
18}
19
20#[async_trait]
21impl Tool for GoogleSearchTool {
22 fn name(&self) -> &str {
23 "google_search"
24 }
25
26 fn description(&self) -> &str {
27 "Performs a Google search to retrieve information from the web."
28 }
29
30 fn is_builtin(&self) -> bool {
31 true
32 }
33
34 fn declaration(&self) -> Value {
35 json!({
36 "name": self.name(),
37 "description": self.description(),
38 "x-adk-gemini-tool": {
39 "google_search": {}
40 }
41 })
42 }
43
44 async fn execute(&self, _ctx: Arc<dyn ToolContext>, _args: Value) -> Result<Value> {
45 Err(adk_core::AdkError::tool("GoogleSearch is handled internally by Gemini"))
48 }
49}