Skip to main content
Glama

obtener-clima

Retrieve real-time weather data for a specified city. Use this tool to quickly access accurate climate information for planning and analysis.

Instructions

Herramienta para obtener clima

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYesCiudad para obtener el clima

Implementation Reference

  • src/main.ts:24-31 (registration)
    Registers the "obtener-clima" tool with its input schema and handler function.
    server.registerTool( "obtener-clima", { description: "Herramienta para obtener clima", inputSchema: weatherInputSchema }, weatherToolHandler );
  • Defines the Zod input schema for the weather tool, specifying the required 'city' parameter.
    export const weatherInputSchema = { city: z.string().describe("Ciudad para obtener el clima") };
  • Implements the weatherToolHandler function that extracts the city, calls the weather service, and returns a formatted MCP response.
    export async function weatherToolHandler(params: any) { const { city } = params; // Utilizamos el servicio de clima const weatherData = await getWeather(city); // Devolvemos el resultado formateado para MCP return { content: [ { type: "text" as const, text: `El clima en ${weatherData.city} es ${weatherData.condition} con una temperatura de ${weatherData.temperature}.` } ] }; }
  • Provides the getWeather helper function that returns mock weather data for a given city (in production would call a real API).
    export async function getWeather(city: string): Promise<WeatherData> { // En un caso real, aquí se haría una llamada a una API de clima // Por ahora, devolvemos datos estáticos return { city, temperature: "25°C", condition: "soleado" }; }

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/mcgiverdev/mcp-api-v1'

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