Skip to main content
Glama

get_beach_data_uv

Retrieve beach forecasts or UV index data from Spain's AEMET API. Query by beach name, ID, or list by province, specifying forecast days (0 to 4).

Instructions

Query information on beaches or UV index from AEMET.

Args: name_or_code: Partial or full name of the beach, or its BEACH_ID. Also accepts 'list' or 'list:'. dias_frc: Number of forecast days, starting form 0, which means 0 days from today, to 4, which means 4 days from today. query_type: 'beach' for forecast, 'UV_index' for UV index, must be in english.

Returns: Requested information or list of matches.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dias_frcYes
nombre_o_codigoYes
tipo_consultaNoplaya

Implementation Reference

  • The main handler function for the 'get_beach_data_uv' tool. It handles beach name or code lookup, lists beaches if requested, constructs the AEMET API URL for beach forecasts or UV index, and fetches the data using make_aemet_request.
    @mcp.tool() async def get_beach_data_uv(nombre_o_codigo: str, dias_frc: int, tipo_consulta: str = "playa"): """Query information on beaches or UV index from AEMET. Args: name_or_code: Partial or full name of the beach, or its BEACH_ID. Also accepts 'list' or 'list:<province>'. dias_frc: Number of forecast days, starting form 0, which means 0 days from today, to 4, which means 4 days from today. query_type: 'beach' for forecast, 'UV_index' for UV index, must be in english. Returns: Requested information or list of matches. """ comando = normalize(nombre_o_codigo.strip()) if comando == "list": return sorted(CODIGOS_PLAYAS, key=lambda x: normalize(x["NOMBRE_PLAYA"])) if comando.startswith("list:"): provincia = normalize(comando.split("list:", 1)[1].strip()) return PROVINCIA_A_PLAYAS.get(provincia, []) if nombre_o_codigo.isdigit(): codigo = nombre_o_codigo else: coincidencias = [ p for p in CODIGOS_PLAYAS if comando in normalize(p["NOMBRE_PLAYA"]) or comando in normalize(p["NOMBRE_PROVINCIA"]) ] if len(coincidencias) == 1: codigo = str(coincidencias[0]["ID_PLAYA"]) elif coincidencias: return coincidencias else: return {"error": f"No matches found for '{nombre_o_codigo}'."} url = f"{AEMET_API_BASE}/prediccion/especifica/{'playa' if tipo_consulta == 'beach' else 'uvi'}/{codigo if tipo_consulta == 'beach' else dias_frc}" return await make_aemet_request(url)

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/AnCode666/aemet-mcp'

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