Skip to main content
Glama
penguinszp001

mcp-server-demo

weather

Get current conditions for any city. Enter a city name to receive temperature, humidity, wind speed, and more.

Instructions

Return current weather for a city using wttr.in.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cityYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:80-96 (handler)
    The weather tool handler function. Decorated with @mcp.tool(), it takes a city name, fetches current weather from wttr.in API, and returns a JSON summary with temperature, humidity, wind speed, etc.
    def weather(city: str) -> str:
        """Return current weather for a city using wttr.in."""
        response = httpx.get(f"https://wttr.in/{city}", params={"format": "j1"}, timeout=20)
        response.raise_for_status()
        data: dict[str, Any] = response.json()
        current = data["current_condition"][0]
    
        summary = {
            "city": city,
            "temp_c": current.get("temp_C"),
            "temp_f": current.get("temp_F"),
            "feels_like_c": current.get("FeelsLikeC"),
            "description": current.get("weatherDesc", [{}])[0].get("value"),
            "humidity": current.get("humidity"),
            "wind_kmph": current.get("windspeedKmph"),
        }
        return json.dumps(summary, indent=2)
  • server.py:79-79 (registration)
    The @mcp.tool() decorator registers the weather function as a tool with the FastMCP server.
    @mcp.tool()
  • The input schema is implicit via the function signature: 'city: str'. The output schema is the JSON structure defined inside the function with keys like city, temp_c, temp_f, feels_like_c, description, humidity, wind_kmph.
    def weather(city: str) -> str:
Behavior2/5

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

No annotations exist, so the description must fully disclose behavior. It only states the basic function, omitting details like error handling, data freshness, rate limits, or reliance on an external API.

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 one sentence of 10 words, very concise. However, it may be too brief given the lack of other documentation; a slightly longer description could improve clarity.

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?

For a simple one-parameter tool with an output schema, the description is minimally adequate. However, it fails to provide usage guidelines or behavioral context, leaving gaps for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The single parameter 'city' has no schema description (0% coverage) and the description adds no extra meaning, such as acceptable formats, examples, or whether coordinates are accepted.

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

Purpose5/5

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

The description clearly states it returns current weather for a city using a specific service (wttr.in). It distinguishes itself from sibling tools which handle files and databases.

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 is provided on when to use this tool or alternatives. While no other weather tools exist, the description lacks any context about prerequisites or appropriate use cases.

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/penguinszp001/mcp-server-demo'

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