INNER CODE UNIT · Python

getCurrentWeather

existence-master/Sentient · src/server/mcp_hub/accuweather/main.py:36

async def getCurrentWeather(ctx: Context, location: str) -> Dict[str, Any]:
    """
    Fetches the current weather conditions for a given location, including temperature, 'real feel' temperature, humidity, wind speed, and UV index.
    """
    logger.info(f"Executing tool: getCurrentWeather with location='{location}'")
    try:
        api_key = auth.get_accuweather_api_key()
        location_details = await utils.get_location_details(location, api_key)
        conditions = await utils.fetch_current_conditions(location_details["key"], api_key)
        
        return {
            "status": "success",
            "result": {
                "location": f"{location_details['name']}, {location_details['region']}, {location_details['country']}",
                "observation_time": conditions.get("LocalObservationDateTime"),
                "weather": conditions.get("WeatherText"),
                "temperature": conditions.get("Temperature", {}).get("Metric"),
                "real_feel_temperature": conditions.get("RealFeelTemperature", {}).get("Metric"),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…