Rust
Get AI tool by ID
fetch_tool
pub async fn fetch_tool(tool_id: &str) -> Result<AiTool>
Result<AiTool>
use wacht::api::tools::*; let tool = fetch_tool("52057194421551105").await?; println!("Tool: {} ({})", tool.name, tool.id); println!("Description: {}", tool.description); println!("Type: {}", tool.tool_type); println!("Active: {}", tool.is_active);
match fetch_tool("52057194421551105").await { Ok(tool) => { println!("Found tool: {}", tool.name); println!("Type: {}", tool.tool_type); if let Some(config) = &tool.config { println!("Configuration:"); if let Some(url) = &config.url { println!(" URL: {}", url); } if let Some(method) = &config.method { println!(" Method: {}", method); } } } Err(Error::Api { status, message, .. }) => { match status.as_u16() { 404 => println!("Tool not found"), 403 => println!("Access denied: {}", message), _ => println!("API error {}: {}", status, message), } } Err(e) => println!("Request failed: {}", e), }