Skip to main content
Glama
kennyckk

KMB Bus MCP Server

find_stop_by_name

Search for KMB bus stops by entering a full or partial stop name to locate specific bus stops in Hong Kong.

Instructions

Find bus stops matching a name or partial name.

Args:
    stop_name: Full or partial name of the bus stop to search for

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stop_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'find_stop_by_name' tool. It uses the helper to find matching stops and formats the output as a readable string including IDs and locations.
    @mcp.tool()
    async def find_stop_by_name(stop_name: str) -> str:
        """Find bus stops matching a name or partial name.
        
        Args:
            stop_name: Full or partial name of the bus stop to search for
        """
        stops = await find_stops_by_name(stop_name)
        
        if not stops:
            return f"Could not find any stops matching '{stop_name}'"
        
        results = [f"Found {len(stops)} stops matching '{stop_name}':"]
        
        for i, stop in enumerate(stops, 1):
            stop_id = stop["stop"]
            name_en = stop["name_en"]
            name_tc = stop.get("name_tc", "")
            lat = stop.get("lat", 0)
            lng = stop.get("long", 0)
            
            if name_tc:
                results.append(f"{i}. {name_en} ({name_tc})")
            else:
                results.append(f"{i}. {name_en}")
            results.append(f"   ID: {stop_id}")
            results.append(f"   Location: {lat}, {lng}")
        
        return "\n".join(results)
  • Core helper function that performs case-insensitive partial matching on English and Chinese stop names from the full stop list.
    async def find_stops_by_name(
        name: str,
        *,
        get_stop_list_func: Callable[[], Awaitable[List]],
    ) -> List:
        stops = await get_stop_list_func()
        matching_stops: List[Dict[str, Any]] = []
    
        for stop in stops:
            if (
                name.lower() in stop["name_en"].lower()
                or (stop.get("name_tc") and name.lower() in stop["name_tc"].lower())
            ):
                matching_stops.append(stop)
    
        return matching_stops
  • kmb_mcp.py:281-281 (registration)
    The @mcp.tool() decorator registers the find_stop_by_name function as an MCP tool.
    @mcp.tool()
  • Thin wrapper in kmb_mcp.py that delegates to the utils helper, maintaining compatibility for tests.
    async def find_stops_by_name(name: str) -> List:
        """Delegate to shared implementation; keep signature for tests."""
        return await handle_utils.find_stops_by_name(
            name,
            get_stop_list_func=get_stop_list,
        )
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It describes a search operation but lacks details on permissions, rate limits, pagination, or return format. The description does not contradict annotations, but it provides minimal behavioral context beyond the basic operation, which is insufficient for a tool with no annotation coverage.

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 appropriately sized and front-loaded, with the first sentence stating the tool's purpose clearly. The second sentence provides essential parameter details without redundancy. Every sentence earns its place, making it efficient and well-structured.

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

Completeness4/5

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

Given the tool's low complexity (1 parameter) and the presence of an output schema (which handles return values), the description is largely complete. It covers purpose and parameter semantics adequately. However, the lack of behavioral details (e.g., search behavior, limitations) and usage guidelines slightly reduces completeness, though the output schema mitigates some gaps.

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

Parameters5/5

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

The description adds significant meaning beyond the input schema, which has 0% description coverage. It explicitly explains that 'stop_name' is for 'Full or partial name of the bus stop to search for', clarifying the parameter's purpose and usage, which compensates fully for the schema's lack of documentation.

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 the tool's purpose with a specific verb ('Find') and resource ('bus stops'), specifying it matches by 'name or partial name'. It distinguishes from siblings like 'get_all_routes_at_stop' (which focuses on routes) and 'find_buses_to_destination' (which focuses on buses), making it highly specific and differentiated.

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

Usage Guidelines3/5

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

The description implies usage for searching bus stops by name, but does not explicitly state when to use this tool versus alternatives like 'get_route_stops_info' (which might provide stop details within a route context) or 'get_all_routes_at_stop' (which focuses on routes at a specific stop). No exclusions or prerequisites are mentioned, leaving usage context somewhat inferred.

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/kennyckk/mcp_hkbus'

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