Skip to main content
Glama

get-current-weather

Retrieve real-time weather data by specifying a city and country code. Integrates with the MCP Servers for accurate and instant weather updates using a straightforward API.

Instructions

Get current weather for a location

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYesCity name (e.g. Beijing, London)
countryNoCountry code (e.g. CN, GB)

Implementation Reference

  • Registration of the 'get-current-weather' MCP tool using server.tool(), including description, input schema, and handler function.
      "get-current-weather",
      "Get current weather for a location",
      {
        city: z.string().describe("City name (e.g. Beijing, London)"),
        country: z.string().optional().describe("Country code (e.g. CN, GB)")
      },
      async ({ city, country }) => {
        const weatherText = await weatherController.getCurrentWeather(city, country);
        return {
          content: [
            {
              type: "text",
              text: weatherText,
            },
          ],
        };
      }
    );
  • Zod schema for tool inputs: city (required string), country (optional string).
    {
      city: z.string().describe("City name (e.g. Beijing, London)"),
      country: z.string().optional().describe("Country code (e.g. CN, GB)")
    },
  • Inline handler function for the tool: extracts parameters, calls WeatherController.getCurrentWeather(), and returns formatted MCP content response.
    async ({ city, country }) => {
      const weatherText = await weatherController.getCurrentWeather(city, country);
      return {
        content: [
          {
            type: "text",
            text: weatherText,
          },
        ],
      };
    }
  • WeatherController.getCurrentWeather(): fetches raw weather data from service and formats it into a human-readable string with temperature, conditions, humidity, etc.
    async getCurrentWeather(city: string, country?: string): Promise<string> {
      const weatherData = await this.weatherService.getCurrentWeather(city, country);
    
      if (!weatherData) {
        return `Failed to retrieve weather data for ${country ? `${city}, ${country}` : city}`;
      }
    
      return [
        `Current weather in ${weatherData.name}, ${weatherData.sys.country}:`,
        `Temperature: ${weatherData.main.temp}°C (Feels like: ${weatherData.main.feels_like}°C)`,
        `Conditions: ${weatherData.weather[0].main} - ${weatherData.weather[0].description}`,
        `Humidity: ${weatherData.main.humidity}%`,
        `Wind Speed: ${weatherData.wind.speed} m/s`,
        `Pressure: ${weatherData.main.pressure} hPa`,
      ].join("\n");
    }
  • WeatherService.getCurrentWeather(): builds location query and calls makeRequest to fetch current weather data from OpenWeatherMap API.
    async getCurrentWeather(city: string, country?: string): Promise<WeatherData | null> {
      const query = country ? `${city},${country}` : city;
      return this.makeRequest<WeatherData>("weather", { q: query });
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states what the tool does but reveals nothing about behavioral traits: no information about rate limits, authentication requirements, error conditions, response format, or whether this is a read-only operation. The description is minimal and lacks essential operational context.

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: 'Get current weather for a location'. It's front-loaded with the core purpose and contains zero wasted words. This is an example of efficient communication where every word earns its place.

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?

Given the tool's moderate complexity (2 parameters, no output schema, no annotations), the description is insufficiently complete. It states what the tool does but provides no context about when to use it, what it returns, or any behavioral characteristics. For a weather API tool that likely has rate limits and specific response formats, this leaves significant gaps for an AI agent.

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 adds no parameter information beyond what's already in the schema. Since schema description coverage is 100% (both parameters have descriptions in the schema), the baseline score is 3. The description doesn't compensate with additional context about parameter usage, relationships, or examples beyond the schema's documentation.

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 tool's purpose: 'Get current weather for a location'. It specifies the verb ('Get') and resource ('current weather'), making it understandable. However, it doesn't explicitly differentiate from its sibling tool 'get-forecast', which likely provides future weather predictions rather than current conditions.

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 on when to use this tool versus alternatives. There's no mention of the sibling tool 'get-forecast', nor any context about when current weather data is appropriate versus forecast data. The agent must infer usage from the tool name alone.

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

Related 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/fist-maestro/mcp-servers'

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