Attribute Macro tool

Source
#[tool]
Expand description

Creates a Tool from an async function.

§Example

#[tool(description = "Searches code", param(name = "code_query", description = "The code query"))]
pub async fn search_code(context: &dyn AgentContext, code_query: &str) -> Result<ToolOutput,
ToolError> {
   Ok("hello".into())
}

// The tool can then be used with agents:
Agent::builder().tools([search_code()])

// Or

Agent::builder().tools([SearchCode::default()])