Lesson 21medium10 min
Adding the OpenWeatherMap Intelligence Tool
Integrate real-time weather forecasts so the agent can provide transit and outdoor meeting advice.
Learning Objectives
- Obtain and configure an OpenWeatherMap API key
- Attach OpenWeatherMap as an agent tool with dynamic city arguments
- Verify weather observations in agent thought logs
Adding the OpenWeatherMap Intelligence Tool
A thorough executive assistant monitors weather conditions to warn about commute disruptions or outdoor meeting conflicts.
Setting Up OpenWeatherMap
- Sign up at
openweathermap.organd copy your free API key. - In n8n, drag from the AI Agent Tools port and search for OpenWeatherMap.
- Tool Name:
get_weather_forecast - Tool Description:text
Retrieve current weather conditions, temperature, and precipitation forecasts for a given city name. - Configure the tool parameters to allow dynamic city queries:
- City:
={{ $fromAI('city', 'The city name to query, e.g. San Francisco') }}
- City:
Advertisement
Testing the Tool
Run a test query: "What is the weather in San Francisco today?" Inspect the execution trace: notice the agent emitting a tool call to get_weather_forecast with {"city": "San Francisco"}.