Expand weather tool to comprehensive multi-day forecast with full metrics#270
Merged
Conversation
The `get_weather` live tool requested only the current temperature/weather code and a max/min/code daily outlook, then rendered a single spoken sentence — leaving the LLM unable to answer follow-ups about humidity, wind, precipitation chance, UV, sunrise/sunset, etc. Request the full relevant Open-Meteo series and render a comprehensive, labelled multi-line report the agent can draw on: - Current: temperature + feels-like (both units), humidity, cloud cover, precipitation, wind speed/direction/gusts, pressure, day/night. - Daily (7 days): high/low (both units), condition, precipitation amount + probability, max wind/gusts/direction, UV index, sunrise/sunset. Surface the geocoded country and add a 16-point compass helper for wind direction. The agent still reads aloud only the slice a turn calls for; the rest is there when the conversation drills in. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GfS9w6EyrSFbVQhthm4MCt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Transforms the weather tool from a minimal single-sentence report (current temperature + 2-day outlook) into a comprehensive, multi-line forecast that surfaces every field an LLM might need to answer follow-up questions. The report now spans 7 days and includes full current conditions (feels-like temperature, humidity, precipitation amount & probability, wind speed/direction/gusts, cloud cover, pressure, day/night indicator) plus detailed daily outlooks (high/low temps, conditions, precipitation, wind, UV index, sunrise/sunset).
Key Changes
describe_wind_direction()function converts bearings to 16-point compass names (N, NNE, NE, etc.)_geocode()now returns country name (or None) as part of the location tuple, displayed in the report_num()for clean decimal rendering (drops trailing.0) and_local_time()to extract HH:MM from ISO timestamps_daily_rows()function transposes Open-Meteo's parallel arrays into per-day mappings, with ragged-array protection (shortest required field bounds row count)_format_current()and_format_day()for clarity and testabilityImplementation Details
round(c * 9/5 + 32))round(degrees / 22.5) % 16to index the 16-point compassTesting
describe_wind_direction,_num,_local_time,_daily_rows)_FORECASTfixture with full current/daily field sets_EXPECTED_REPORT) pins every field, rounding, and unit conversionhttps://claude.ai/code/session_01GfS9w6EyrSFbVQhthm4MCt