wsdot-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 +343 -0
- package/Dockerfile +99 -0
- package/LICENSE +201 -0
- package/README.md +364 -0
- package/changelog/0.1.x/0.1.0.md +24 -0
- package/changelog/0.1.x/0.1.1.md +26 -0
- package/changelog/template.md +119 -0
- package/dist/config/server-config.d.ts +12 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +19 -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 +33 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-border-waits.tool.d.ts +28 -0
- package/dist/mcp-server/tools/definitions/get-border-waits.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-border-waits.tool.js +83 -0
- package/dist/mcp-server/tools/definitions/get-border-waits.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ferry-alerts.tool.d.ts +22 -0
- package/dist/mcp-server/tools/definitions/get-ferry-alerts.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ferry-alerts.tool.js +67 -0
- package/dist/mcp-server/tools/definitions/get-ferry-alerts.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ferry-routes.tool.d.ts +33 -0
- package/dist/mcp-server/tools/definitions/get-ferry-routes.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ferry-routes.tool.js +95 -0
- package/dist/mcp-server/tools/definitions/get-ferry-routes.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ferry-schedule.tool.d.ts +41 -0
- package/dist/mcp-server/tools/definitions/get-ferry-schedule.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ferry-schedule.tool.js +117 -0
- package/dist/mcp-server/tools/definitions/get-ferry-schedule.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ferry-terminals.tool.d.ts +23 -0
- package/dist/mcp-server/tools/definitions/get-ferry-terminals.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ferry-terminals.tool.js +56 -0
- package/dist/mcp-server/tools/definitions/get-ferry-terminals.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-mountain-passes.tool.d.ts +35 -0
- package/dist/mcp-server/tools/definitions/get-mountain-passes.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-mountain-passes.tool.js +116 -0
- package/dist/mcp-server/tools/definitions/get-mountain-passes.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-terminal-space.tool.d.ts +32 -0
- package/dist/mcp-server/tools/definitions/get-terminal-space.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-terminal-space.tool.js +118 -0
- package/dist/mcp-server/tools/definitions/get-terminal-space.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-toll-rates.tool.d.ts +29 -0
- package/dist/mcp-server/tools/definitions/get-toll-rates.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-toll-rates.tool.js +85 -0
- package/dist/mcp-server/tools/definitions/get-toll-rates.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-travel-times.tool.d.ts +38 -0
- package/dist/mcp-server/tools/definitions/get-travel-times.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-travel-times.tool.js +141 -0
- package/dist/mcp-server/tools/definitions/get-travel-times.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-vessel-locations.tool.d.ts +35 -0
- package/dist/mcp-server/tools/definitions/get-vessel-locations.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-vessel-locations.tool.js +120 -0
- package/dist/mcp-server/tools/definitions/get-vessel-locations.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/index.d.ts +17 -0
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/index.js +17 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-alerts.tool.d.ts +48 -0
- package/dist/mcp-server/tools/definitions/search-alerts.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-alerts.tool.js +155 -0
- package/dist/mcp-server/tools/definitions/search-alerts.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-cameras.tool.d.ts +36 -0
- package/dist/mcp-server/tools/definitions/search-cameras.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-cameras.tool.js +116 -0
- package/dist/mcp-server/tools/definitions/search-cameras.tool.js.map +1 -0
- package/dist/services/ferry/ferry-service.d.ts +28 -0
- package/dist/services/ferry/ferry-service.d.ts.map +1 -0
- package/dist/services/ferry/ferry-service.js +222 -0
- package/dist/services/ferry/ferry-service.js.map +1 -0
- package/dist/services/ferry/types.d.ts +183 -0
- package/dist/services/ferry/types.d.ts.map +1 -0
- package/dist/services/ferry/types.js +6 -0
- package/dist/services/ferry/types.js.map +1 -0
- package/dist/services/traffic/traffic-service.d.ts +37 -0
- package/dist/services/traffic/traffic-service.d.ts.map +1 -0
- package/dist/services/traffic/traffic-service.js +290 -0
- package/dist/services/traffic/traffic-service.js.map +1 -0
- package/dist/services/traffic/types.d.ts +247 -0
- package/dist/services/traffic/types.d.ts.map +1 -0
- package/dist/services/traffic/types.js +6 -0
- package/dist/services/traffic/types.js.map +1 -0
- package/package.json +89 -0
- package/server.json +111 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-mountain-passes.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-mountain-passes.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,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8G5B,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Tool to fetch all WA mountain pass conditions from the WSDOT Traffic API.
|
|
3
|
+
* @module mcp-server/tools/definitions/get-mountain-passes.tool
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getTrafficApiService } from '../../../services/traffic/traffic-service.js';
|
|
8
|
+
export const getMountainPasses = tool('wsdot_get_mountain_passes', {
|
|
9
|
+
title: 'Get Mountain Pass Conditions',
|
|
10
|
+
description: 'Returns current road conditions for all Washington State mountain passes: status, weather, ' +
|
|
11
|
+
'road condition, traction laws, temperature, and elevation. Includes all ~12 passes ' +
|
|
12
|
+
'(Snoqualmie, Stevens, White, Blewett, Cayuse, etc.). Use for "is the pass open?", ' +
|
|
13
|
+
'traction law status, or winter driving planning.',
|
|
14
|
+
annotations: { readOnlyHint: true },
|
|
15
|
+
input: z.object({}),
|
|
16
|
+
output: z.object({
|
|
17
|
+
passes: z
|
|
18
|
+
.array(z
|
|
19
|
+
.object({
|
|
20
|
+
mountainPassId: z.number().describe('Numeric identifier for the pass.'),
|
|
21
|
+
mountainPassName: z
|
|
22
|
+
.string()
|
|
23
|
+
.describe('Human-readable pass name (e.g. "Snoqualmie Pass").'),
|
|
24
|
+
elevation: z.number().optional().describe('Pass summit elevation in feet.'),
|
|
25
|
+
temperatureInFahrenheit: z
|
|
26
|
+
.number()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Current temperature at the pass in Fahrenheit.'),
|
|
29
|
+
weatherCondition: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe('Current weather description (e.g. "Snowing", "Cloudy").'),
|
|
33
|
+
roadCondition: z
|
|
34
|
+
.string()
|
|
35
|
+
.optional()
|
|
36
|
+
.describe('Road surface condition (e.g. "Wet", "Snow and Ice Covered").'),
|
|
37
|
+
travelAdvisoryActive: z
|
|
38
|
+
.boolean()
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('True when a travel advisory is in effect.'),
|
|
41
|
+
restrictionOne: z
|
|
42
|
+
.object({
|
|
43
|
+
comment: z
|
|
44
|
+
.string()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('Restriction description (e.g. "Traction Tires Required").'),
|
|
47
|
+
type: z.string().optional().describe('Restriction type code.'),
|
|
48
|
+
})
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('Primary travel restriction, if any.'),
|
|
51
|
+
restrictionTwo: z
|
|
52
|
+
.object({
|
|
53
|
+
comment: z.string().optional().describe('Restriction description.'),
|
|
54
|
+
type: z.string().optional().describe('Restriction type code.'),
|
|
55
|
+
})
|
|
56
|
+
.optional()
|
|
57
|
+
.describe('Secondary travel restriction, if any.'),
|
|
58
|
+
dateUpdated: z.string().optional().describe('Timestamp of the last condition update.'),
|
|
59
|
+
latitude: z.number().optional().describe('Pass latitude.'),
|
|
60
|
+
longitude: z.number().optional().describe('Pass longitude.'),
|
|
61
|
+
})
|
|
62
|
+
.describe('Conditions for one mountain pass.'))
|
|
63
|
+
.describe('All WA mountain pass conditions.'),
|
|
64
|
+
}),
|
|
65
|
+
errors: [
|
|
66
|
+
{
|
|
67
|
+
reason: 'api_unavailable',
|
|
68
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
69
|
+
when: 'WSDOT Traffic API is unreachable or returns a non-2xx response after retries.',
|
|
70
|
+
retryable: true,
|
|
71
|
+
recovery: 'Retry in 30 seconds. If the issue persists, check wsdot.wa.gov for service status.',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
async handler(_input, ctx) {
|
|
75
|
+
const passes = await getTrafficApiService().getMountainPasses(ctx);
|
|
76
|
+
ctx.log.info('Mountain passes fetched', { count: passes.length });
|
|
77
|
+
return { passes };
|
|
78
|
+
},
|
|
79
|
+
format: (result) => {
|
|
80
|
+
if (result.passes.length === 0) {
|
|
81
|
+
return [{ type: 'text', text: 'No mountain pass data available.' }];
|
|
82
|
+
}
|
|
83
|
+
const lines = [`## WA Mountain Pass Conditions (${result.passes.length} passes)\n`];
|
|
84
|
+
for (const p of result.passes) {
|
|
85
|
+
lines.push(`### ${p.mountainPassName}`);
|
|
86
|
+
if (p.elevation != null)
|
|
87
|
+
lines.push(`**Elevation:** ${p.elevation} ft`);
|
|
88
|
+
if (p.temperatureInFahrenheit != null)
|
|
89
|
+
lines.push(`**Temperature:** ${p.temperatureInFahrenheit}°F`);
|
|
90
|
+
if (p.weatherCondition)
|
|
91
|
+
lines.push(`**Weather:** ${p.weatherCondition}`);
|
|
92
|
+
if (p.roadCondition)
|
|
93
|
+
lines.push(`**Road:** ${p.roadCondition}`);
|
|
94
|
+
if (typeof p.travelAdvisoryActive === 'boolean') {
|
|
95
|
+
lines.push(`**Travel Advisory:** ${p.travelAdvisoryActive ? 'ACTIVE' : 'None'}`);
|
|
96
|
+
}
|
|
97
|
+
if (p.restrictionOne?.comment || p.restrictionOne?.type) {
|
|
98
|
+
const r = [p.restrictionOne.type, p.restrictionOne.comment].filter(Boolean).join(' — ');
|
|
99
|
+
lines.push(`**Restriction 1:** ${r}`);
|
|
100
|
+
}
|
|
101
|
+
if (p.restrictionTwo?.comment || p.restrictionTwo?.type) {
|
|
102
|
+
const r = [p.restrictionTwo.type, p.restrictionTwo.comment].filter(Boolean).join(' — ');
|
|
103
|
+
lines.push(`**Restriction 2:** ${r}`);
|
|
104
|
+
}
|
|
105
|
+
if (p.dateUpdated)
|
|
106
|
+
lines.push(`**Updated:** ${p.dateUpdated}`);
|
|
107
|
+
lines.push(`**ID:** ${p.mountainPassId}`);
|
|
108
|
+
if (p.latitude != null && p.longitude != null) {
|
|
109
|
+
lines.push(`**Coords:** ${p.latitude}, ${p.longitude}`);
|
|
110
|
+
}
|
|
111
|
+
lines.push('');
|
|
112
|
+
}
|
|
113
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=get-mountain-passes.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-mountain-passes.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-mountain-passes.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,uCAAuC,CAAC;AAE7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,2BAA2B,EAAE;IACjE,KAAK,EAAE,8BAA8B;IACrC,WAAW,EACT,6FAA6F;QAC7F,qFAAqF;QACrF,oFAAoF;QACpF,kDAAkD;IACpD,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,MAAM,EAAE,CAAC;aACN,KAAK,CACJ,CAAC;aACE,MAAM,CAAC;YACN,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACvE,gBAAgB,EAAE,CAAC;iBAChB,MAAM,EAAE;iBACR,QAAQ,CAAC,oDAAoD,CAAC;YACjE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;YAC3E,uBAAuB,EAAE,CAAC;iBACvB,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,gDAAgD,CAAC;YAC7D,gBAAgB,EAAE,CAAC;iBAChB,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,yDAAyD,CAA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,CAAC,eAAe,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC;YAC1D,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,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,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Tool to fetch real-time vehicle space availability at WSF ferry terminals.
|
|
3
|
+
* @module mcp-server/tools/definitions/get-terminal-space.tool
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
export declare const getTerminalSpace: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
|
+
departingTerminalId: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
terminals: z.ZodArray<z.ZodObject<{
|
|
11
|
+
terminalId: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
terminalName: z.ZodOptional<z.ZodString>;
|
|
13
|
+
departingSpaces: z.ZodArray<z.ZodObject<{
|
|
14
|
+
departure: z.ZodOptional<z.ZodString>;
|
|
15
|
+
isCancelled: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
vesselName: z.ZodOptional<z.ZodString>;
|
|
17
|
+
arrivingTerminalName: z.ZodOptional<z.ZodString>;
|
|
18
|
+
driveUpSpaceCount: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
reservableSpaceCount: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
maxSpaceCount: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
driveUpSpaceHexColor: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
totalCount: z.ZodNumber;
|
|
25
|
+
}, z.core.$strip>, readonly [{
|
|
26
|
+
readonly reason: "api_unavailable";
|
|
27
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
28
|
+
readonly when: "WSF Ferry API is unreachable or returns a non-2xx response after retries.";
|
|
29
|
+
readonly retryable: true;
|
|
30
|
+
readonly recovery: "Retry in 30 seconds. If the issue persists, check wsdot.wa.gov/ferries for service status.";
|
|
31
|
+
}]>;
|
|
32
|
+
//# sourceMappingURL=get-terminal-space.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-terminal-space.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-terminal-space.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,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;GAyH3B,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Tool to fetch real-time vehicle space availability at WSF ferry terminals.
|
|
3
|
+
* @module mcp-server/tools/definitions/get-terminal-space.tool
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getFerryApiService } from '../../../services/ferry/ferry-service.js';
|
|
8
|
+
export const getTerminalSpace = tool('wsdot_get_terminal_space', {
|
|
9
|
+
title: 'Get Terminal Space',
|
|
10
|
+
description: 'Returns real-time drive-up and reservable vehicle space available at WSF terminals for upcoming sailings. ' +
|
|
11
|
+
'Use for "will I make the ferry?" or "how full is the next sailing?" questions. ' +
|
|
12
|
+
'Optionally filter to a specific terminal by ID (use wsdot_get_ferry_terminals for the ID). ' +
|
|
13
|
+
'DriveUpSpaceCount is the key field — zero means the drive-up lane is full.',
|
|
14
|
+
annotations: { readOnlyHint: true },
|
|
15
|
+
input: z.object({
|
|
16
|
+
departingTerminalId: z
|
|
17
|
+
.number()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Filter to a specific terminal by numeric ID. Omit to return all terminals.'),
|
|
20
|
+
}),
|
|
21
|
+
output: z.object({
|
|
22
|
+
terminals: z
|
|
23
|
+
.array(z
|
|
24
|
+
.object({
|
|
25
|
+
terminalId: z.number().optional().describe('Terminal numeric ID.'),
|
|
26
|
+
terminalName: z.string().optional().describe('Terminal name.'),
|
|
27
|
+
departingSpaces: z
|
|
28
|
+
.array(z
|
|
29
|
+
.object({
|
|
30
|
+
departure: z
|
|
31
|
+
.string()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('Scheduled departure time for this sailing.'),
|
|
34
|
+
isCancelled: z
|
|
35
|
+
.boolean()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('Whether this sailing is cancelled.'),
|
|
38
|
+
vesselName: z.string().optional().describe('Vessel assigned to this sailing.'),
|
|
39
|
+
arrivingTerminalName: z
|
|
40
|
+
.string()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe('Destination terminal name.'),
|
|
43
|
+
driveUpSpaceCount: z
|
|
44
|
+
.number()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('Available drive-up vehicle spaces. Zero means full.'),
|
|
47
|
+
reservableSpaceCount: z
|
|
48
|
+
.number()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('Available reservable vehicle spaces.'),
|
|
51
|
+
maxSpaceCount: z
|
|
52
|
+
.number()
|
|
53
|
+
.optional()
|
|
54
|
+
.describe('Maximum vehicle capacity for this sailing.'),
|
|
55
|
+
driveUpSpaceHexColor: z
|
|
56
|
+
.string()
|
|
57
|
+
.optional()
|
|
58
|
+
.describe('Color code for drive-up space indicator (for UI rendering).'),
|
|
59
|
+
})
|
|
60
|
+
.describe('Space availability for one upcoming sailing.'))
|
|
61
|
+
.describe('Upcoming sailings and available vehicle spaces.'),
|
|
62
|
+
})
|
|
63
|
+
.describe('Space availability at one WSF terminal.'))
|
|
64
|
+
.describe('Terminal space availability by terminal.'),
|
|
65
|
+
totalCount: z.number().describe('Number of terminals returned.'),
|
|
66
|
+
}),
|
|
67
|
+
errors: [
|
|
68
|
+
{
|
|
69
|
+
reason: 'api_unavailable',
|
|
70
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
71
|
+
when: 'WSF Ferry API is unreachable or returns a non-2xx response after retries.',
|
|
72
|
+
retryable: true,
|
|
73
|
+
recovery: 'Retry in 30 seconds. If the issue persists, check wsdot.wa.gov/ferries for service status.',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
async handler(input, ctx) {
|
|
77
|
+
const all = await getFerryApiService().getTerminalSailingSpace(ctx);
|
|
78
|
+
const filtered = input.departingTerminalId != null
|
|
79
|
+
? all.filter((t) => t.terminalId === input.departingTerminalId)
|
|
80
|
+
: all;
|
|
81
|
+
ctx.log.info('Terminal space fetched', { total: all.length, returned: filtered.length });
|
|
82
|
+
return { terminals: filtered, totalCount: filtered.length };
|
|
83
|
+
},
|
|
84
|
+
format: (result) => {
|
|
85
|
+
if (result.terminals.length === 0) {
|
|
86
|
+
return [{ type: 'text', text: 'No terminal space data available. **Total:** 0' }];
|
|
87
|
+
}
|
|
88
|
+
const lines = [`## Terminal Vehicle Space (${result.totalCount} terminals)\n`];
|
|
89
|
+
for (const t of result.terminals) {
|
|
90
|
+
const tId = t.terminalId != null ? ` (ID: ${t.terminalId})` : '';
|
|
91
|
+
lines.push(`### ${t.terminalName ?? 'Terminal'}${tId}`);
|
|
92
|
+
if (t.departingSpaces.length === 0) {
|
|
93
|
+
lines.push('No upcoming sailings.');
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
for (const s of t.departingSpaces) {
|
|
97
|
+
const cancelled = s.isCancelled ? ' [CANCELLED]' : '';
|
|
98
|
+
const dest = s.arrivingTerminalName ? ` → ${s.arrivingTerminalName}` : '';
|
|
99
|
+
const vessel = s.vesselName ? ` | ${s.vesselName}` : '';
|
|
100
|
+
lines.push(`**${s.departure ?? 'Unknown'}**${dest}${vessel}${cancelled}`);
|
|
101
|
+
if (s.driveUpSpaceCount != null) {
|
|
102
|
+
const full = s.driveUpSpaceCount === 0 ? ' (FULL)' : '';
|
|
103
|
+
lines.push(` Drive-up: ${s.driveUpSpaceCount}${s.maxSpaceCount != null ? `/${s.maxSpaceCount}` : ''} spaces${full}`);
|
|
104
|
+
}
|
|
105
|
+
if (s.reservableSpaceCount != null) {
|
|
106
|
+
lines.push(` Reservable: ${s.reservableSpaceCount} spaces`);
|
|
107
|
+
}
|
|
108
|
+
if (s.driveUpSpaceHexColor) {
|
|
109
|
+
lines.push(` Space color indicator: ${s.driveUpSpaceHexColor}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
lines.push('');
|
|
114
|
+
}
|
|
115
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=get-terminal-space.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-terminal-space.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-terminal-space.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,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,0BAA0B,EAAE;IAC/D,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,4GAA4G;QAC5G,iFAAiF;QACj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wBAChC,MAAM,IAAI,GAAG,CAAC,CAAC,iBAAiB,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;wBACxD,KAAK,CAAC,IAAI,CACR,eAAe,CAAC,CAAC,iBAAiB,GAAG,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,IAAI,EAAE,CAC1G,CAAC;oBACJ,CAAC;oBACD,IAAI,CAAC,CAAC,oBAAoB,IAAI,IAAI,EAAE,CAAC;wBACnC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,oBAAoB,SAAS,CAAC,CAAC;oBAC/D,CAAC;oBACD,IAAI,CAAC,CAAC,oBAAoB,EAAE,CAAC;wBAC3B,KAAK,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC,oBAAoB,EAAE,CAAC,CAAC;oBACnE,CAAC;gBACH,CAAC;YACH,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,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,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Tool to fetch current dynamic toll rates from the WSDOT Traffic API.
|
|
3
|
+
* @module mcp-server/tools/definitions/get-toll-rates.tool
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
export declare const getTollRates: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
8
|
+
rates: z.ZodArray<z.ZodObject<{
|
|
9
|
+
tripName: z.ZodOptional<z.ZodString>;
|
|
10
|
+
stateRoute: z.ZodOptional<z.ZodString>;
|
|
11
|
+
startMilepost: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
endMilepost: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
tollRateInDollars: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
message: z.ZodOptional<z.ZodString>;
|
|
15
|
+
signText: z.ZodOptional<z.ZodString>;
|
|
16
|
+
startLocationName: z.ZodOptional<z.ZodString>;
|
|
17
|
+
endLocationName: z.ZodOptional<z.ZodString>;
|
|
18
|
+
timeUpdated: z.ZodOptional<z.ZodString>;
|
|
19
|
+
tollCondition: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
totalCount: z.ZodNumber;
|
|
22
|
+
}, z.core.$strip>, readonly [{
|
|
23
|
+
readonly reason: "api_unavailable";
|
|
24
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
25
|
+
readonly when: "WSDOT Traffic API is unreachable or returns a non-2xx response after retries.";
|
|
26
|
+
readonly retryable: true;
|
|
27
|
+
readonly recovery: "Retry in 30 seconds. If the issue persists, check wsdot.wa.gov for service status.";
|
|
28
|
+
}]>;
|
|
29
|
+
//# sourceMappingURL=get-toll-rates.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-toll-rates.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-toll-rates.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;;;;;;;;;;;;;;;;;;;;;GA2EvB,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Tool to fetch current dynamic toll rates from the WSDOT Traffic API.
|
|
3
|
+
* @module mcp-server/tools/definitions/get-toll-rates.tool
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getTrafficApiService } from '../../../services/traffic/traffic-service.js';
|
|
8
|
+
export const getTollRates = tool('wsdot_get_toll_rates', {
|
|
9
|
+
title: 'Get Toll Rates',
|
|
10
|
+
description: 'Returns current dynamic toll rates for WA express lanes and tolled facilities: SR 99 (WSDOT Tunnel), ' +
|
|
11
|
+
'SR 520 Bridge, I-405 Express Lanes, I-90 Two-Way Express Lanes, and SR 167 HOT Lanes. ' +
|
|
12
|
+
'Rates are time-banded and change dynamically based on traffic conditions.',
|
|
13
|
+
annotations: { readOnlyHint: true },
|
|
14
|
+
input: z.object({}),
|
|
15
|
+
output: z.object({
|
|
16
|
+
rates: z
|
|
17
|
+
.array(z
|
|
18
|
+
.object({
|
|
19
|
+
tripName: z.string().optional().describe('Name of the tolled trip or lane segment.'),
|
|
20
|
+
stateRoute: z.string().optional().describe('State route number.'),
|
|
21
|
+
startMilepost: z.number().optional().describe('Starting milepost of the toll segment.'),
|
|
22
|
+
endMilepost: z.number().optional().describe('Ending milepost of the toll segment.'),
|
|
23
|
+
tollRateInDollars: z.number().optional().describe('Current toll rate in US dollars.'),
|
|
24
|
+
message: z.string().optional().describe('Dynamic message shown on toll sign.'),
|
|
25
|
+
signText: z.string().optional().describe('Text displayed on the toll rate sign.'),
|
|
26
|
+
startLocationName: z
|
|
27
|
+
.string()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe('Human-readable start location name.'),
|
|
30
|
+
endLocationName: z.string().optional().describe('Human-readable end location name.'),
|
|
31
|
+
timeUpdated: z.string().optional().describe('When this toll rate was last updated.'),
|
|
32
|
+
tollCondition: z.number().optional().describe('Numeric toll condition code.'),
|
|
33
|
+
})
|
|
34
|
+
.describe('Current toll rate for one segment or trip.'))
|
|
35
|
+
.describe('Current toll rates for all active tolled facilities.'),
|
|
36
|
+
totalCount: z.number().describe('Total number of toll rate entries returned.'),
|
|
37
|
+
}),
|
|
38
|
+
errors: [
|
|
39
|
+
{
|
|
40
|
+
reason: 'api_unavailable',
|
|
41
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
42
|
+
when: 'WSDOT Traffic API is unreachable or returns a non-2xx response after retries.',
|
|
43
|
+
retryable: true,
|
|
44
|
+
recovery: 'Retry in 30 seconds. If the issue persists, check wsdot.wa.gov for service status.',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
async handler(_input, ctx) {
|
|
48
|
+
const rates = await getTrafficApiService().getTollRates(ctx);
|
|
49
|
+
ctx.log.info('Toll rates fetched', { count: rates.length });
|
|
50
|
+
return { rates, totalCount: rates.length };
|
|
51
|
+
},
|
|
52
|
+
format: (result) => {
|
|
53
|
+
if (result.rates.length === 0) {
|
|
54
|
+
return [{ type: 'text', text: 'No toll rate data available. **Total:** 0' }];
|
|
55
|
+
}
|
|
56
|
+
const lines = [`## Toll Rates (${result.totalCount} entries)\n`];
|
|
57
|
+
for (const r of result.rates) {
|
|
58
|
+
const name = r.tripName ?? r.signText ?? 'Toll segment';
|
|
59
|
+
lines.push(`### ${name}`);
|
|
60
|
+
if (r.stateRoute)
|
|
61
|
+
lines.push(`**Route:** SR ${r.stateRoute}`);
|
|
62
|
+
if (r.startLocationName || r.endLocationName) {
|
|
63
|
+
const seg = [r.startLocationName, r.endLocationName].filter(Boolean).join(' → ');
|
|
64
|
+
lines.push(`**Segment:** ${seg}`);
|
|
65
|
+
}
|
|
66
|
+
if (r.startMilepost != null)
|
|
67
|
+
lines.push(`**Start MP:** ${r.startMilepost}`);
|
|
68
|
+
if (r.endMilepost != null)
|
|
69
|
+
lines.push(`**End MP:** ${r.endMilepost}`);
|
|
70
|
+
if (r.signText)
|
|
71
|
+
lines.push(`**Sign:** ${r.signText}`);
|
|
72
|
+
if (r.tollRateInDollars != null)
|
|
73
|
+
lines.push(`**Rate:** $${r.tollRateInDollars.toFixed(2)}`);
|
|
74
|
+
if (r.message)
|
|
75
|
+
lines.push(`**Message:** ${r.message}`);
|
|
76
|
+
if (r.timeUpdated)
|
|
77
|
+
lines.push(`**Updated:** ${r.timeUpdated}`);
|
|
78
|
+
if (r.tollCondition != null)
|
|
79
|
+
lines.push(`**Condition:** ${r.tollCondition}`);
|
|
80
|
+
lines.push('');
|
|
81
|
+
}
|
|
82
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=get-toll-rates.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-toll-rates.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-toll-rates.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,uCAAuC,CAAC;AAE7E,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,sBAAsB,EAAE;IACvD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EACT,uGAAuG;QACvG,wFAAwF;QACxF,2EAA2E;IAC7E,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;IACnC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,KAAK,EAAE,CAAC;aACL,KAAK,CACJ,CAAC;aACE,MAAM,CAAC;YACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;YACpF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAA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AI,CAAC,CAAC,aAAa,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;YAC5E,IAAI,CAAC,CAAC,WAAW,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YACtE,IAAI,CAAC,CAAC,QAAQ;gBAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YACtD,IAAI,CAAC,CAAC,iBAAiB,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAC5F,IAAI,CAAC,CAAC,OAAO;gBAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACvD,IAAI,CAAC,CAAC,WAAW;gBAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;YAC/D,IAAI,CAAC,CAAC,aAAa,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;YAC7E,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,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,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Tool to fetch named corridor travel times from the WSDOT Traffic API.
|
|
3
|
+
* @module mcp-server/tools/definitions/get-travel-times.tool
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
export declare const getTravelTimes: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
|
+
route: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
10
|
+
corridors: z.ZodArray<z.ZodObject<{
|
|
11
|
+
travelTimeId: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
name: z.ZodOptional<z.ZodString>;
|
|
13
|
+
description: z.ZodOptional<z.ZodString>;
|
|
14
|
+
currentTimeInMinutes: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
averageTimeInMinutes: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
delayInMinutes: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
timeUpdated: z.ZodOptional<z.ZodString>;
|
|
18
|
+
distanceInMiles: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
startPoint: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
roadName: z.ZodOptional<z.ZodString>;
|
|
21
|
+
direction: z.ZodOptional<z.ZodString>;
|
|
22
|
+
milePost: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
}, z.core.$strip>>;
|
|
24
|
+
endPoint: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
roadName: z.ZodOptional<z.ZodString>;
|
|
26
|
+
direction: z.ZodOptional<z.ZodString>;
|
|
27
|
+
milePost: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
totalCount: z.ZodNumber;
|
|
31
|
+
}, z.core.$strip>, readonly [{
|
|
32
|
+
readonly reason: "api_unavailable";
|
|
33
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
34
|
+
readonly when: "WSDOT Traffic API is unreachable or returns a non-2xx response after retries.";
|
|
35
|
+
readonly retryable: true;
|
|
36
|
+
readonly recovery: "Retry in 30 seconds. If the issue persists, check wsdot.wa.gov for service status.";
|
|
37
|
+
}]>;
|
|
38
|
+
//# sourceMappingURL=get-travel-times.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-travel-times.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-travel-times.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,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0IzB,CAAC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Tool to fetch named corridor travel times from the WSDOT Traffic API.
|
|
3
|
+
* @module mcp-server/tools/definitions/get-travel-times.tool
|
|
4
|
+
*/
|
|
5
|
+
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
|
+
import { getTrafficApiService } from '../../../services/traffic/traffic-service.js';
|
|
8
|
+
export const getTravelTimes = tool('wsdot_get_travel_times', {
|
|
9
|
+
title: 'Get Travel Times',
|
|
10
|
+
description: 'Returns current vs. average travel times for named WA highway corridors (I-5, I-90, SR 520, SR 99, ' +
|
|
11
|
+
'I-405, SR 167, etc.). Use for "how congested is I-5?" or commute time estimates. ' +
|
|
12
|
+
'Filter by partial route name (e.g. "I-5", "SR 520") to narrow results. ' +
|
|
13
|
+
'When current time exceeds average, the corridor is congested.',
|
|
14
|
+
annotations: { readOnlyHint: true },
|
|
15
|
+
input: z.object({
|
|
16
|
+
route: z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Optional text filter applied to corridor names (e.g. "I-5", "SR 520", "I-405"). ' +
|
|
20
|
+
'Case-insensitive. Omit to return all corridors.'),
|
|
21
|
+
}),
|
|
22
|
+
output: z.object({
|
|
23
|
+
corridors: z
|
|
24
|
+
.array(z
|
|
25
|
+
.object({
|
|
26
|
+
travelTimeId: z.number().optional().describe('Unique corridor identifier.'),
|
|
27
|
+
name: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Corridor name (e.g. "I-5: Northgate to Downtown").'),
|
|
31
|
+
description: z.string().optional().describe('Additional corridor description.'),
|
|
32
|
+
currentTimeInMinutes: z.number().optional().describe('Current travel time in minutes.'),
|
|
33
|
+
averageTimeInMinutes: z
|
|
34
|
+
.number()
|
|
35
|
+
.optional()
|
|
36
|
+
.describe('Historical average travel time in minutes.'),
|
|
37
|
+
delayInMinutes: z
|
|
38
|
+
.number()
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('Delay above average in minutes. Positive means congestion.'),
|
|
41
|
+
timeUpdated: z
|
|
42
|
+
.string()
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('When the travel time data was last updated.'),
|
|
45
|
+
distanceInMiles: z.number().optional().describe('Corridor distance in miles.'),
|
|
46
|
+
startPoint: z
|
|
47
|
+
.object({
|
|
48
|
+
roadName: z.string().optional().describe('Road name at the start.'),
|
|
49
|
+
direction: z.string().optional().describe('Travel direction.'),
|
|
50
|
+
milePost: z.number().optional().describe('Starting milepost.'),
|
|
51
|
+
})
|
|
52
|
+
.optional()
|
|
53
|
+
.describe('Start of the measured corridor.'),
|
|
54
|
+
endPoint: z
|
|
55
|
+
.object({
|
|
56
|
+
roadName: z.string().optional().describe('Road name at the end.'),
|
|
57
|
+
direction: z.string().optional().describe('Travel direction.'),
|
|
58
|
+
milePost: z.number().optional().describe('Ending milepost.'),
|
|
59
|
+
})
|
|
60
|
+
.optional()
|
|
61
|
+
.describe('End of the measured corridor.'),
|
|
62
|
+
})
|
|
63
|
+
.describe('Travel time data for one highway corridor.'))
|
|
64
|
+
.describe('Travel time corridors matching the filter.'),
|
|
65
|
+
totalCount: z.number().describe('Total number of corridors returned.'),
|
|
66
|
+
}),
|
|
67
|
+
errors: [
|
|
68
|
+
{
|
|
69
|
+
reason: 'api_unavailable',
|
|
70
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
71
|
+
when: 'WSDOT Traffic API is unreachable or returns a non-2xx response after retries.',
|
|
72
|
+
retryable: true,
|
|
73
|
+
recovery: 'Retry in 30 seconds. If the issue persists, check wsdot.wa.gov for service status.',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
async handler(input, ctx) {
|
|
77
|
+
const all = await getTrafficApiService().getTravelTimes(ctx);
|
|
78
|
+
const routeFilter = input.route?.trim() ? input.route.trim().toLowerCase() : undefined;
|
|
79
|
+
const filtered = routeFilter
|
|
80
|
+
? all.filter((t) => t.name?.toLowerCase().includes(routeFilter))
|
|
81
|
+
: all;
|
|
82
|
+
const corridors = filtered.map((t) => ({
|
|
83
|
+
...t,
|
|
84
|
+
delayInMinutes: t.currentTimeInMinutes != null && t.averageTimeInMinutes != null
|
|
85
|
+
? t.currentTimeInMinutes - t.averageTimeInMinutes
|
|
86
|
+
: undefined,
|
|
87
|
+
}));
|
|
88
|
+
ctx.log.info('Travel times fetched', { total: all.length, returned: corridors.length });
|
|
89
|
+
return { corridors, totalCount: corridors.length };
|
|
90
|
+
},
|
|
91
|
+
format: (result) => {
|
|
92
|
+
if (result.corridors.length === 0) {
|
|
93
|
+
return [{ type: 'text', text: `No corridors matched. **Total:** 0` }];
|
|
94
|
+
}
|
|
95
|
+
const lines = [`## Travel Times (${result.totalCount} corridors)\n`];
|
|
96
|
+
for (const c of result.corridors) {
|
|
97
|
+
lines.push(`### ${c.name ?? 'Corridor'}`);
|
|
98
|
+
if (c.description)
|
|
99
|
+
lines.push(c.description);
|
|
100
|
+
if (c.currentTimeInMinutes != null)
|
|
101
|
+
lines.push(`**Current:** ${c.currentTimeInMinutes} min`);
|
|
102
|
+
if (c.averageTimeInMinutes != null)
|
|
103
|
+
lines.push(`**Average:** ${c.averageTimeInMinutes} min`);
|
|
104
|
+
if (c.delayInMinutes != null) {
|
|
105
|
+
const sign = c.delayInMinutes > 0 ? '+' : '';
|
|
106
|
+
lines.push(`**Delay:** ${sign}${c.delayInMinutes} min${c.delayInMinutes > 0 ? ' (congested)' : ''}`);
|
|
107
|
+
}
|
|
108
|
+
if (c.distanceInMiles != null)
|
|
109
|
+
lines.push(`**Distance:** ${c.distanceInMiles} mi`);
|
|
110
|
+
if (c.startPoint) {
|
|
111
|
+
const sp = [
|
|
112
|
+
c.startPoint.roadName,
|
|
113
|
+
c.startPoint.direction,
|
|
114
|
+
c.startPoint.milePost != null ? `MP ${c.startPoint.milePost}` : undefined,
|
|
115
|
+
]
|
|
116
|
+
.filter(Boolean)
|
|
117
|
+
.join(' ');
|
|
118
|
+
if (sp)
|
|
119
|
+
lines.push(`**From:** ${sp}`);
|
|
120
|
+
}
|
|
121
|
+
if (c.endPoint) {
|
|
122
|
+
const ep = [
|
|
123
|
+
c.endPoint.roadName,
|
|
124
|
+
c.endPoint.direction,
|
|
125
|
+
c.endPoint.milePost != null ? `MP ${c.endPoint.milePost}` : undefined,
|
|
126
|
+
]
|
|
127
|
+
.filter(Boolean)
|
|
128
|
+
.join(' ');
|
|
129
|
+
if (ep)
|
|
130
|
+
lines.push(`**To:** ${ep}`);
|
|
131
|
+
}
|
|
132
|
+
if (c.timeUpdated)
|
|
133
|
+
lines.push(`**Updated:** ${c.timeUpdated}`);
|
|
134
|
+
if (c.travelTimeId != null)
|
|
135
|
+
lines.push(`**ID:** ${c.travelTimeId}`);
|
|
136
|
+
lines.push('');
|
|
137
|
+
}
|
|
138
|
+
return [{ type: 'text', text: lines.join('\n') }];
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
//# sourceMappingURL=get-travel-times.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-travel-times.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-travel-times.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA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