import { z } from "zod";
import { getWeather } from "../services/weatherService.js";
/**
* Definición del esquema de entrada para la herramienta de clima
*/
export const weatherInputSchema = {
city: z.string().describe("Ciudad para obtener el clima")
};
/**
* Manejador para la herramienta de clima
* @param params Parámetros de la herramienta
* @returns Resultado formateado
*/
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}.`
}
]
};
}
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