BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/simple-ai/get-weather

get-weather

simple-ai/get-weather
FreeUtility

A tool for getting the weather.

Install it

npx shadcn@latest add https://simple-ai.dev/r/get-weather.json

Source

./src/registry/ai/tools/get-weather.tssimple-ai.dev/r/get-weather.json
1import { type InferUITool, tool } from "ai";
2import { z } from "zod";
3
4const getWeatherParamsSchema = z.object({
5 city: z.string().describe("The city to get the weather for"),
6 unit: z.enum(["fahrenheit", "celsius"]).describe("The unit of temperature"),
7});
8
9export type GetWeatherParams = z.infer<typeof getWeatherParamsSchema>;
10
11const getWeatherResultSchema = z.union([
12 z.object({
13 success: z.literal(true),
14 message: z.string(),
15 temperature: z.number(),
16 windSpeed: z.number(),
17 weatherCode: z.number(),
18 }),
19 z.object({
20 success: z.literal(false),
21 error: z.string(),
22 }),
23]);
24
25export type GetWeatherResult = z.infer<typeof getWeatherResultSchema>;
26
27export const getWeatherTool = tool({
28 name: "get-weather",
29 description: "Get the current weather in a location",
30 inputSchema: getWeatherParamsSchema,
31 outputSchema: getWeatherResultSchema,
32 execute: async (params) => {
33 try {
34 const geocodeUrl = `https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(params.city)}&count=1&language=en&format=json`;
35 const geocodeResponse = await fetch(geocodeUrl);
36 const geocodeData = await geocodeResponse.json();
37
38 if (!geocodeData.results || geocodeData.results.length === 0) {
39 return {
40 success: false,
41 error: `Could not find location: ${params.city}`,
42 };
43 }
44
45 const { latitude, longitude } = geocodeData.results[0];
46
47 const tempUnit =
48 params.unit === "celsius" ? "celsius" : "fahrenheit";
49 const weatherUrl = `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&current=temperature_2m,weathercode,windspeed_10m&temperature_unit=${tempUnit}`;
50 const weatherResponse = await fetch(weatherUrl);
51 const weatherData = await weatherResponse.json();
52
53 const temperature = weatherData.current.temperature_2m;
54 const windSpeed = weatherData.current.windspeed_10m;
55 const weatherCode = weatherData.current.weathercode;
56
57 const weatherDescriptions: Record<number, string> = {
58 0: "Clear sky",
59 1: "Mainly clear",
60 2: "Partly cloudy",
61 3: "Overcast",
62 45: "Foggy",
63 48: "Depositing rime fog",
64 51: "Light drizzle",
65 53: "Moderate drizzle",
66 55: "Dense drizzle",
67 61: "Slight rain",
68 63: "Moderate rain",
69 65: "Heavy rain",
70 71: "Slight snow",
71 73: "Moderate snow",
72 75: "Heavy snow",
73 77: "Snow grains",
74 80: "Slight rain showers",
75 81: "Moderate rain showers",
76 82: "Violent rain showers",
77 85: "Slight snow showers",
78// … truncated

What it pulls in

npm packages

  • ai
  • zod

Files it writes

  • ./src/registry/ai/tools/get-weather.ts

Facts

Registry
simple-ai
Type
registry:lib
Access
Free
Files written
1
Licence
the repository states none
In the index
at or before 2026-08-13
Last confirmed
yesterday

Go to the source

Docs on simple-ai simple-ai.dev Raw registry item This item as JSON

More from simple-ai

All 77 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
agent-respondagent-respondsimple-aiUtilitiesFree1 dep
agents-tools-registryagents-tools-registrysimple-aiUtilitiesFree1 dep · 2 files
ai-utilsai-utilssimple-aiUtilitiesFree1 dep
Exa Agentexa-agentsimple-aiUtilitiesFree1 dep
exa-toolexa-toolsimple-aiUtilitiesFree3 deps
Firecrawl Agentfirecrawl-agentsimple-aiUtilitiesFree1 dep
firecrawl-toolfirecrawl-toolsimple-aiUtilitiesFree3 deps
id-to-readable-textid-to-readable-textsimple-aiUtilitiesFreeno deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex