Skip to main content
Glama
RJW34

Weather Edge MCP Server

get_forecast

Get calibrated forecast data for NYC, Chicago, Denver, Miami, or LA to support weather prediction market analysis.

Instructions

Get raw calibrated forecast context for one supported city.

Args: city: One of nyc, chicago, denver, miami, la.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler that accepts a city string, fetches the NWS forecast via fetch_nws_forecast, and formats the result using format_forecast.
    @mcp.tool()
    def get_forecast(city: str) -> str:
        """Get raw calibrated forecast context for one supported city.
    
        Args:
            city: One of nyc, chicago, denver, miami, la.
        """
        cfg = get_city(city)
        forecast = _run(fetch_nws_forecast(cfg.key))
        if not forecast:
            return "Forecast unavailable"
        return format_forecast(cfg.key, forecast)
  • The @mcp.tool() decorator registers get_forecast as an MCP tool on the FastMCP instance.
    @mcp.tool()
    def get_forecast(city: str) -> str:
  • Helper that formats the raw forecast data (with bias adjustment) into a human-readable string.
    def format_forecast(city_key: str, forecast: dict[str, Any]) -> str:
        cfg = CITIES[city_key]
        adjusted = forecast["high_f"] + cfg.forecast_bias
        return (
            f"# Forecast — {cfg.label}\n\n"
            f"Raw NWS high: {forecast['high_f']}°F\n"
            f"Bias-adjusted high: {adjusted:.1f}°F\n"
            f"Sigma: {cfg.sigma}°F\n"
            f"Forecast: {forecast['forecast']}\n"
            f"Date: {forecast['date']}"
        )
  • Async helper that fetches the NWS point forecast grid data for a city and returns the first daytime period's high temperature, date, and short forecast.
    async def fetch_nws_forecast(city_key: str) -> dict[str, Any] | None:
        cached = get_cached(f"nws_{city_key}")
        if cached:
            return cached
        cfg = CITIES[city_key]
        url = f"{NWS_BASE}/gridpoints/{cfg.nws_office}/{cfg.nws_grid_x},{cfg.nws_grid_y}/forecast"
        async with httpx.AsyncClient(timeout=10) as client:
            try:
                resp = await client.get(url, headers={"User-Agent": "weather-edge-mcp"})
                if resp.status_code != 200:
                    return None
                for period in resp.json().get("properties", {}).get("periods", []):
                    if period["isDaytime"]:
                        result = {
                            "high_f": period["temperature"],
                            "date": period["startTime"][:10],
                            "forecast": period["shortForecast"],
                        }
                        set_cached(f"nws_{city_key}", result)
                        return result
            except Exception:
                return None
        return None
  • Validates the city input string against the supported CITIES dictionary and returns the CityConfig.
    def get_city(city: str) -> CityConfig:
        key = city.lower().strip()
        if key not in CITIES:
            raise ValueError(f"Unknown city '{city}'. Valid: {', '.join(CITIES.keys())}")
        return CITIES[key]
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description must carry full behavioral disclosure. It does not mention any behavioral traits such as whether the operation is read-only, any authentication needs, or rate limits. The term 'raw calibrated forecast context' is vague.

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 very short and includes a clear parameter list. Every sentence is functional, but it could be more structured with headings or bullet points.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema (not shown), the description need not explain return values. However, for a simple tool with one parameter, it is minimally complete but lacks guidance on error conditions or alternative tools.

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 input schema has 0% description coverage, but the description compensates by listing the allowed cities (nyc, chicago, denver, miami, la). However, it does not explain the meaning of 'city' beyond these values or provide formatting details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('raw calibrated forecast context'), and it is distinct from sibling tools which focus on signals or observations. However, it does not explicitly differentiate itself from siblings.

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 on when to use this tool versus alternatives like get_weather_signals or get_station_observation. The description only lists supported cities without explaining the tool's role.

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

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