Skip to main content
Glama
itsPatH

Basic MCP Weather Tool

by itsPatH

fetch-weather

Get current weather data for any city using the Open-Meteo API. Provide a city name to receive temperature and conditions information.

Instructions

Tool to fetch weather information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYesCity name

Implementation Reference

  • main.ts:19-47 (handler)
    Handler function that performs geocoding for the city using Open-Meteo API, then fetches current and hourly weather data, returning it as JSON text.
      async ({ city }) => {
        const response = await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${city}&count=10&language=en&format=json`);
        const data = await response.json();
        if (!data.results || data.results.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: `No se encontró información para la ciudad: ${city}.`,
              }
            ]
          };
        }
    
        const { latitude, longitude } = data.results[0];
    
        const weatherResponse = await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&hourly=temperature_2m¤t=temperature_2m,precipitation,is_day,rain&forecast_days=1`);
        const weatherData = await weatherResponse.json();
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(weatherData, null, 2),
            }
          ]
        };
      }
    );
  • main.ts:16-18 (schema)
    Input schema defining 'city' as a required string parameter.
    {
      city: z.string().describe('City name'),
    },
  • main.ts:13-15 (registration)
    Registration of the 'fetch-weather' tool with MCP server, including name, description, schema, and handler.
    server.tool(
      'fetch-weather',
      'Tool to fetch weather information',
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions 'fetch' but does not disclose behavioral traits like whether it requires authentication, has rate limits, returns errors for invalid cities, or provides data freshness. This leaves significant gaps in understanding the tool's operation.

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

Conciseness4/5

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

The description is a single, efficient sentence with zero waste, making it appropriately sized. However, it lacks front-loading of critical details like scope or constraints, which could improve structure for clarity.

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 complexity (simple fetch operation), no annotations, and no output schema, the description is incomplete. It does not explain what weather information is returned (e.g., temperature, humidity), potential errors, or any behavioral context, leaving the agent with insufficient information for reliable use.

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 input schema has 100% description coverage, with the 'city' parameter documented as 'City name'. The description adds no additional meaning beyond this, such as format examples (e.g., 'New York' vs. coordinates) or handling of edge cases. Baseline 3 is appropriate since the schema does the heavy lifting.

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

Purpose3/5

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

The description 'Tool to fetch weather information' states a general purpose (fetching weather) but is vague about what specific information is retrieved (e.g., current conditions, forecast, temperature). It distinguishes from no siblings since none exist, but lacks specificity in verb+resource details beyond the basic action.

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, such as for real-time data vs. historical data, or any prerequisites like location availability. With no sibling tools, there are no alternatives to differentiate from, but it still lacks basic context for usage.

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/itsPatH/basicMCP'

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