Skip to main content
Glama

station_crowd_forecast

Forecast MRT/LRT station crowdedness levels in 30-minute intervals to plan travel and avoid peak congestion.

Instructions

Get forecasted MRT/LRT station crowdedness levels in 30-minute intervals.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
trainLineYesCode of train network line (CCL, CEL, CGL, DTL, EWL, NEL, NSL, BPL, SLRT, PLRT, TEL)

Implementation Reference

  • The handler function for the 'station_crowd_forecast' tool. It extracts the 'trainLine' argument, makes an API call to LTA's PCDForecast endpoint, and returns the JSON response or an error message.
    case "station_crowd_forecast": {
      const { trainLine } = request.params.arguments as {
        trainLine: string;
      };
    
      try {
        const response = await axios.get('https://datamall2.mytransport.sg/ltaodataservice/PCDForecast', {
          params: {
            TrainLine: trainLine
          },
          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;
      }
    }
  • Input schema for the 'station_crowd_forecast' tool, defining the required 'trainLine' parameter with allowed enum values.
    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"]
    }
  • src/index.ts:114-128 (registration)
    Registration of the 'station_crowd_forecast' tool in the ListTools response, including name, description, and input schema.
    {
      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"]
      }
    }]

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