train_alerts
Receive real-time alerts for Singapore train service disruptions and shuttle service updates, ensuring timely notifications for changes in train operations.
Instructions
Get real-time train service alerts including service disruptions and shuttle services. Updates when there are changes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/index.ts:209-236 (handler)Handler for the 'train_alerts' tool. Fetches real-time train service alerts from the LTA DataMall API endpoint and returns the JSON response, with error handling for API errors.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 (registration)Registration of the 'train_alerts' tool in the ListTools response, including its name, description, and input schema (no parameters 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 } },
- src/index.ts:85-88 (schema)Input schema for the 'train_alerts' tool, defining an empty object (no input parameters needed).inputSchema: { type: "object", properties: {} // No parameters needed }