How to register GetWeatherToolcsharp
registry.Register(new AgentTool( Name, "Returns example weather for a city (demo addon; not a live forecast API).", Invoke, ParametersSchema));
Returns example weather for a city (demo addon; not a live forecast API).
Included in Version 6
registry.Register(new AgentTool( Name, "Returns example weather for a city (demo addon; not a live forecast API).", Invoke, ParametersSchema));
private static string Invoke(string argumentsJson) { string city = ParseCity(argumentsJson); if (string.IsNullOrWhiteSpace(city)) { return "Error: Provide a city name (JSON property \"city\")."; } int seed = city.GetHashCode(StringComparison.OrdinalIgnoreCase); string[] conditions = ["Sunny", "Partly cloudy", "Light rain", "Clear", "Overcast"]; string condition = conditions[Math.Abs(seed) % conditions.Length]; int tempC = 10 + (Math.Abs(seed) % 20); return $"Example weather for {city}: {condition}, about {tempC}°C (demo data from Agent-Addons)."; }