Tool: Get weather for a location
| 54 | |
| 55 | // Tool: Get weather for a location |
| 56 | ai::JsonValue get_weather(const ai::JsonValue& args, |
| 57 | const ai::ToolExecutionContext& context) { |
| 58 | std::string location = args["location"].get<std::string>(); |
| 59 | |
| 60 | std::cout << "🌤️ Getting weather for: " << location << std::endl; |
| 61 | |
| 62 | // Simulate weather API call |
| 63 | std::srand(std::time(nullptr) + location.length()); // Add some variety |
| 64 | int temperature = 50 + (std::rand() % 50); |
| 65 | |
| 66 | std::vector<std::string> conditions = {"Sunny", "Cloudy", "Rainy", |
| 67 | "Partly cloudy"}; |
| 68 | std::string condition = conditions[std::rand() % conditions.size()]; |
| 69 | |
| 70 | return ai::JsonValue{{"location", location}, |
| 71 | {"temperature", temperature}, |
| 72 | {"condition", condition}, |
| 73 | {"unit", "Fahrenheit"}}; |
| 74 | } |
| 75 | |
| 76 | // Tool: Send email notification |
| 77 | ai::JsonValue send_email(const ai::JsonValue& args, |
nothing calls this directly
no outgoing calls
no test coverage detected