Crate gemini_adk_macros_rs

Crate gemini_adk_macros_rs 

Source
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 fn into a registrable Gemini tool.

Derive Macros§

Extract
Derive an Extract record builder from a struct’s fields.
Frame
Derive a Frame impl from a struct’s #[slot(..)] fields.