train_alerts
Get real-time alerts for Singapore train service disruptions and shuttle services. Receive updates when changes occur to help plan your commute.
Instructions
Get real-time train service alerts including service disruptions and shuttle services. Updates when there are changes.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "train_alerts"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:209-236 (handler)The handler for the 'train_alerts' tool. Fetches real-time train service alerts from the LTA DataMall API using axios and returns the JSON response or an error message.
case "train_alerts": { try { const response = await axios.get('https://datamall2.mytransport.sg/ltaodataservice/TrainServiceAlerts', { 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:82-89 (schema)The input schema and description for the 'train_alerts' tool, registered in the ListTools response. No input parameters are required.
{ 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 } },