Skip to content

feat(examples): make get-weather-js work without an API key#294

Merged
thomastaylor312 merged 4 commits into
microsoft:mainfrom
bowlofarugula:feat/open-meteo-weather
Oct 2, 2025
Merged

feat(examples): make get-weather-js work without an API key#294
thomastaylor312 merged 4 commits into
microsoft:mainfrom
bowlofarugula:feat/open-meteo-weather

Conversation

@bowlofarugula

@bowlofarugula bowlofarugula commented Sep 26, 2025

Copy link
Copy Markdown
Contributor

Replace OpenWeatherMap API with Open-Meteo's free weather API in the get-weather-js example. This removes the API key requirement, making the example more accessible for users to test without registration.

https://github.com/open-meteo/open-meteo

You can validate with

node -e "import('./weather.js').then(m => m.getWeather('Paris').then(console.log)).catch(e => console.error(e.toString()))"

@bowlofarugula

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree


/// Weather information services
world weather-mcp {
import wasi:config/store@0.2.0-draft;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need wasi:config/store anymore because we don't have an API key to read.

@thomastaylor312

Copy link
Copy Markdown
Collaborator

@bowlofarugula This is great! However, could you add this as a new example alongside the existing one? I like having one with no API key, but right now the current weather example is the only one that uses wasi-config to show how you could load an API key and I don't want to lose that

Replace OpenWeatherMap API with Open-Meteo's free weather API in the
get-weather-js example. This removes the API key requirement, making
the example more accessible for users to test without registration.

You can validate with

```javascript
node -e "import('./weather.js').then(m => m.getWeather('Paris').then(console.log)).catch(e => console.error(e.toString()))"
```

Signed-off-by: Ian McDonald <bowlofarugula@gmail.com>
@bowlofarugula bowlofarugula force-pushed the feat/open-meteo-weather branch from 2d44716 to 8276bcd Compare September 29, 2025 04:10
@bowlofarugula

Copy link
Copy Markdown
Contributor Author

@thomastaylor312 Done. lmk if there's anything else you'd like to see adjusted.

A suggestion:

I can follow up this PR with another that adds a get-recent-discord-messages example which reads an API key from wasi-config.

// export DISCORD_TOKEN="your-bot-token-here"
export get-discord-messages: func(channel: string, limit: option<u8>) -> result<list<string>>;

Reasoning:

Probably 0 people are going to create a new account on a weather API service they'll never use, just to run a toy weather example. Especially with an alternative right next to it that doesn't require that.

Since the point of the example is to document loading values from wasi-config, why not make it more interesting?

I think the discord idea is nice because (1) Many Wassette users will have discord already, and (2) It could be nice for your live demos, where you would write messages into discord live and have an agent see them. Could end up as a showcase of Wassette's advantages wrt prompt injection attacks via that vector too.

@thomastaylor312

Copy link
Copy Markdown
Collaborator

I'm all onboard with having another example using something like Discord if you'd like to do that!

@thomastaylor312 thomastaylor312 merged commit 3463927 into microsoft:main Oct 2, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants