Overview
What I Built
This project is a weather agent that leads with verified data instead of a chat box. Search for a place and the first thing you see is not a paragraph but structured cards from Open-Meteo: current conditions, the next 12 hours, the 7-day outlook, precipitation, wind, and air quality. Only then does Claude write a short narrative, and it writes strictly from the numbers on screen, so nothing it says can be a hallucinated forecast.
What makes it interesting isn't the weather part. It's the architecture underneath. The core pattern is what the AI community calls tool use: instead of having Claude guess or hallucinate an answer, we give it structured capability definitions ("tools") that it can choose to invoke when it needs real-world information. Each tool has a name, a natural-language description, and a typed input schema, defined directly in JavaScript and passed to the Anthropic Messages API alongside the user's question. There is no MCP server involved. The tools are hardcoded locally in this single HTML file, and the tool execution logic (geocoding, API calls, data parsing) runs entirely in the browser.
In a production system, you might host these same tool definitions on an MCP (Model Context Protocol) server: a standardized way to expose tools so that any compatible AI client can discover and invoke them over a network protocol. This project skips that layer intentionally: by defining and executing the tools locally, every step of the agentic loop is visible in one file without any infrastructure in the way.
The problem it solves is a real one: most APIs return raw JSON that requires parsing, formatting, and presentation logic before it's useful to a person. With tool use, the AI handles both sides: it decides when to call the API, passes the right inputs, interprets the structured result, and composes a response that makes sense in context. You write less glue code, and the interface becomes far more flexible.
Try It
Live Demo
Search for a place. If several places share the name, pick the right one from the list. The agent then fetches current, hourly, 7-day, and air quality data in parallel and renders verified cards before any AI narrative appears.
Agent trace
Verified data
Forecast
Wind
Precipitation
Air quality
Next 12 hours
7-day outlook
What this means
Ask a follow-up
Follow-ups are answered from the forecast above. No new request is made.
Architecture
How It Works
The agent runs a fixed, visible pipeline instead of an open-ended chat loop. Search resolves a place through geocoding, with disambiguation when several places share a name. One parallel fetch then pulls current conditions, hourly, 7-day daily, and air quality from Open-Meteo. Structured cards render from those responses first. Only then does Claude write a short narrative, and its prompt contains nothing but the numbers already on screen. Follow-up questions resolve against the cached forecast, so they never re-fetch.
Place name goes to the Open-Meteo geocoding API
Multiple matches become a pick list: Paris, France vs Paris, Texas
Forecast and air quality requests run together, with a visible trace
Current, hourly, 7-day, precipitation, wind, and air quality cards render first
Claude summarizes only the fetched numbers, with the source shown
Why data leads: A chat-first agent can answer fluently about weather it never fetched, and the visitor cannot tell. When cards render before any model text, and the trace shows exactly which endpoints returned which numbers, the visitor can check every claim. The model becomes a summarizer with receipts, which is the only role where its fluency cannot invent a forecast.
Reflection
What I Learned
Rebuilding the demo data-first changed what I thought the interesting problem was:
-
Grounding beats prompting The first version asked Claude to call tools and trusted the result. The rebuild inverts it: fetch first, render second, narrate last, with the model's prompt restricted to numbers already on screen. That ordering removes an entire class of failure (fluent, wrong forecasts) without any prompt cleverness, which is a cheaper fix than any amount of instruction tuning.
-
A visible trace is a trust feature Showing each step (geocode, forecast, air quality, summary) with its endpoint and result does more for credibility than any copy claim. A hiring manager can follow the agent's work instead of taking "agentic" on faith, and when something fails, the trace says exactly where instead of leaving a dead chat box.
-
API friction is the real barrier to AI experimentation Using Open-Meteo (free, no signup, no key required) meant I could focus entirely on the agent layer. Every time I've tried to experiment with APIs that require registration or billing setup, the friction kills momentum before anything runs. There's a strong argument for starting every AI project with keyless APIs and swapping in authenticated ones later.
-
Cached data answers follow-ups for free Once a 7-day forecast is in hand, "will it rain this weekend" needs no new request, no new tokens, and no new failure mode. Resolving follow-ups locally against the cache is faster, cheaper, and more honest than re-asking a model, and it turns the forecast from a one-shot answer into something the visitor can interrogate.
Tools Used
Tech Stack
Built entirely without frameworks or build tools: a single HTML file, vanilla JavaScript, and two free public APIs.
Keep exploring
More from the site
Head back to the projects page.