Skip to main content
Glama
FacuPVe

MCP Weather Server

by FacuPVe

fetch-weather

Retrieve current weather data for any city by providing the city name as input.

Instructions

Tool to fetch the weather of a city

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYesNombre de la ciudad

Implementation Reference

  • main.ts:20-49 (handler)
    The handler function that performs geocoding to find coordinates for the city and then fetches current weather data from Open-Meteo API, returning the JSON data as text content.
    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.length === 0) {
            return {
                content: [
                    {
                        type: "text",
                        text: `No se encontró información del clima 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,is_day,precipitation,rain&forecast_days=1`)
    
        const weatherData = await weatherResponse.json();
    
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(weatherData, null, 2),
                },
            ],
        };
    }
  • main.ts:17-19 (schema)
    Input schema using Zod: requires a 'city' string parameter.
    {
        city: z.string().describe('Nombre de la ciudad'),
    },
  • main.ts:14-50 (registration)
    The server.tool call that registers the 'fetch-weather' tool with name, description, input schema, and handler function.
    server.tool(
        'fetch-weather',
        'Tool to fetch the weather of a city',
        {
            city: z.string().describe('Nombre de la ciudad'),
        },
        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.length === 0) {
                return {
                    content: [
                        {
                            type: "text",
                            text: `No se encontró información del clima 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,is_day,precipitation,rain&forecast_days=1`)
    
            const weatherData = await weatherResponse.json();
    
            return {
                content: [
                    {
                        type: "text",
                        text: JSON.stringify(weatherData, null, 2),
                    },
                ],
            };
        }
    );
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 but offers minimal information. It doesn't describe response format, error handling, rate limits, authentication needs, or other behavioral traits beyond the basic action.

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 with a single, direct sentence that clearly states the tool's purpose. There is no wasted verbiage, and it is appropriately front-loaded with essential information.

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 lack of annotations and output schema, the description is incomplete for effective tool use. It doesn't explain what weather data is returned, format details, or other contextual information needed beyond the basic action, leaving significant gaps.

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 'Nombre de la ciudad'. The description adds no additional parameter semantics beyond what's in the schema, so it meets the baseline for high schema coverage.

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 with a specific verb ('fetch') and resource ('weather of a city'), making it immediately understandable. However, it doesn't differentiate from siblings since there are none, so it can't achieve the highest score for that criterion.

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, prerequisites, or context-specific considerations. It merely states what the tool does without any usage instructions or exclusions.

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/FacuPVe/intro-mcp'

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