Skip to main content
Glama
Pranav-Karra-3301

CATA Bus MCP Server

trip_alerts_tool

Retrieve real-time service alerts for CATA bus routes to stay informed about delays, detours, and schedule changes.

Instructions

Get current service alerts.

Args: route_id: Optional route ID to filter alerts (if None, returns all)

Returns: List of alerts with route ID, header, description, and severity

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
route_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Primary handler function for the 'trip_alerts_tool' MCP tool. Registered via @mcp.tool decorator. Ensures GTFS data initialization and calls the helper function to retrieve filtered alerts.
    @mcp.tool
    async def trip_alerts_tool(route_id: str | None = None) -> list[dict[str, Any]]:
        """Get current service alerts.
    
        Args:
            route_id: Optional route ID to filter alerts (if None, returns all)
    
        Returns:
            List of alerts with route ID, header, description, and severity
        """
        await ensure_initialized()
        return await trip_alerts(realtime_poller.data, route_id)
  • Core implementation logic for extracting, filtering (by route_id), and formatting service alerts from GTFS realtime data's alerts list.
    async def trip_alerts(
        realtime_data: RealtimeData, route_id: str | None = None
    ) -> list[dict[str, Any]]:
        """
        Get current service alerts.
    
        Args:
            realtime_data: The GTFS realtime data.
            route_id: Optional route ID to filter alerts (if None, returns all).
    
        Returns:
            List of alerts with route ID, header, description, and severity.
        """
        alerts = []
    
        for alert in realtime_data.alerts:
            # Check if this alert is relevant to the requested route
            if route_id:
                relevant = False
                for entity in alert.informed_entities:
                    if entity.get("route_id") == route_id:
                        relevant = True
                        break
                if not relevant:
                    continue
    
            # Get affected route IDs
            affected_routes = []
            for entity in alert.informed_entities:
                if "route_id" in entity:
                    affected_routes.append(entity["route_id"])
    
            alerts.append(
                {
                    "route_id": affected_routes[0] if len(affected_routes) == 1 else None,
                    "affected_routes": affected_routes,
                    "header": alert.header,
                    "description": alert.description,
                    "severity": alert.severity,
                }
            )
    
        return alerts
Behavior3/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. It discloses that the tool retrieves 'current' alerts, implying real-time or recent data, and mentions the return format. However, it lacks details on rate limits, authentication needs, data freshness, or error handling, which are important for behavioral understanding.

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 well-structured and front-loaded with the purpose, followed by parameter and return details. It uses minimal sentences that earn their place, though the 'Args:' and 'Returns:' sections could be integrated more seamlessly into the flow for slightly better conciseness.

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 optional parameter) and the presence of an output schema (which handles return values), the description is reasonably complete. It covers the purpose, parameter semantics, and return structure, though it could benefit from more behavioral context like data sources or update frequency.

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?

The schema description coverage is 0%, so the description must compensate. It explains the 'route_id' parameter as 'Optional route ID to filter alerts (if None, returns all)', adding clear meaning beyond the schema. This adequately covers the single parameter, though it doesn't specify format or examples.

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 tool's purpose: 'Get current service alerts.' It specifies the verb ('Get') and resource ('service alerts'), making the function unambiguous. However, it doesn't explicitly differentiate this tool from its siblings (e.g., 'list_routes_tool'), which prevents a perfect score.

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?

The description provides no guidance on when to use this tool versus alternatives. It mentions an optional 'route_id' parameter for filtering but doesn't explain scenarios where filtering is beneficial or when other tools might be more appropriate. This lack of contextual guidance limits its utility for an AI agent.

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/Pranav-Karra-3301/catabus-mcp'

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