traffic_incidents
Access real-time updates on road incidents like accidents, roadworks, and heavy traffic in Singapore, refreshed every 2 minutes for accurate on-the-go insights.
Instructions
Get current road incidents including accidents, roadworks, and heavy traffic. Updates every 2 minutes.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:296-323 (handler)Handler logic for the 'traffic_incidents' tool. Calls the LTA TrafficIncidents API, returns the JSON response or an error message if the API call fails.case "traffic_incidents": { try { const response = await axios.get('https://datamall2.mytransport.sg/ltaodataservice/TrafficIncidents', { 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:106-113 (registration)Registration of the 'traffic_incidents' tool in the list of available tools, including its description and input schema (no required parameters).{ 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 } },