Skip to main content
Glama
TaylorChen

Multi-MCPs

by TaylorChen

get_weather_forecast

Retrieve 5-day weather forecasts with 3-hour intervals for any city using the Multi-MCPs server's integrated weather API.

Instructions

Get 5-day/3-hour forecast by city name

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
locationYes
daysNoDays to include (1-5)

Implementation Reference

  • The async handler function that implements the get_weather_forecast tool. It validates the API key and location, fetches the forecast data using client.forecastByCity, and optionally slices the list based on the 'days' parameter.
    async get_weather_forecast(args: Record<string, unknown>) {
      if (!cfg.openWeatherApiKey) throw new Error("OPENWEATHER_API_KEY is not configured");
      const location = String(args.location || "");
      const days = args.days ? Number(args.days) : undefined;
      if (!location) throw new Error("location is required");
      const data: any = await client.forecastByCity(location);
      if (!days) return data;
      const count = Math.max(1, Math.min(5, days));
      const list = (data as any).list || [];
      return { ...(data as object), list: list.slice(0, count * 8) } as any;
  • The inputSchema for the get_weather_forecast tool, defining 'location' as required string and optional 'days' number.
    inputSchema: {
      type: "object",
      properties: {
        location: { type: "string" },
        days: { type: "number", description: "Days to include (1-5)" },
      },
      required: ["location"],
    },
  • The call to registerOpenWeather() within the registerAllTools function, which includes the get_weather_forecast tool in the overall tool registrations for the MCP server.
    registerOpenWeather(),
  • The forecastByCity method in OpenWeatherClient that makes the API request to retrieve the raw forecast data used by the handler.
    async forecastByCity(location: string) {
      return this.request("/data/2.5/forecast", {
        query: { q: location, appid: this.apiKey, units: "metric" },
      });
    }
  • The registerOpenWeather function that defines and returns the ToolRegistration object containing the tool schema and handler for get_weather_forecast.
    export function registerOpenWeather(): ToolRegistration {
      const cfg = loadConfig();
      const client = new OpenWeatherClient(cfg.openWeatherApiKey || "");
    
      return {
        tools: [
          {
            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"],
            },
          },
          {
            name: "get_weather_forecast",
            description: "Get 5-day/3-hour forecast by city name",
            inputSchema: {
              type: "object",
              properties: {
                location: { type: "string" },
                days: { type: "number", description: "Days to include (1-5)" },
              },
              required: ["location"],
            },
          },
          {
            name: "get_weather_alerts",
            description: "Get weather alerts for a location (requires One Call support)",
            inputSchema: {
              type: "object",
              properties: {
                location: { type: "string" },
              },
              required: ["location"],
            },
          },
        ],
        handlers: {
          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);
          },
          async get_weather_forecast(args: Record<string, unknown>) {
            if (!cfg.openWeatherApiKey) throw new Error("OPENWEATHER_API_KEY is not configured");
            const location = String(args.location || "");
            const days = args.days ? Number(args.days) : undefined;
            if (!location) throw new Error("location is required");
            const data: any = await client.forecastByCity(location);
            if (!days) return data;
            const count = Math.max(1, Math.min(5, days));
            const list = (data as any).list || [];
            return { ...(data as object), list: list.slice(0, count * 8) } as any;
          },
          async get_weather_alerts(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.alertsByLocation(location);
          },
        },
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Get' implies a read operation, it doesn't mention rate limits, authentication requirements, data freshness, error conditions, or what format the forecast data returns. For a weather API tool with no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise at just 6 words, front-loading the essential information with zero wasted words. Every element ('Get', '5-day/3-hour forecast', 'by city name') serves a clear purpose in minimal space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a weather forecast tool with 2 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what the forecast data includes (temperature, precipitation, etc.), time intervals, units, or error handling. The agent would need to guess about the return format and operational constraints.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'by city name' which clarifies the 'location' parameter, and '5-day' implies the 'days' parameter default/scope. With 50% schema description coverage (only 'days' has description), the description adds some value by clarifying 'location' semantics, but doesn't fully compensate for the coverage gap or provide format details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('5-day/3-hour forecast by city name'), making the tool's purpose immediately understandable. However, it doesn't distinguish this tool from sibling 'get_current_weather', leaving some ambiguity about when to use each weather-related tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance about when to use this tool versus alternatives like 'get_current_weather' or 'get_weather_alerts'. It also doesn't mention prerequisites, limitations, or typical use cases for a forecast versus current weather.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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