get_current_weather
Retrieve current weather conditions for any city using the Multi-MCPs server, which integrates multiple third-party APIs into unified tools.
Instructions
Get current weather by city name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| location | Yes | City name, e.g., London |
Implementation Reference
- src/apis/weather/openweather.ts:85-90 (handler)The handler function that implements the core logic for the 'get_current_weather' tool, handling input validation and API call delegation.async get_current_weather(args: Record<string, unknown>) { if (!cfg.openWeatherApiKey) throw new Error("OPENWEATHER_API_KEY is not configured"); const location = String(args.location || ""); if (!location) throw new Error("location is required"); return client.currentWeatherByCity(location); },
- Input schema defining the parameters for the 'get_current_weather' tool.inputSchema: { type: "object", properties: { location: { type: "string", description: "City name, e.g., London" }, }, required: ["location"], },
- src/apis/weather/openweather.ts:49-59 (registration)Tool registration entry in the OpenWeather registration function, including name, description, and schema.{ name: "get_current_weather", description: "Get current weather by city name", inputSchema: { type: "object", properties: { location: { type: "string", description: "City name, e.g., London" }, }, required: ["location"], }, },
- src/tools/register.ts:23-23 (registration)Invocation of the OpenWeather tool registration as part of central all-tools registration.registerOpenWeather(),
- Helper method in OpenWeatherClient class that makes the actual API request for current weather.async currentWeatherByCity(location: string) { return this.request("/data/2.5/weather", { query: { q: location, appid: this.apiKey, units: "metric" }, }); }