mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 19:04:02 +00:00
Report unsupported military track history in get_aircraft_track
The standalone military source no longer has getTrack, so the MCP get_aircraft_track tool threw a TypeError and MCP advised a retry. It now returns an `unsupported` ToolError when the selected feed has no getTrack, while custom sources that supply history still work. Tests cover the default composition through the catalog and MCP. Also drop the unused epoch import and update the CURRENT-STATE track sections to describe local trails and 503 history_unavailable. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
98af799cb4
commit
730ba57073
4 files changed
+73
-10
No files matched your search
@@ -333,13 +333,20 @@ export const getAircraftTrack = defineTool({
|
||||
requires: ['aircraft'],
|
||||
async run(args, { services, signal }) {
|
||||
const icao24 = args.icao24.toLowerCase();
|
||||
const source = feedFor(services, args.military);
|
||||
// History is optional: the standalone military source has none.
|
||||
if (typeof source.getTrack !== 'function')
|
||||
throw new ToolError(
|
||||
'unsupported',
|
||||
args.military
|
||||
? 'Track history is not available for the military aircraft feed'
|
||||
: 'Track history is not available for the aircraft feed',
|
||||
);
|
||||
// A track server answers 404 for an aircraft it has no positions for.
|
||||
const track = await feedFor(services, args.military)
|
||||
.getTrack(icao24, { signal })
|
||||
.catch((error) => {
|
||||
if (error?.status === 404) return { records: [] };
|
||||
throw error;
|
||||
});
|
||||
const track = await source.getTrack(icao24, { signal }).catch((error) => {
|
||||
if (error?.status === 404) return { records: [] };
|
||||
throw error;
|
||||
});
|
||||
const points = [...track.records].sort(
|
||||
(a, b) => a.observedAtMs - b.observedAtMs,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user