onebusaway-mcp-server 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +367 -0
- package/Dockerfile +99 -0
- package/LICENSE +201 -0
- package/README.md +322 -0
- package/changelog/0.1.x/0.1.0.md +15 -0
- package/changelog/0.1.x/0.1.1.md +17 -0
- package/changelog/template.md +119 -0
- package/dist/config/server-config.d.ts +13 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +26 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/route.resource.d.ts +9 -0
- package/dist/mcp-server/resources/definitions/route.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/route.resource.js +33 -0
- package/dist/mcp-server/resources/definitions/route.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/stop.resource.d.ts +9 -0
- package/dist/mcp-server/resources/definitions/stop.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/stop.resource.js +33 -0
- package/dist/mcp-server/resources/definitions/stop.resource.js.map +1 -0
- package/dist/mcp-server/tools/definitions/find-routes.tool.d.ts +24 -0
- package/dist/mcp-server/tools/definitions/find-routes.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/find-routes.tool.js +72 -0
- package/dist/mcp-server/tools/definitions/find-routes.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/find-stops.tool.d.ts +28 -0
- package/dist/mcp-server/tools/definitions/find-stops.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/find-stops.tool.js +76 -0
- package/dist/mcp-server/tools/definitions/find-stops.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-arrivals.tool.d.ts +49 -0
- package/dist/mcp-server/tools/definitions/get-arrivals.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-arrivals.tool.js +176 -0
- package/dist/mcp-server/tools/definitions/get-arrivals.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-route.tool.d.ts +25 -0
- package/dist/mcp-server/tools/definitions/get-route.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-route.tool.js +60 -0
- package/dist/mcp-server/tools/definitions/get-route.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-schedule-for-route.tool.d.ts +31 -0
- package/dist/mcp-server/tools/definitions/get-schedule-for-route.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-schedule-for-route.tool.js +107 -0
- package/dist/mcp-server/tools/definitions/get-schedule-for-route.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-schedule-for-stop.tool.d.ts +31 -0
- package/dist/mcp-server/tools/definitions/get-schedule-for-stop.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-schedule-for-stop.tool.js +105 -0
- package/dist/mcp-server/tools/definitions/get-schedule-for-stop.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-stop.tool.d.ts +28 -0
- package/dist/mcp-server/tools/definitions/get-stop.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-stop.tool.js +57 -0
- package/dist/mcp-server/tools/definitions/get-stop.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-trip.tool.d.ts +42 -0
- package/dist/mcp-server/tools/definitions/get-trip.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-trip.tool.js +143 -0
- package/dist/mcp-server/tools/definitions/get-trip.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-vehicles.tool.d.ts +34 -0
- package/dist/mcp-server/tools/definitions/get-vehicles.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-vehicles.tool.js +117 -0
- package/dist/mcp-server/tools/definitions/get-vehicles.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/list-agencies.tool.d.ts +23 -0
- package/dist/mcp-server/tools/definitions/list-agencies.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/list-agencies.tool.js +58 -0
- package/dist/mcp-server/tools/definitions/list-agencies.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/list-routes-for-agency.tool.d.ts +25 -0
- package/dist/mcp-server/tools/definitions/list-routes-for-agency.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/list-routes-for-agency.tool.js +71 -0
- package/dist/mcp-server/tools/definitions/list-routes-for-agency.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-routes.tool.d.ts +26 -0
- package/dist/mcp-server/tools/definitions/search-routes.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-routes.tool.js +68 -0
- package/dist/mcp-server/tools/definitions/search-routes.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-stops.tool.d.ts +25 -0
- package/dist/mcp-server/tools/definitions/search-stops.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-stops.tool.js +61 -0
- package/dist/mcp-server/tools/definitions/search-stops.tool.js.map +1 -0
- package/dist/services/onebusaway/onebusaway-service.d.ts +64 -0
- package/dist/services/onebusaway/onebusaway-service.d.ts.map +1 -0
- package/dist/services/onebusaway/onebusaway-service.js +441 -0
- package/dist/services/onebusaway/onebusaway-service.js.map +1 -0
- package/dist/services/onebusaway/types.d.ts +147 -0
- package/dist/services/onebusaway/types.d.ts.map +1 -0
- package/dist/services/onebusaway/types.js +6 -0
- package/dist/services/onebusaway/types.js.map +1 -0
- package/package.json +90 -0
- package/server.json +127 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Real-time vehicle positions for all active vehicles for an agency.
|
|
3
|
+
* @module mcp-server/tools/definitions/get-vehicles.tool
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getOneBusAwayService } from '../../../services/onebusaway/onebusaway-service.js';
|
|
8
|
+
/** Format Unix milliseconds as HH:MM. */
|
|
9
|
+
function fmtTime(ms) {
|
|
10
|
+
if (!ms && ms !== 0)
|
|
11
|
+
return 'N/A';
|
|
12
|
+
const d = new Date(ms);
|
|
13
|
+
const h = d.getHours().toString().padStart(2, '0');
|
|
14
|
+
const m = d.getMinutes().toString().padStart(2, '0');
|
|
15
|
+
return `${h}:${m}`;
|
|
16
|
+
}
|
|
17
|
+
export const getVehicles = tool('onebusaway_get_vehicles', {
|
|
18
|
+
title: 'Get Real-Time Vehicle Positions',
|
|
19
|
+
description: 'Real-time positions of all active vehicles for an agency. Optionally filter to a single route (client-side). Returns GPS coordinates, heading, schedule deviation, and current trip. Useful for "where are all the buses on route X right now?" Use agencyId values from onebusaway_list_agencies.',
|
|
20
|
+
annotations: { readOnlyHint: true },
|
|
21
|
+
input: z.object({
|
|
22
|
+
agencyId: z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.describe('Agency ID (e.g. "1" for Metro Transit, "40" for Sound Transit). Use onebusaway_list_agencies to discover IDs.'),
|
|
26
|
+
routeId: z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Optional agency-prefixed route ID to filter results to one route. Filtering is client-side — all agency vehicles are fetched first.'),
|
|
30
|
+
}),
|
|
31
|
+
output: z.object({
|
|
32
|
+
vehicles: z
|
|
33
|
+
.array(z
|
|
34
|
+
.object({
|
|
35
|
+
vehicleId: z.string().describe('Vehicle ID.'),
|
|
36
|
+
tripId: z.string().nullable().describe('Current trip ID, or null if not on a trip.'),
|
|
37
|
+
routeId: z.string().nullable().describe('Current route ID, or null.'),
|
|
38
|
+
routeShortName: z.string().nullable().describe('Route short name, or null.'),
|
|
39
|
+
tripHeadsign: z.string().nullable().describe('Destination sign text, or null.'),
|
|
40
|
+
position: z
|
|
41
|
+
.object({
|
|
42
|
+
lat: z.number().describe('Vehicle latitude.'),
|
|
43
|
+
lon: z.number().describe('Vehicle longitude.'),
|
|
44
|
+
})
|
|
45
|
+
.describe('Current GPS position.'),
|
|
46
|
+
lastUpdateTime: z
|
|
47
|
+
.number()
|
|
48
|
+
.describe('Timestamp of the last position update as Unix milliseconds.'),
|
|
49
|
+
phase: z
|
|
50
|
+
.string()
|
|
51
|
+
.describe('Current journey phase (e.g. "in_progress", "layover_before").'),
|
|
52
|
+
scheduleDeviation: z
|
|
53
|
+
.number()
|
|
54
|
+
.nullable()
|
|
55
|
+
.describe('Seconds late (positive) or early (negative), or null.'),
|
|
56
|
+
orientation: z
|
|
57
|
+
.number()
|
|
58
|
+
.nullable()
|
|
59
|
+
.describe('Heading in degrees (0=north, 90=east), or null.'),
|
|
60
|
+
nextStop: z.string().nullable().describe('Stop ID of the next stop, or null.'),
|
|
61
|
+
predicted: z
|
|
62
|
+
.boolean()
|
|
63
|
+
.describe('True if this vehicle is reporting real-time GPS data.'),
|
|
64
|
+
})
|
|
65
|
+
.describe('A real-time vehicle position entry.'))
|
|
66
|
+
.describe('Active vehicles for the agency, optionally filtered by route.'),
|
|
67
|
+
}),
|
|
68
|
+
errors: [
|
|
69
|
+
{
|
|
70
|
+
reason: 'agency_not_found',
|
|
71
|
+
code: JsonRpcErrorCode.NotFound,
|
|
72
|
+
when: 'Agency ID does not exist on this instance.',
|
|
73
|
+
recovery: 'Use onebusaway_list_agencies to get valid agency IDs for this instance.',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
async handler(input, ctx) {
|
|
77
|
+
const vehicles = await getOneBusAwayService().getVehicles({
|
|
78
|
+
agencyId: input.agencyId,
|
|
79
|
+
...(input.routeId && { routeId: input.routeId }),
|
|
80
|
+
}, ctx);
|
|
81
|
+
ctx.log.info('getVehicles completed', { agencyId: input.agencyId, count: vehicles.length });
|
|
82
|
+
return { vehicles };
|
|
83
|
+
},
|
|
84
|
+
format: (result) => {
|
|
85
|
+
if (result.vehicles.length === 0) {
|
|
86
|
+
return [{ type: 'text', text: 'No active vehicles found.' }];
|
|
87
|
+
}
|
|
88
|
+
const lines = [`**Active vehicles:** ${result.vehicles.length}`];
|
|
89
|
+
for (const v of result.vehicles) {
|
|
90
|
+
lines.push(`\n## Vehicle ${v.vehicleId}`);
|
|
91
|
+
if (v.routeShortName) {
|
|
92
|
+
lines.push(`**Route:** ${v.routeShortName}${v.tripHeadsign ? ` → ${v.tripHeadsign}` : ''}`);
|
|
93
|
+
}
|
|
94
|
+
if (v.routeId)
|
|
95
|
+
lines.push(`**Route ID:** ${v.routeId}`);
|
|
96
|
+
if (v.tripId)
|
|
97
|
+
lines.push(`**Trip ID:** ${v.tripId}`);
|
|
98
|
+
lines.push(`**Position:** ${v.position.lat.toFixed(5)}, ${v.position.lon.toFixed(5)}`);
|
|
99
|
+
lines.push(`**Phase:** ${v.phase} | **Predicted:** ${v.predicted}`);
|
|
100
|
+
if (v.scheduleDeviation != null) {
|
|
101
|
+
const devLabel = v.scheduleDeviation === 0
|
|
102
|
+
? 'on time'
|
|
103
|
+
: v.scheduleDeviation > 0
|
|
104
|
+
? `${Math.round(v.scheduleDeviation / 60)} min late`
|
|
105
|
+
: `${Math.round(Math.abs(v.scheduleDeviation) / 60)} min early`;
|
|
106
|
+
lines.push(`**Schedule deviation:** ${devLabel} (${v.scheduleDeviation}s)`);
|
|
107
|
+
}
|
|
108
|
+
if (v.orientation != null)
|
|
109
|
+
lines.push(`**Heading:** ${v.orientation}°`);
|
|
110
|
+
if (v.nextStop)
|
|
111
|
+
lines.push(`**Next stop:** ${v.nextStop}`);
|
|
112
|
+
lines.push(`**Last update:** ${fmtTime(v.lastUpdateTime)} (${v.lastUpdateTime})`);
|
|
113
|
+
}
|
|
114
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
//# sourceMappingURL=get-vehicles.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-vehic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BAAgB,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC;YACxE,IAAI,CAAC,CAAC,QAAQ;gBAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC3D,KAAK,CAAC,IAAI,CAAC,oBAAoB,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview List all transit agencies on this OneBusAway instance.
|
|
3
|
+
* @module mcp-server/tools/definitions/list-agencies.tool
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export declare const listAgencies: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
7
|
+
agencies: z.ZodArray<z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
name: z.ZodString;
|
|
10
|
+
url: z.ZodString;
|
|
11
|
+
phone: z.ZodNullable<z.ZodString>;
|
|
12
|
+
timezone: z.ZodString;
|
|
13
|
+
coverageCenter: z.ZodObject<{
|
|
14
|
+
lat: z.ZodNumber;
|
|
15
|
+
lon: z.ZodNumber;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
coverageSpan: z.ZodObject<{
|
|
18
|
+
latSpan: z.ZodNumber;
|
|
19
|
+
lonSpan: z.ZodNumber;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
}, z.core.$strip>, undefined>;
|
|
23
|
+
//# sourceMappingURL=list-agencies.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-agencies.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-agencies.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGjD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;6BAwDvB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview List all transit agencies on this OneBusAway instance.
|
|
3
|
+
* @module mcp-server/tools/definitions/list-agencies.tool
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { getOneBusAwayService } from '../../../services/onebusaway/onebusaway-service.js';
|
|
7
|
+
export const listAgencies = tool('onebusaway_list_agencies', {
|
|
8
|
+
title: 'List Transit Agencies',
|
|
9
|
+
description: 'List all transit agencies served by this OneBusAway instance. Returns agency IDs, names, contact info, timezone, and geographic coverage center. Agency IDs are needed for onebusaway_list_routes_for_agency and onebusaway_get_vehicles.',
|
|
10
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
11
|
+
input: z.object({}),
|
|
12
|
+
output: z.object({
|
|
13
|
+
agencies: z
|
|
14
|
+
.array(z
|
|
15
|
+
.object({
|
|
16
|
+
id: z.string().describe('Agency ID used in other calls (e.g. "1" for Metro Transit).'),
|
|
17
|
+
name: z.string().describe('Full agency name.'),
|
|
18
|
+
url: z.string().describe('Agency website URL.'),
|
|
19
|
+
phone: z.string().nullable().describe('Agency phone number, or null if not provided.'),
|
|
20
|
+
timezone: z.string().describe('Agency timezone (e.g. "America/Los_Angeles").'),
|
|
21
|
+
coverageCenter: z
|
|
22
|
+
.object({
|
|
23
|
+
lat: z.number().describe('Latitude of the coverage center.'),
|
|
24
|
+
lon: z.number().describe('Longitude of the coverage center.'),
|
|
25
|
+
})
|
|
26
|
+
.describe("Geographic center of the agency's service area."),
|
|
27
|
+
coverageSpan: z
|
|
28
|
+
.object({
|
|
29
|
+
latSpan: z.number().describe('Latitude span of the coverage area in degrees.'),
|
|
30
|
+
lonSpan: z.number().describe('Longitude span of the coverage area in degrees.'),
|
|
31
|
+
})
|
|
32
|
+
.describe("Geographic extent of the agency's service area."),
|
|
33
|
+
})
|
|
34
|
+
.describe('A transit agency with coverage information.'))
|
|
35
|
+
.describe('All agencies served by this OneBusAway instance.'),
|
|
36
|
+
}),
|
|
37
|
+
async handler(_input, ctx) {
|
|
38
|
+
const agencies = await getOneBusAwayService().listAgencies(ctx);
|
|
39
|
+
ctx.log.info('listAgencies completed', { count: agencies.length });
|
|
40
|
+
return { agencies };
|
|
41
|
+
},
|
|
42
|
+
format: (result) => {
|
|
43
|
+
if (result.agencies.length === 0) {
|
|
44
|
+
return [{ type: 'text', text: 'No agencies found.' }];
|
|
45
|
+
}
|
|
46
|
+
const lines = [];
|
|
47
|
+
for (const a of result.agencies) {
|
|
48
|
+
lines.push(`## ${a.name}`);
|
|
49
|
+
lines.push(`**ID:** ${a.id} | **Timezone:** ${a.timezone}`);
|
|
50
|
+
lines.push(`**URL:** ${a.url}`);
|
|
51
|
+
if (a.phone)
|
|
52
|
+
lines.push(`**Phone:** ${a.phone}`);
|
|
53
|
+
lines.push(`**Coverage center:** ${a.coverageCenter.lat.toFixed(4)}, ${a.coverageCenter.lon.toFixed(4)} (±${a.coverageSpan.latSpan.toFixed(3)}° lat, ±${a.coverageSpan.lonSpan.toFixed(3)}° lon)`);
|
|
54
|
+
}
|
|
55
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=list-agencies.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-agencies.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-agencies.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EA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CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CACvL,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview List all routes operated by a specific agency.
|
|
3
|
+
* @module mcp-server/tools/definitions/list-routes-for-agency.tool
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
export declare const listRoutesForAgency: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
|
+
agencyId: z.ZodString;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
routes: z.ZodArray<z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
shortName: z.ZodString;
|
|
13
|
+
longName: z.ZodString;
|
|
14
|
+
description: z.ZodString;
|
|
15
|
+
type: z.ZodNumber;
|
|
16
|
+
color: z.ZodNullable<z.ZodString>;
|
|
17
|
+
url: z.ZodNullable<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
}, z.core.$strip>, readonly [{
|
|
20
|
+
readonly reason: "agency_not_found";
|
|
21
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
22
|
+
readonly when: "Agency ID does not exist on this instance.";
|
|
23
|
+
readonly recovery: "Use onebusaway_list_agencies to get valid agency IDs for this instance.";
|
|
24
|
+
}]>;
|
|
25
|
+
//# sourceMappingURL=list-routes-for-agency.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-routes-for-agency.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-routes-for-agency.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;GAoE9B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview List all routes operated by a specific agency.
|
|
3
|
+
* @module mcp-server/tools/definitions/list-routes-for-agency.tool
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getOneBusAwayService } from '../../../services/onebusaway/onebusaway-service.js';
|
|
8
|
+
export const listRoutesForAgency = tool('onebusaway_list_routes_for_agency', {
|
|
9
|
+
title: 'List Routes for Agency',
|
|
10
|
+
description: "List all routes operated by an agency. Returns route IDs, short names, and descriptions. Use to enumerate an agency's full service before searching for a specific route. Get agencyId values from onebusaway_list_agencies.",
|
|
11
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
12
|
+
input: z.object({
|
|
13
|
+
agencyId: z
|
|
14
|
+
.string()
|
|
15
|
+
.min(1)
|
|
16
|
+
.describe('Agency ID (e.g. "1" for Metro Transit, "40" for Sound Transit). Use onebusaway_list_agencies to discover IDs.'),
|
|
17
|
+
}),
|
|
18
|
+
output: z.object({
|
|
19
|
+
routes: z
|
|
20
|
+
.array(z
|
|
21
|
+
.object({
|
|
22
|
+
id: z
|
|
23
|
+
.string()
|
|
24
|
+
.describe('Agency-prefixed route ID. Use with onebusaway_get_schedule_for_route or onebusaway_get_vehicles.'),
|
|
25
|
+
shortName: z.string().describe('The number or short name displayed on vehicles.'),
|
|
26
|
+
longName: z.string().describe('Full route name.'),
|
|
27
|
+
description: z.string().describe('Route description.'),
|
|
28
|
+
type: z
|
|
29
|
+
.number()
|
|
30
|
+
.describe('GTFS route type: 0=tram, 1=subway, 2=rail, 3=bus, 4=ferry, 5=cable_car.'),
|
|
31
|
+
color: z.string().nullable().describe('Route brand color hex (without #), or null.'),
|
|
32
|
+
url: z.string().nullable().describe('Agency schedule page URL, or null.'),
|
|
33
|
+
})
|
|
34
|
+
.describe('A transit route operated by this agency.'))
|
|
35
|
+
.describe('All routes operated by this agency.'),
|
|
36
|
+
}),
|
|
37
|
+
errors: [
|
|
38
|
+
{
|
|
39
|
+
reason: 'agency_not_found',
|
|
40
|
+
code: JsonRpcErrorCode.NotFound,
|
|
41
|
+
when: 'Agency ID does not exist on this instance.',
|
|
42
|
+
recovery: 'Use onebusaway_list_agencies to get valid agency IDs for this instance.',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
async handler(input, ctx) {
|
|
46
|
+
const routes = await getOneBusAwayService().listRoutesForAgency(input.agencyId, ctx);
|
|
47
|
+
ctx.log.info('listRoutesForAgency completed', {
|
|
48
|
+
agencyId: input.agencyId,
|
|
49
|
+
count: routes.length,
|
|
50
|
+
});
|
|
51
|
+
return { routes };
|
|
52
|
+
},
|
|
53
|
+
format: (result) => {
|
|
54
|
+
if (result.routes.length === 0) {
|
|
55
|
+
return [{ type: 'text', text: 'No routes found for this agency.' }];
|
|
56
|
+
}
|
|
57
|
+
const lines = [`**Routes:** ${result.routes.length}`];
|
|
58
|
+
for (const r of result.routes) {
|
|
59
|
+
lines.push(`\n## ${r.shortName}${r.longName ? ` — ${r.longName}` : ''}`);
|
|
60
|
+
lines.push(`**ID:** ${r.id} | **Type:** ${r.type}`);
|
|
61
|
+
if (r.description)
|
|
62
|
+
lines.push(`**Description:** ${r.description}`);
|
|
63
|
+
if (r.color)
|
|
64
|
+
lines.push(`**Color:** #${r.color}`);
|
|
65
|
+
if (r.url)
|
|
66
|
+
lines.push(`**Schedule URL:** ${r.url}`);
|
|
67
|
+
}
|
|
68
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=list-routes-for-agency.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-routes-for-agency.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/list-routes-for-agency.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAEnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,mCAAmC,EAAE;IAC3E,KAAK,EAAE,wBAAwB;IAC/B,WAAW,EACT,8NAA8N;IAChO,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE;IACzD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,+GAA+G,CAChH;KACJ,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,MAAM,EAAE,CAAC;aACN,KAAK,CACJ,CAAC;aACE,MAAM,CAAC;YACN,EAAE,EAAE,CAAC;iBACF,MAAM,EAAE;iBACR,QAAQ,CACP,kGAAkG,CACnG;YACH,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iDAAiD,CAAC;YACjF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YACjD,WAAW,EAAE,C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M,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAC9B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACzE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,gBAAgB,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;YACpD,IAAI,CAAC,CAAC,WAAW;gBAAE,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YACnE,IAAI,CAAC,CAAC,KAAK;gBAAE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;YAClD,IAAI,CAAC,CAAC,GAAG;gBAAE,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Search for routes by name or number.
|
|
3
|
+
* @module mcp-server/tools/definitions/search-routes.tool
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
export declare const searchRoutes: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
|
+
query: z.ZodString;
|
|
9
|
+
maxCount: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
11
|
+
routes: z.ZodArray<z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
shortName: z.ZodString;
|
|
14
|
+
longName: z.ZodString;
|
|
15
|
+
description: z.ZodString;
|
|
16
|
+
agencyId: z.ZodString;
|
|
17
|
+
agencyName: z.ZodString;
|
|
18
|
+
type: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
}, z.core.$strip>, readonly [{
|
|
21
|
+
readonly reason: "endpoint_unavailable";
|
|
22
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
23
|
+
readonly when: "The search/route endpoint returns 404 on this OBA instance (e.g. Puget Sound).";
|
|
24
|
+
readonly recovery: "Use onebusaway_find_routes with a lat/lon near the service area, or onebusaway_list_routes_for_agency with a known agency ID to browse all routes.";
|
|
25
|
+
}]>;
|
|
26
|
+
//# sourceMappingURL=search-routes.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-routes.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-routes.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;GAsEvB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Search for routes by name or number.
|
|
3
|
+
* @module mcp-server/tools/definitions/search-routes.tool
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getOneBusAwayService } from '../../../services/onebusaway/onebusaway-service.js';
|
|
8
|
+
export const searchRoutes = tool('onebusaway_search_routes', {
|
|
9
|
+
title: 'Search Routes by Name or Number',
|
|
10
|
+
description: 'Search for routes by name or number. Returns matching routes with IDs. Use to resolve a route short name (e.g. "44") to a route ID for schedule or vehicle lookups with onebusaway_get_vehicles or onebusaway_get_schedule_for_route.',
|
|
11
|
+
annotations: { readOnlyHint: true },
|
|
12
|
+
input: z.object({
|
|
13
|
+
query: z.string().min(1).describe('Route name or number (e.g. "44", "Link", or "RapidRide").'),
|
|
14
|
+
maxCount: z
|
|
15
|
+
.number()
|
|
16
|
+
.default(10)
|
|
17
|
+
.describe('Maximum number of results to return. Defaults to 10.'),
|
|
18
|
+
}),
|
|
19
|
+
output: z.object({
|
|
20
|
+
routes: z
|
|
21
|
+
.array(z
|
|
22
|
+
.object({
|
|
23
|
+
id: z
|
|
24
|
+
.string()
|
|
25
|
+
.describe('Agency-prefixed route ID (e.g. "1_100259"). Use with onebusaway_get_vehicles or onebusaway_get_schedule_for_route.'),
|
|
26
|
+
shortName: z
|
|
27
|
+
.string()
|
|
28
|
+
.describe('The number or short name displayed on vehicles (e.g. "44").'),
|
|
29
|
+
longName: z.string().describe('Full route name.'),
|
|
30
|
+
description: z.string().describe('Route description.'),
|
|
31
|
+
agencyId: z.string().describe('Agency ID that operates this route.'),
|
|
32
|
+
agencyName: z.string().describe('Agency name that operates this route.'),
|
|
33
|
+
type: z
|
|
34
|
+
.number()
|
|
35
|
+
.describe('GTFS route type: 0=tram, 1=subway, 2=rail, 3=bus, 4=ferry, 5=cable_car.'),
|
|
36
|
+
})
|
|
37
|
+
.describe('A transit route with agency and type information.'))
|
|
38
|
+
.describe('Routes matching the search query.'),
|
|
39
|
+
}),
|
|
40
|
+
errors: [
|
|
41
|
+
{
|
|
42
|
+
reason: 'endpoint_unavailable',
|
|
43
|
+
code: JsonRpcErrorCode.NotFound,
|
|
44
|
+
when: 'The search/route endpoint returns 404 on this OBA instance (e.g. Puget Sound).',
|
|
45
|
+
recovery: 'Use onebusaway_find_routes with a lat/lon near the service area, or onebusaway_list_routes_for_agency with a known agency ID to browse all routes.',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
async handler(input, ctx) {
|
|
49
|
+
const routes = await getOneBusAwayService().searchRoutes({ query: input.query, maxCount: input.maxCount }, ctx);
|
|
50
|
+
ctx.log.info('searchRoutes completed', { query: input.query, count: routes.length });
|
|
51
|
+
return { routes };
|
|
52
|
+
},
|
|
53
|
+
format: (result) => {
|
|
54
|
+
if (result.routes.length === 0) {
|
|
55
|
+
return [{ type: 'text', text: 'No routes found matching the query.' }];
|
|
56
|
+
}
|
|
57
|
+
const lines = [`**Routes found:** ${result.routes.length}`];
|
|
58
|
+
for (const r of result.routes) {
|
|
59
|
+
lines.push(`\n## ${r.shortName}${r.longName ? ` — ${r.longName}` : ''}`);
|
|
60
|
+
lines.push(`**ID:** ${r.id} | **Agency:** ${r.agencyName} (${r.agencyId})`);
|
|
61
|
+
if (r.description)
|
|
62
|
+
lines.push(`**Description:** ${r.description}`);
|
|
63
|
+
lines.push(`**Type:** ${r.type}`);
|
|
64
|
+
}
|
|
65
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=search-routes.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-routes.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-routes.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAEnF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,0BAA0B,EAAE;IAC3D,KAAK,EAAE,iCAAiC;IACxC,WAAW,EACT,uOAAuO;IACzO,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC,CAAC,MAA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C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Search for stops by name or code string.
|
|
3
|
+
* @module mcp-server/tools/definitions/search-stops.tool
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
export declare const searchStops: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
7
|
+
query: z.ZodString;
|
|
8
|
+
maxCount: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
code: z.ZodString;
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
lat: z.ZodNumber;
|
|
15
|
+
lon: z.ZodNumber;
|
|
16
|
+
direction: z.ZodString;
|
|
17
|
+
routeIds: z.ZodArray<z.ZodString>;
|
|
18
|
+
wheelchairBoarding: z.ZodEnum<{
|
|
19
|
+
ACCESSIBLE: "ACCESSIBLE";
|
|
20
|
+
NOT_ACCESSIBLE: "NOT_ACCESSIBLE";
|
|
21
|
+
UNKNOWN: "UNKNOWN";
|
|
22
|
+
}>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
}, z.core.$strip>, undefined>;
|
|
25
|
+
//# sourceMappingURL=search-stops.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-stops.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-stops.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGjD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;6BA+DtB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Search for stops by name or code string.
|
|
3
|
+
* @module mcp-server/tools/definitions/search-stops.tool
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { getOneBusAwayService } from '../../../services/onebusaway/onebusaway-service.js';
|
|
7
|
+
export const searchStops = tool('onebusaway_search_stops', {
|
|
8
|
+
title: 'Search Stops by Name or Code',
|
|
9
|
+
description: 'Search for stops by name or code. Returns matching stops with IDs and coordinates. Use to resolve a human-readable stop name or number to a stop ID for arrivals lookups with onebusaway_get_arrivals.',
|
|
10
|
+
annotations: { readOnlyHint: true },
|
|
11
|
+
input: z.object({
|
|
12
|
+
query: z
|
|
13
|
+
.string()
|
|
14
|
+
.min(1)
|
|
15
|
+
.describe('Stop name fragment or stop code (e.g. "University Way" or "75403").'),
|
|
16
|
+
maxCount: z
|
|
17
|
+
.number()
|
|
18
|
+
.default(10)
|
|
19
|
+
.describe('Maximum number of results to return. Defaults to 10.'),
|
|
20
|
+
}),
|
|
21
|
+
output: z.object({
|
|
22
|
+
stops: z
|
|
23
|
+
.array(z
|
|
24
|
+
.object({
|
|
25
|
+
id: z
|
|
26
|
+
.string()
|
|
27
|
+
.describe('Agency-prefixed stop ID (e.g. "1_75403"). Use with onebusaway_get_arrivals.'),
|
|
28
|
+
code: z.string().describe('The stop code printed on the sign.'),
|
|
29
|
+
name: z.string().describe('Stop name.'),
|
|
30
|
+
lat: z.number().describe('Latitude of the stop.'),
|
|
31
|
+
lon: z.number().describe('Longitude of the stop.'),
|
|
32
|
+
direction: z.string().describe('Compass direction of travel at this stop.'),
|
|
33
|
+
routeIds: z.array(z.string()).describe('IDs of routes that serve this stop.'),
|
|
34
|
+
wheelchairBoarding: z
|
|
35
|
+
.enum(['ACCESSIBLE', 'NOT_ACCESSIBLE', 'UNKNOWN'])
|
|
36
|
+
.describe('Wheelchair boarding status.'),
|
|
37
|
+
})
|
|
38
|
+
.describe('A transit stop with location and route information.'))
|
|
39
|
+
.describe('Stops matching the search query.'),
|
|
40
|
+
}),
|
|
41
|
+
async handler(input, ctx) {
|
|
42
|
+
const stops = await getOneBusAwayService().searchStops({ query: input.query, maxCount: input.maxCount }, ctx);
|
|
43
|
+
ctx.log.info('searchStops completed', { query: input.query, count: stops.length });
|
|
44
|
+
return { stops };
|
|
45
|
+
},
|
|
46
|
+
format: (result) => {
|
|
47
|
+
if (result.stops.length === 0) {
|
|
48
|
+
return [{ type: 'text', text: 'No stops found matching the query.' }];
|
|
49
|
+
}
|
|
50
|
+
const lines = [`**Stops found:** ${result.stops.length}`];
|
|
51
|
+
for (const s of result.stops) {
|
|
52
|
+
lines.push(`\n## ${s.name}`);
|
|
53
|
+
lines.push(`**ID:** ${s.id} | **Code:** ${s.code} | **Direction:** ${s.direction}`);
|
|
54
|
+
lines.push(`**Coordinates:** ${s.lat.toFixed(6)}, ${s.lon.toFixed(6)}`);
|
|
55
|
+
lines.push(`**Routes:** ${s.routeIds.join(', ') || 'none'}`);
|
|
56
|
+
lines.push(`**Wheelchair:** ${s.wheelchairBoarding}`);
|
|
57
|
+
}
|
|
58
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=search-stops.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-stops.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-stops.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAEnF,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,yBAAyB,EAAE;IACzD,KAAK,EAAE,8BAA8B;IACrC,WAAW,EACT,wMAAwM;IAC1M,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,GAAG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AAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview OneBusAway SDK wrapper service. Initializes the SDK client and exposes
|
|
3
|
+
* typed methods for all API operations used by the tool handlers.
|
|
4
|
+
* @module services/onebusaway/onebusaway-service
|
|
5
|
+
*/
|
|
6
|
+
import type { Context } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
import type { ServerConfig } from '../../config/server-config.js';
|
|
8
|
+
import type { Agency, ArrivalsResult, Route, RouteScheduleResult, Stop, StopScheduleResult, TripResult, VehicleEntry } from './types.js';
|
|
9
|
+
export declare class OneBusAwayService {
|
|
10
|
+
private readonly client;
|
|
11
|
+
constructor(config: ServerConfig);
|
|
12
|
+
listAgencies(ctx: Context): Promise<Agency[]>;
|
|
13
|
+
findStops(params: {
|
|
14
|
+
lat: number;
|
|
15
|
+
lon: number;
|
|
16
|
+
radius?: number;
|
|
17
|
+
query?: string;
|
|
18
|
+
}, ctx: Context): Promise<{
|
|
19
|
+
stops: Stop[];
|
|
20
|
+
limitExceeded: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
getStop(stopId: string, ctx: Context): Promise<Stop>;
|
|
23
|
+
searchStops(params: {
|
|
24
|
+
query: string;
|
|
25
|
+
maxCount?: number;
|
|
26
|
+
}, ctx: Context): Promise<Stop[]>;
|
|
27
|
+
findRoutes(params: {
|
|
28
|
+
lat: number;
|
|
29
|
+
lon: number;
|
|
30
|
+
radius?: number;
|
|
31
|
+
query?: string;
|
|
32
|
+
}, ctx: Context): Promise<Route[]>;
|
|
33
|
+
getRoute(routeId: string, ctx: Context): Promise<Route>;
|
|
34
|
+
listRoutesForAgency(agencyId: string, ctx: Context): Promise<Route[]>;
|
|
35
|
+
searchRoutes(params: {
|
|
36
|
+
query: string;
|
|
37
|
+
maxCount?: number;
|
|
38
|
+
}, ctx: Context): Promise<Route[]>;
|
|
39
|
+
getArrivals(params: {
|
|
40
|
+
stopId: string;
|
|
41
|
+
minutesBefore?: number;
|
|
42
|
+
minutesAfter?: number;
|
|
43
|
+
}, ctx: Context): Promise<ArrivalsResult>;
|
|
44
|
+
getTrip(params: {
|
|
45
|
+
tripId: string;
|
|
46
|
+
serviceDate?: number;
|
|
47
|
+
includeSchedule?: boolean;
|
|
48
|
+
}, ctx: Context): Promise<TripResult>;
|
|
49
|
+
getVehicles(params: {
|
|
50
|
+
agencyId: string;
|
|
51
|
+
routeId?: string;
|
|
52
|
+
}, ctx: Context): Promise<VehicleEntry[]>;
|
|
53
|
+
getScheduleForStop(params: {
|
|
54
|
+
stopId: string;
|
|
55
|
+
date?: string;
|
|
56
|
+
}, ctx: Context): Promise<StopScheduleResult>;
|
|
57
|
+
getScheduleForRoute(params: {
|
|
58
|
+
routeId: string;
|
|
59
|
+
date?: string;
|
|
60
|
+
}, ctx: Context): Promise<RouteScheduleResult>;
|
|
61
|
+
}
|
|
62
|
+
export declare function initOneBusAwayService(config: ServerConfig): void;
|
|
63
|
+
export declare function getOneBusAwayService(): OneBusAwayService;
|
|
64
|
+
//# sourceMappingURL=onebusaway-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onebusaway-service.d.ts","sourceRoot":"","sources":["../../../src/services/onebusaway/onebusaway-service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EACV,MAAM,EAEN,cAAc,EACd,KAAK,EACL,mBAAmB,EAGnB,IAAI,EACJ,kBAAkB,EAElB,UAAU,EACV,YAAY,EACb,MAAM,YAAY,CAAC;AAiFpB,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgB;gBAE3B,MAAM,EAAE,YAAY;IAU1B,YAAY,CAA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