get-weather
Retrieve weather forecast data for any specified city to inform planning and decision-making.
Instructions
Get weather forecast for a city
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | The city name |
Implementation Reference
- src/tools.ts:26-37 (handler)The async handler function for the 'get-weather' tool. It generates a random mock weather condition for the input city and returns it as text content.handler: async ({ city }: { city: string }) => { // Mock implementation const weather = ["Sunny", "Cloudy", "Rainy"][Math.floor(Math.random() * 3)]; return { content: [ { type: "text" as const, text: `The weather in ${city} is ${weather}`, }, ], }; },
- src/tools.ts:23-25 (schema)Zod input schema for the 'get-weather' tool, requiring a 'city' string parameter.inputSchema: z.object({ city: z.string().describe("The city name"), }),
- src/tools.ts:21-38 (registration)Registration of the 'get-weather' tool within the TOOLS object, including description, input schema, and handler reference."get-weather": { description: "Get weather forecast for a city", inputSchema: z.object({ city: z.string().describe("The city name"), }), handler: async ({ city }: { city: string }) => { // Mock implementation const weather = ["Sunny", "Cloudy", "Rainy"][Math.floor(Math.random() * 3)]; return { content: [ { type: "text" as const, text: `The weather in ${city} is ${weather}`, }, ], }; }, },