This skill provides real-time and scheduled arrival information for TPER buses in Bologna and Ferrara by querying the official Hellobus API.
Use this skill when the user:
The skill queries the TPER Hellobus API with three parameters:
Critical Logic:
oraHHMM is omitted or empty, the API returns real-time GPS tracking dataoraHHMM is provided, the API returns scheduled arrivals for that timeGET https://hellobuswsweb.tper.it/web-services/hellobus.asmx/QueryHellobus
fermata: Stop code (string, numeric)linea: Line number (string, numeric)oraHHMM: Time in HHmm format (string, optional - leave empty for real-time)Real-time tracking (GPS):
https://hellobuswsweb.tper.it/web-services/hellobus.asmx/QueryHellobus?fermata=4476&linea=11&oraHHMM=
Scheduled times:
https://hellobuswsweb.tper.it/web-services/hellobus.asmx/QueryHellobus?fermata=4476&linea=11&oraHHMM=1830
The API returns a response like:
TperHellobus: 11B DaSatellite 18:02 (Bus1634 CON PEDANA), 11B DaSatellite 18:18 (Bus5504 CON PEDANA)
Components:
Extract from the user's query:
If the user provides a time:
Time conversion examples:
Use the bash_tool with curl to call the API (web_fetch has URL restrictions):
# For real-time (no time specified):
curl "https://hellobuswsweb.tper.it/web-services/hellobus.asmx/QueryHellobus?fermata={stop_code}&linea={line_number}&oraHHMM="
# For scheduled time:
curl "https://hellobuswsweb.tper.it/web-services/hellobus.asmx/QueryHellobus?fermata={stop_code}&linea={line_number}&oraHHMM={time_hhmm}"
Important: Ensure proper URL encoding and handle the XML/text response from the API.
The API response is plain text. Parse it and format as a bullet list:
Input: TperHellobus: 11B DaSatellite 18:02 (Bus1634 CON PEDANA), 11B DaSatellite 18:18 (Bus5504 CON PEDANA)
Output format:
Bus arrivals for line 11 at stop 4476:
• 11B DaSatellite 18:02 (Bus1634 CON PEDANA)
• 11B DaSatellite 18:18 (Bus5504 CON PEDANA)
Split on commas and present each arrival as a bullet point.
If the API returns an error or unexpected response:
Common errors might include:
Example 1: Real-time tracking
User: "When is the next bus 11 arriving at stop 4476?"
Claude: [Queries API with oraHHMM empty]
Response:
Bus arrivals for line 11 at stop 4476 (real-time):
• 11B DaSatellite 18:02 (Bus1634 CON PEDANA)
• 11B DaSatellite 18:18 (Bus5504 CON PEDANA)
Example 2: Scheduled time
User: "Check the schedule for bus 27 at stop 8001 for 6:30 PM"
Claude: [Queries API with oraHHMM=1830]
Response:
Bus arrivals for line 27 at stop 8001 at 18:30:
• 27 Orario 18:35 (Bus2045)
• 27 Orario 18:50 (Bus3012)
Example 3: Error handling
User: "Bus 99 at stop 1234"
Claude: [Queries API, receives error]
Response: "I couldn't find bus 99 at stop 1234. Please verify the stop code and line number are correct for the TPER network."
Test cases to verify the skill works:
共 1 个版本