Skip to main content
Glama

obtener-clima

Get real-time weather data for any city by providing its name. This tool resolves geographic coordinates and fetches current conditions.

Instructions

Herramienta para obtener el clima en tiempo real

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYesCity name

Implementation Reference

  • main.ts:16-45 (handler)
    Handler function that performs geocoding for the city, fetches current weather data from Open-Meteo API, and returns formatted JSON response or error message if city not found.
    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 pudo encontrar la información de ${city}`
                    }
                ]
            }
        }
    
        const { latitude, longitude } = data.results[0]
    
        const getCurrentWeather = await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&hourly=temperature_2m¤t=temperature_2m,precipitation,rain`)
    
        const weatherData = await getCurrentWeather.json()
    
        return {
            content: [
                {
                    type: 'text',
                    text: JSON.stringify(weatherData, null, 2)
                }
            ]
        }
    }
  • main.ts:13-15 (schema)
    Input schema defining the 'city' parameter as a string using Zod.
    {
        city: z.string().describe('City name')
    },
  • main.ts:10-46 (registration)
    Registration of the 'obtener-clima' tool with MCP server, including name, description, input schema, and handler function.
    server.tool(
        'obtener-clima',
        'Herramienta para obtener el clima en tiempo real',
        {
            city: z.string().describe('City name')
        },
        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 pudo encontrar la información de ${city}`
                        }
                    ]
                }
            }
    
            const { latitude, longitude } = data.results[0]
    
            const getCurrentWeather = await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}&hourly=temperature_2m¤t=temperature_2m,precipitation,rain`)
    
            const weatherData = await getCurrentWeather.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?

No annotations are provided, so the description carries full burden. It states the tool gets real-time weather, but doesn't disclose behavioral traits like rate limits, authentication needs, data sources, error handling, or response format. For a tool with no annotations, this leaves significant gaps in understanding its 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 concise with a single sentence that states the purpose directly. It's appropriately sized for a simple tool, though it could be more informative. There's no wasted text, but it's somewhat under-specified rather than optimally efficient.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what weather data is returned, how real-time is defined, or any operational constraints. For a tool that presumably returns data, more context is needed to understand its full behavior and output.

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 semantics beyond what the input schema provides. The schema has 100% coverage with one parameter 'city' clearly described. Since schema coverage is high, the baseline score is 3, as the description doesn't need to compensate but also adds no extra value.

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 'Herramienta para obtener el clima en tiempo real' states the purpose (get weather in real time) but is vague about scope and lacks specificity. It doesn't mention what weather data is provided (temperature, conditions, etc.) or distinguish from potential siblings, though none exist. The verb 'obtener' (get) with resource 'clima' (weather) is clear but minimal.

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?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, limitations, or context for usage. Since there are no sibling tools, the absence of differentiation is less critical, but overall usage guidance is lacking.

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/JunLovin/weather-mcp'

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