Skip to content

Commit a905999

Browse files
committed
add map links in the output for planes
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
1 parent d15d537 commit a905999

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

readsb_mcp_server.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,14 @@ def _format_aircraft_summary(self, aircraft_list: List[Dict], full_data: Dict) -
300300
altitude = aircraft.get("alt_baro", "Unknown")
301301
distance = aircraft.get("r_dst", "Unknown")
302302

303-
summary += f"{i + 1:2d}. {callsign:<8} ({hex_code}) Alt: {altitude} ft, Dist: {distance} nm\n"
303+
summary += f"{i + 1:2d}. {callsign:<8} ({hex_code})\n"
304+
305+
# Add map link if hex code is available
306+
if hex_code != "Unknown":
307+
map_link = f"{self.web_base}/?icao={hex_code}"
308+
summary += f" Map Link: {map_link}\n"
309+
310+
summary += f" Alt: {altitude} ft, Dist: {distance} nm\n"
304311

305312
if total_aircraft > 10:
306313
summary += f"... and {total_aircraft - 10} more aircraft\n"
@@ -398,8 +405,15 @@ async def _search_aircraft(self, args: Dict[str, Any]) -> List[TextContent]:
398405

399406
result += f"Callsign: {callsign}\n"
400407
result += f"Hex: {hex_code}\n"
408+
409+
# Add map link if hex code is available
410+
if hex_code != "Unknown":
411+
map_link = f"{self.web_base}/?icao={hex_code}"
412+
result += f"Map Link: {map_link}\n"
413+
401414
result += f"Altitude: {altitude} ft\n"
402415
result += f"Position: {lat}, {lon}\n"
416+
403417
result += "-" * 30 + "\n"
404418

405419
return [TextContent(type="text", text=result)]
@@ -553,11 +567,18 @@ async def _get_closest_aircraft(self, args: Dict[str, Any]) -> List[TextContent]
553567
lon = aircraft.get("lon", "Unknown")
554568

555569
result += f"{i}. {callsign:<10} ({hex_code})\n"
570+
571+
# Add map link if hex code is available
572+
if hex_code != "Unknown":
573+
map_link = f"{self.web_base}/?icao={hex_code}"
574+
result += f" Map Link: {map_link}\n"
575+
556576
result += f" Distance: {distance:.1f} nm\n"
557577
result += f" Altitude: {altitude} ft\n"
558578
result += f" Speed: {speed} kts\n"
559579
result += f" Track: {track}°\n"
560580
result += f" Position: {lat:.4f}, {lon:.4f}\n"
581+
561582
result += "-" * 50 + "\n"
562583

563584
return [TextContent(type="text", text=result)]
@@ -651,12 +672,19 @@ async def _get_aircraft_by_direction(self, args: Dict[str, Any]) -> List[TextCon
651672
lon = aircraft.get("lon", "Unknown")
652673

653674
result += f"{i}. {callsign:<10} ({hex_code})\n"
675+
676+
# Add map link if hex code is available
677+
if hex_code != "Unknown":
678+
map_link = f"{self.web_base}/?icao={hex_code}"
679+
result += f" Map Link: {map_link}\n"
680+
654681
result += f" Distance: {distance:.1f} nm\n"
655682
result += f" Bearing: {bearing:.1f}°\n"
656683
result += f" Altitude: {altitude} ft\n"
657684
result += f" Speed: {speed} kts\n"
658685
result += f" Track: {track}°\n"
659686
result += f" Position: {lat:.4f}, {lon:.4f}\n"
687+
660688
result += "-" * 50 + "\n"
661689

662690
return [TextContent(type="text", text=result)]

0 commit comments

Comments
 (0)