Skip to main content
Glama

bus_arrival

Check real-time bus arrival times, locations, and crowding levels for Singapore bus stops using specific stop codes and optional service numbers.

Instructions

Get real-time bus arrival information for a specific bus stop and optionally a specific service number. Returns estimated arrival times, bus locations, and crowding levels.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
busStopCodeYesThe unique 5-digit bus stop code
serviceNoNoOptional bus service number to filter results

Implementation Reference

  • Handler for the 'bus_arrival' tool: extracts parameters, calls LTA BusArrival API v3, returns formatted JSON response or handles API errors.
    case "bus_arrival": {
      const { busStopCode, serviceNo } = request.params.arguments as {
        busStopCode: string;
        serviceNo?: string;
      };
    
      try {
        const response = await axios.get('https://datamall2.mytransport.sg/ltaodataservice/v3/BusArrival', {
          params: {
            BusStopCode: busStopCode,
            ...(serviceNo && { ServiceNo: serviceNo })
          },
          headers: {
            'AccountKey': process.env.LTA_API_KEY!,
            'accept': 'application/json'
          }
        });
        
        return {
          content: [{
            type: "text",
            text: JSON.stringify(response.data, null, 2)
          }]
        };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          return {
            content: [{
              type: "text", 
              text: `LTA API error: ${error.response?.data?.Message ?? error.message}`
            }],
            isError: true
          };
        }
        throw error;
      }
    }
  • Tool metadata and input schema definition for 'bus_arrival', used in tool listing response. Defines required busStopCode and optional serviceNo.
      name: "bus_arrival",
      description: "Get real-time bus arrival information for a specific bus stop and optionally a specific service number. Returns estimated arrival times, bus locations, and crowding levels.",
      inputSchema: {
        type: "object",
        properties: {
          busStopCode: {
            type: "string",
            description: "The unique 5-digit bus stop code"
          },
          serviceNo: {
            type: "string",
            description: "Optional bus service number to filter results"
          }
        },
        required: ["busStopCode"]
      }
    },
  • src/index.ts:47-130 (registration)
    Registration of all tools including 'bus_arrival' via the ListToolsRequestSchema handler.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [{
          name: "bus_arrival",
          description: "Get real-time bus arrival information for a specific bus stop and optionally a specific service number. Returns estimated arrival times, bus locations, and crowding levels.",
          inputSchema: {
            type: "object",
            properties: {
              busStopCode: {
                type: "string",
                description: "The unique 5-digit bus stop code"
              },
              serviceNo: {
                type: "string",
                description: "Optional bus service number to filter results"
              }
            },
            required: ["busStopCode"]
          }
        },
        {
          name: "station_crowding",
          description: "Get real-time MRT/LRT station crowdedness level for a particular train network line. Updates every 10 minutes.",
          inputSchema: {
            type: "object",
            properties: {
              trainLine: {
                type: "string",
                description: "Code of train network line (CCL, CEL, CGL, DTL, EWL, NEL, NSL, BPL, SLRT, PLRT, TEL)",
                enum: ["CCL", "CEL", "CGL", "DTL", "EWL", "NEL", "NSL", "BPL", "SLRT", "PLRT", "TEL"]
              }
            },
            required: ["trainLine"]
          }
        },
        {
          name: "train_alerts",
          description: "Get real-time train service alerts including service disruptions and shuttle services. Updates when there are changes.",
          inputSchema: {
            type: "object",
            properties: {} // No parameters needed
          }
        },
        {
          name: "carpark_availability",
          description: "Get real-time availability of parking lots for HDB, LTA, and URA carparks. Updates every minute.",
          inputSchema: {
            type: "object",
            properties: {} // No parameters needed
          }
        },
        {
          name: "travel_times",
          description: "Get estimated travel times on expressway segments. Updates every 5 minutes.",
          inputSchema: {
            type: "object",
            properties: {} // No parameters needed
          }
        },
        {
          name: "traffic_incidents",
          description: "Get current road incidents including accidents, roadworks, and heavy traffic. Updates every 2 minutes.",
          inputSchema: {
            type: "object",
            properties: {} // No parameters needed
          }
        },
        {
          name: "station_crowd_forecast",
          description: "Get forecasted MRT/LRT station crowdedness levels in 30-minute intervals.",
          inputSchema: {
            type: "object",
            properties: {
              trainLine: {
                type: "string",
                description: "Code of train network line (CCL, CEL, CGL, DTL, EWL, NEL, NSL, BPL, SLRT, PLRT, TEL)",
                enum: ["CCL", "CEL", "CGL", "DTL", "EWL", "NEL", "NSL", "BPL", "SLRT", "PLRT", "TEL"]
              }
            },
            required: ["trainLine"]
          }
        }]
      };
    });
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's behavior by mentioning it returns 'estimated arrival times, bus locations, and crowding levels,' which adds value beyond the input schema. However, it lacks details on rate limits, error handling, or data freshness, leaving some gaps.

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 a single sentence that efficiently conveys the tool's purpose, parameters, and return values without any wasted words. Every part of the description earns its place by adding essential information.

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 moderate complexity (2 parameters, no output schema, no annotations), the description is fairly complete. It covers the purpose, parameters, and return values adequately. However, without an output schema, it could benefit from more detail on the structure of returned data, such as format or examples, to fully compensate for the lack of structured output documentation.

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 100% description coverage, clearly documenting both parameters. The description adds marginal value by contextualizing the parameters as 'specific bus stop' and 'optional bus service number to filter results,' but it does not provide additional syntax or format details beyond what the schema already specifies.

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 specific verbs ('Get real-time bus arrival information') and resources ('bus stop', 'service number'), distinguishing it from sibling tools like carpark_availability or traffic_incidents by focusing on bus arrivals rather than other transportation data.

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 context by specifying 'for a specific bus stop and optionally a specific service number,' but it does not explicitly state when to use this tool versus alternatives or provide any exclusions. No guidance is given on prerequisites or comparisons with sibling tools.

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/arjunkmrm/mcp-sg-lta'

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