Skip to main content
Glama

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
NameRequiredDescriptionDefault
cityYesThe city name

Implementation Reference

  • 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}`, }, ], }; },
  • 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}`, }, ], }; }, },

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/v4lheru/generic-mcp-template'

If you have feedback or need assistance with the MCP directory API, please join our Discord server