travel_times
Access real-time estimated travel times for expressway segments in Singapore, updated every 5 minutes, to optimize route planning and monitor traffic conditions effectively.
Instructions
Get estimated travel times on expressway segments. Updates every 5 minutes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- src/index.ts:267-294 (handler)Handler for the 'travel_times' tool that fetches estimated travel times from the LTA EstTravelTimes API endpoint and returns the JSON response or error.case "travel_times": { try { const response = await axios.get('https://datamall2.mytransport.sg/ltaodataservice/EstTravelTimes', { 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:98-105 (schema)Schema and registration for the 'travel_times' tool, defining its name, description, and input schema (no required parameters).{ name: "travel_times", description: "Get estimated travel times on expressway segments. Updates every 5 minutes.", inputSchema: { type: "object", properties: {} // No parameters needed } },