adk_tool/builtin/
url_context.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 UrlContextTool;
12
13impl UrlContextTool {
14 pub fn new() -> Self {
16 Self
17 }
18}
19
20#[async_trait]
21impl Tool for UrlContextTool {
22 fn name(&self) -> &str {
23 "url_context"
24 }
25
26 fn description(&self) -> &str {
27 "Fetches and analyzes content from URLs to provide context."
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 "url_context": {}
40 }
41 })
42 }
43
44 async fn execute(&self, _ctx: Arc<dyn ToolContext>, _args: Value) -> Result<Value> {
45 Err(adk_core::AdkError::tool("UrlContext is handled internally by Gemini"))
46 }
47}