Skip to main content
Glama

get_station_list

Retrieve a list of weather stations from Spain's AEMET API, optionally filtered by station names or provinces for targeted weather data access.

Instructions

Get a list of all available weather stations or filter by one or more search terms, including approximate matches.

Args: search_terms: Optional terms (space or comma separated) to filter stations by name or province.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_termsNo

Implementation Reference

  • The @mcp.tool()-decorated handler function that fetches the complete list of AEMET weather stations and filters them by normalized search terms matching station name or province.
    @mcp.tool() async def get_station_list(search_terms: str = ""): """ Get a list of all available weather stations or filter by one or more search terms, including approximate matches. Args: search_terms: Optional terms (space or comma separated) to filter stations by name or province. """ url = f"{AEMET_API_BASE}/valores/climatologicos/inventarioestaciones/todasestaciones" stations = await make_aemet_request(url) if not stations: return None if not search_terms: logger.info("No search terms provided") return stations terms = search_terms.replace(',', ' ').split() search_terms_normalized = [normalize(term) for term in terms] filtered = [] numCoincidencias = 0 for station in stations: if not isinstance(station, dict): continue nombre = normalize(station.get("nombre", "")) provincia = normalize(station.get("provincia", "")) for term in search_terms_normalized: if term in nombre or term in provincia: filtered.append(station) numCoincidencias += 1 break logger.info(f"Filtered stations: {numCoincidencias}") return filtered
  • Registers the get_station_list tool in the FastMCP server using the @mcp.tool() decorator.
    @mcp.tool()

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