weather_info
Retrieve mock weather data for a specific city using the weather_info tool on my-mcp-server. Input the city name to get weather information instantly.
Instructions
Get weather information for a city
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| city | Yes | The city name |
Implementation Reference
- server1.js:112-130 (handler)Handler for the 'weather_info' tool that provides mock weather information for specified cities using a hardcoded data map.case "weather_info": // Mock weather data (you could integrate with a real API) const weatherData = { "New York": "Sunny, 72°F", "London": "Cloudy, 65°F", "Tokyo": "Rainy, 68°F", "Sydney": "Partly cloudy, 75°F", }; const weather = weatherData[args.city] || "Weather data not available for this city"; return { content: [ { type: "text", text: `Weather in ${args.city}: ${weather}`, }, ], };
- server1.js:54-67 (registration)Registration of the 'weather_info' tool in the listTools handler, including name, description, and input schema requiring a 'city' string.{ name: "weather_info", description: "Get weather information for a city", inputSchema: { type: "object", properties: { city: { type: "string", description: "The city name", }, }, required: ["city"], }, }
- server1.js:57-66 (schema)Input schema for the 'weather_info' tool, defining a required 'city' string property.inputSchema: { type: "object", properties: { city: { type: "string", description: "The city name", }, }, required: ["city"], },