Expand description
Procedural macros for gemini-adk-rs.
This crate provides the tool attribute macro, which turns a plain
async fn into a registrable Gemini tool — eliminating the
TypedTool::new::<Args> + separate-args-struct ceremony.
You normally don’t depend on this crate directly. The tool macro is
re-exported from gemini-adk-rs and the gemini-adk-fluent-rs prelude:
ⓘ
use gemini_adk_fluent_rs::prelude::*; // brings `tool` into scope
use serde_json::{json, Value};
/// Get the current weather for a city.
#[tool("Get the current weather for a city")]
async fn get_weather(city: String, units: Option<String>) -> Result<Value, ToolError> {
Ok(json!({ "city": city, "units": units.unwrap_or("metric".into()) }))
}
// `get_weather()` returns a value implementing `ToolFunction`.
let mut d = ToolDispatcher::new();
d.register_function(std::sync::Arc::new(get_weather()));Attribute Macros§
- tool
- Turn an
async fninto a registrable Gemini tool.