carpark_availability
Check real-time parking lot availability for HDB, LTA, and URA carparks in Singapore. Get minute-by-minute updates to find parking spaces.
Instructions
Get real-time availability of parking lots for HDB, LTA, and URA carparks. Updates every minute.
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": "carpark_availability"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:238-265 (handler)The switch case handler that executes the carpark_availability tool. It fetches real-time car park availability data from the LTA DataMall API (CarParkAvailabilityv2 endpoint) using axios, handles the response by returning JSON-formatted data, and includes error handling for API errors.
case "carpark_availability": { try { const response = await axios.get('https://datamall2.mytransport.sg/ltaodataservice/CarParkAvailabilityv2', { 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:90-97 (registration)Registration of the carpark_availability tool in the ListToolsRequestSchema handler. Defines the tool name, description, and input schema (no required parameters). This makes the tool discoverable by MCP clients.
{ name: "carpark_availability", description: "Get real-time availability of parking lots for HDB, LTA, and URA carparks. Updates every minute.", inputSchema: { type: "object", properties: {} // No parameters needed } },