Skip to main content
Glama
TaylorChen

Multi-MCPs

by TaylorChen

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
NameRequiredDescriptionDefault
locationYesCity name, e.g., London

Implementation Reference

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

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/TaylorChen/muti-mcps'

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