station_crowd_forecast
Predict MRT/LRT station crowdedness levels in 30-minute intervals for specific train lines in Singapore, enabling better trip planning and crowd management.
Instructions
Get forecasted MRT/LRT station crowdedness levels in 30-minute intervals.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| trainLine | Yes | Code of train network line (CCL, CEL, CGL, DTL, EWL, NEL, NSL, BPL, SLRT, PLRT, TEL) |
Implementation Reference
- src/index.ts:325-359 (handler)Handler function for executing the 'station_crowd_forecast' tool. Extracts 'trainLine' argument, fetches forecast data from LTA DataMall API (PCDForecast endpoint), and returns formatted JSON response or error.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; } }
- src/index.ts:114-128 (registration)Tool registration in the ListTools response, defining name, description, and input schema requiring 'trainLine' with specific enum values.{ 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"] } }]
- src/index.ts:117-127 (schema)Input schema definition for the 'station_crowd_forecast' tool, specifying the required 'trainLine' parameter with enum validation.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"] }