Skip to main content
Glama
Bigred97

au-weather-mcp

search_locations

Find Australian locations by name or state code. Returns location IDs and details for the 21 curated cities, including capitals and major regional centres.

Instructions

Fuzzy-search the 21 curated Australian locations.

The curated set covers all 8 state/territory capitals plus 13 major regional centres (Newcastle, Wollongong, Gold Coast, Sunshine Coast, Cairns, Townsville, Mackay, Geelong, Ballarat, Bendigo, Launceston, Alice Springs, Broome).

Examples: results = await search_locations("sydney") # → [{id: 'sydney', name: 'Sydney', state: 'NSW', ...}]

results = await search_locations("nsw")
# → Newcastle, Wollongong, Sydney (all NSW locations)

When to use: - Discover the location ID for a city you know by name - Find all supported locations in a state - Verify whether a place is in the curated set before calling get_weather

Returns: List of LocationSummary (id, name, state, description), ranked by relevance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesFree-text search query. Matches against location IDs, names, and state codes. Case-insensitive.
limitNoMaximum number of results to return, ranked by relevance.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Main tool handler for search_locations. Validates query (must be non-empty string) and limit (must be positive int), then delegates to curated_mod.search() for fuzzy matching. Returns list of LocationSummary objects.
    @mcp.tool
    async def search_locations(
        query: Annotated[
            str,
            Field(
                description=(
                    "Free-text search query. Matches against location IDs, names, "
                    "and state codes. Case-insensitive."
                ),
                examples=["sydney", "nsw", "tropical north", "gold coast", "tasmania"],
            ),
        ],
        limit: Annotated[
            int,
            Field(
                description="Maximum number of results to return, ranked by relevance.",
                examples=[5, 10, 21],
                ge=1,
                le=100,
            ),
        ] = 10,
    ) -> list[LocationSummary]:
        """Fuzzy-search the 21 curated Australian locations.
    
        The curated set covers all 8 state/territory capitals plus 13 major
        regional centres (Newcastle, Wollongong, Gold Coast, Sunshine Coast,
        Cairns, Townsville, Mackay, Geelong, Ballarat, Bendigo, Launceston,
        Alice Springs, Broome).
    
        Examples:
            results = await search_locations("sydney")
            # → [{id: 'sydney', name: 'Sydney', state: 'NSW', ...}]
    
            results = await search_locations("nsw")
            # → Newcastle, Wollongong, Sydney (all NSW locations)
    
        When to use:
            - Discover the location ID for a city you know by name
            - Find all supported locations in a state
            - Verify whether a place is in the curated set before calling get_weather
    
        Returns:
            List of LocationSummary (id, name, state, description), ranked by
            relevance.
        """
        if not isinstance(query, str):
            raise ValueError(
                f"query must be a string, got {type(query).__name__}. "
                "Try 'sydney', 'nsw', 'tropical', or another place name."
            )
        if not query.strip():
            raise ValueError(
                "query is required. Try 'sydney', 'nsw', 'tropical', "
                "or any Australian place name."
            )
        if isinstance(limit, bool) or not isinstance(limit, int):
            raise ValueError(
                f"limit must be a positive integer, got {limit!r} ({type(limit).__name__})."
            )
        if limit < 1:
            raise ValueError(f"limit must be >= 1, got {limit}.")
        matches = curated_mod.search(query, limit=limit)
        return [
            LocationSummary(
                id=m.id,
                name=m.name,
                state=m.state,
                description=m.description,
            )
            for m in matches
        ]
  • Return type schema for search_locations. Contains id, name, state, and optional description.
    class LocationSummary(BaseModel):
        """A curated AU location — surface for search_locations and list_curated."""
        id: str
        name: str
        state: str  # NSW, VIC, etc.
        description: str | None = None
  • Core fuzzy-search logic using rapidfuzz. Builds a haystack from id+name+state+description, applies WRatio scorer, deduplicates results, and returns up to limit matches.
    def search(query: str, limit: int = 10) -> list[CuratedLocation]:
        """Fuzzy-search the curated location set.
    
        Matches against id + name + state so 'syd', 'Sydney', 'NSW' all work.
        Returns up to `limit` rows ranked by score.
        """
        locs = all_locations()
        # Each haystack entry is "id name state description" — wide enough for
        # broad queries like 'tropical north qld' to hit Cairns/Townsville.
        haystack = {
            i: f"{loc.id} {loc.name} {loc.state} {loc.description or ''}".lower()
            for i, loc in enumerate(locs)
        }
        matches = process.extract(
            query.lower(), haystack, scorer=fuzz.WRatio, limit=max(limit * 2, 20)
        )
        seen: set[int] = set()
        out: list[CuratedLocation] = []
        for _hay, _score, idx in matches:
            if idx in seen:
                continue
            seen.add(idx)
            out.append(locs[idx])
            if len(out) >= limit:
                break
        return out
  • Tool registration via the @mcp.tool decorator (FastMCP) on the search_locations handler function.
    @mcp.tool
Behavior4/5

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

With no annotations, the description clearly explains the fuzzy-search behavior, matching against IDs, names, and state codes, returning ranked results. It could mention that results are limited by the limit parameter, but overall it's transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a one-line summary, curated set details, code examples, when-to-use, and returns. Every sentence adds value, and it is not verbose.

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

Completeness5/5

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

Given the output schema exists, the description appropriately summarizes return types (LocationSummary with fields). It also provides context about the 21 curated locations and typical use cases, making it complete for the tool's complexity.

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

Parameters4/5

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

Schema coverage is 100% with descriptions and examples, but the description adds value by showing code examples (e.g., 'sydney', 'nsw') and explaining that query matches various fields. This goes beyond the schema's structured info.

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 performs fuzzy-search on a curated set of 21 Australian locations. It distinguishes from siblings like list_curated (which lists all) and get_weather (which requires a location ID).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The 'When to use' section provides three specific scenarios (discover location ID, find locations in a state, verify before get_weather). However, it does not explicitly contrast with sibling tools like describe_location or mention when not to use.

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/Bigred97/au-weather-mcp'

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