@cyanheads/wsdot-mcp-server 0.2.6 → 0.3.0
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/AGENTS.md +1 -1
- package/CLAUDE.md +1 -1
- package/README.md +19 -14
- package/changelog/0.3.x/0.3.0.md +30 -0
- package/dist/mcp-server/tools/definitions/get-ferry-schedule.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-ferry-schedule.tool.js +7 -1
- package/dist/mcp-server/tools/definitions/get-ferry-schedule.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-terminal-space.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-terminal-space.tool.js +2 -0
- package/dist/mcp-server/tools/definitions/get-terminal-space.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-toll-rates.tool.d.ts +4 -0
- package/dist/mcp-server/tools/definitions/get-toll-rates.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-toll-rates.tool.js +123 -79
- package/dist/mcp-server/tools/definitions/get-toll-rates.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-travel-times.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-travel-times.tool.js +103 -101
- package/dist/mcp-server/tools/definitions/get-travel-times.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-alerts.tool.d.ts +10 -0
- package/dist/mcp-server/tools/definitions/search-alerts.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-alerts.tool.js +152 -130
- package/dist/mcp-server/tools/definitions/search-alerts.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-cameras.tool.d.ts +12 -0
- package/dist/mcp-server/tools/definitions/search-cameras.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-cameras.tool.js +118 -67
- package/dist/mcp-server/tools/definitions/search-cameras.tool.js.map +1 -1
- package/dist/mcp-server/tools/page-budget.d.ts +56 -0
- package/dist/mcp-server/tools/page-budget.d.ts.map +1 -0
- package/dist/mcp-server/tools/page-budget.js +76 -0
- package/dist/mcp-server/tools/page-budget.js.map +1 -0
- package/package.json +2 -2
- package/server.json +3 -3
|
@@ -5,29 +5,65 @@
|
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
6
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
7
|
import { coordinatePair } from '../coordinate-pair.js';
|
|
8
|
+
import { continuationNotice, fitPageToBudget, MAX_FILTER_LENGTH, PAGE_BYTE_BUDGET, renderPage, } from '../page-budget.js';
|
|
8
9
|
import { byIdThenContent } from '../../../services/traffic/stable-order.js';
|
|
9
10
|
import { getTrafficApiService } from '../../../services/traffic/traffic-service.js';
|
|
10
11
|
const DEFAULT_LIMIT = 50;
|
|
11
12
|
const MAX_LIMIT = 500;
|
|
13
|
+
/** The region codes the camera feed carries in `Region`. */
|
|
14
|
+
const REGIONS = ['ER', 'NC', 'NW', 'OL', 'OS', 'SC', 'SW', 'WA'];
|
|
15
|
+
const CameraSchema = z
|
|
16
|
+
.object({
|
|
17
|
+
cameraId: z.number().optional().describe('Unique camera identifier.'),
|
|
18
|
+
title: z.string().optional().describe('Camera title or location description.'),
|
|
19
|
+
description: z.string().optional().describe('Additional description.'),
|
|
20
|
+
imageUrl: z
|
|
21
|
+
.string()
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('URL of the WSDOT-hosted camera image (JPEG). WSDOT copyright applies.'),
|
|
24
|
+
imageWidth: z.number().optional().describe('Image width in pixels.'),
|
|
25
|
+
imageHeight: z.number().optional().describe('Image height in pixels.'),
|
|
26
|
+
roadName: z.string().optional().describe('Road the camera monitors.'),
|
|
27
|
+
direction: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('Traffic-direction code monitored: N/S/E/W, B (both), NB/SB/EB/WB. Some sites use other location-specific markers.'),
|
|
31
|
+
milePost: z.number().optional().describe('Milepost location of the camera.'),
|
|
32
|
+
region: z.string().optional().describe('WSDOT region.'),
|
|
33
|
+
latitude: z.number().optional().describe('Camera latitude.'),
|
|
34
|
+
longitude: z.number().optional().describe('Camera longitude.'),
|
|
35
|
+
})
|
|
36
|
+
.describe('Camera metadata and image URL for one WSDOT highway camera.');
|
|
12
37
|
export const searchCameras = tool('wsdot_search_cameras', {
|
|
13
38
|
title: 'Search Highway Cameras',
|
|
14
39
|
description: 'Returns WSDOT highway camera locations, descriptions, and image URLs. ' +
|
|
15
40
|
'Camera images are copyright WSDOT — only metadata and image URLs are returned, not image bytes. ' +
|
|
16
|
-
'Filter by state route ("I-90", "90", "SR 520", or "520" all work), WSDOT region,
|
|
17
|
-
'
|
|
18
|
-
'
|
|
41
|
+
'Filter by state route ("I-90", "90", "SR 520", or "520" all work), WSDOT region, milepost range, ' +
|
|
42
|
+
'or words in the camera title ("Snoqualmie"). ' +
|
|
43
|
+
'Results are ordered by cameraId and paged — pass offset/limit to page through the full set. ' +
|
|
44
|
+
`A page ends at limit or at a ${PAGE_BYTE_BUDGET.toLocaleString('en-US')}-byte response budget, whichever comes first; the notice reports the next offset.`,
|
|
19
45
|
annotations: { readOnlyHint: true },
|
|
20
46
|
input: z.object({
|
|
21
47
|
stateRoute: z
|
|
22
48
|
.string()
|
|
49
|
+
.max(MAX_FILTER_LENGTH)
|
|
23
50
|
.optional()
|
|
24
51
|
.describe('State route to filter by. Accepts natural forms — "I-90", "90", "090", "SR 520", "520" — matched case- and space-insensitively to the route number. Camera road names carry a route-type prefix, which is compared when the filter carries one too: "SR 26" excludes US 26, while a bare "26" returns both. A lettered suffix is part of the route, so "US 97" excludes US 97A. Omit to include all routes.'),
|
|
25
52
|
region: z
|
|
26
53
|
.string()
|
|
54
|
+
.max(MAX_FILTER_LENGTH)
|
|
27
55
|
.optional()
|
|
28
|
-
.describe('WSDOT region code: NW (Northwest), SW (Southwest), OL (Olympic), ER (Eastern), SC (South Central),
|
|
29
|
-
startMilepost: z
|
|
30
|
-
|
|
56
|
+
.describe('WSDOT region code: NW (Northwest), SW (Southwest), OL (Olympic), ER (Eastern), SC (South Central), NC (North Central), OS (Oregon — the TripCheck cameras around Portland), or WA (airport cameras plus a few ferry-terminal cameras — most ferry-terminal cameras sit in NW and OL). Matching is case-insensitive; any other value is rejected. These are codes, not the region names wsdot_search_alerts takes.'),
|
|
57
|
+
startMilepost: z
|
|
58
|
+
.number()
|
|
59
|
+
.optional()
|
|
60
|
+
.describe('Start of the milepost range to filter cameras. Either bound may be given alone; when both are given, startMilepost must not exceed endMilepost. Cameras reporting no milepost are always included.'),
|
|
61
|
+
endMilepost: z.number().optional().describe('End of the milepost range to filter cameras.'),
|
|
62
|
+
titleContains: z
|
|
63
|
+
.string()
|
|
64
|
+
.max(MAX_FILTER_LENGTH)
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('Words to find in the camera title, as WSDOT wrote it. Case-insensitive; every whitespace-separated word must appear, in any order — "Snoqualmie" returns "Snoqualmie Summit" and "East Snoqualmie Summit" but not a nearby camera titled "Hyak". Most titles lead with route and milepost ("I-90 at MP 52: …"), so filter a route with stateRoute rather than here. Combines with the other filters. Omit to include every title.'),
|
|
31
67
|
offset: z
|
|
32
68
|
.number()
|
|
33
69
|
.int()
|
|
@@ -40,32 +76,11 @@ export const searchCameras = tool('wsdot_search_cameras', {
|
|
|
40
76
|
.min(1)
|
|
41
77
|
.max(MAX_LIMIT)
|
|
42
78
|
.optional()
|
|
43
|
-
.describe(`Maximum cameras to return in this page (1–${MAX_LIMIT}). Defaults to ${DEFAULT_LIMIT}.`),
|
|
79
|
+
.describe(`Maximum cameras to return in this page (1–${MAX_LIMIT}). Defaults to ${DEFAULT_LIMIT}. A large page ends sooner, at the ${PAGE_BYTE_BUDGET.toLocaleString('en-US')}-byte response budget.`),
|
|
44
80
|
}),
|
|
45
81
|
output: z.object({
|
|
46
82
|
cameras: z
|
|
47
|
-
.array(
|
|
48
|
-
.object({
|
|
49
|
-
cameraId: z.number().optional().describe('Unique camera identifier.'),
|
|
50
|
-
title: z.string().optional().describe('Camera title or location description.'),
|
|
51
|
-
description: z.string().optional().describe('Additional description.'),
|
|
52
|
-
imageUrl: z
|
|
53
|
-
.string()
|
|
54
|
-
.optional()
|
|
55
|
-
.describe('URL of the WSDOT-hosted camera image (JPEG). WSDOT copyright applies.'),
|
|
56
|
-
imageWidth: z.number().optional().describe('Image width in pixels.'),
|
|
57
|
-
imageHeight: z.number().optional().describe('Image height in pixels.'),
|
|
58
|
-
roadName: z.string().optional().describe('Road the camera monitors.'),
|
|
59
|
-
direction: z
|
|
60
|
-
.string()
|
|
61
|
-
.optional()
|
|
62
|
-
.describe('Traffic-direction code monitored: N/S/E/W, B (both), NB/SB/EB/WB. Some sites use other location-specific markers.'),
|
|
63
|
-
milePost: z.number().optional().describe('Milepost location of the camera.'),
|
|
64
|
-
region: z.string().optional().describe('WSDOT region.'),
|
|
65
|
-
latitude: z.number().optional().describe('Camera latitude.'),
|
|
66
|
-
longitude: z.number().optional().describe('Camera longitude.'),
|
|
67
|
-
})
|
|
68
|
-
.describe('Camera metadata and image URL for one WSDOT highway camera.'))
|
|
83
|
+
.array(CameraSchema)
|
|
69
84
|
.describe('Camera metadata and image URLs. Images are copyright WSDOT.'),
|
|
70
85
|
}),
|
|
71
86
|
enrichment: {
|
|
@@ -83,6 +98,7 @@ export const searchCameras = tool('wsdot_search_cameras', {
|
|
|
83
98
|
region: z.string().optional().describe('Region filter applied.'),
|
|
84
99
|
startMilepost: z.number().optional().describe('Start milepost filter applied.'),
|
|
85
100
|
endMilepost: z.number().optional().describe('End milepost filter applied.'),
|
|
101
|
+
titleContains: z.string().optional().describe('Title words filter applied.'),
|
|
86
102
|
})
|
|
87
103
|
.describe('Active filters applied to the camera search.'),
|
|
88
104
|
notice: z
|
|
@@ -102,6 +118,8 @@ export const searchCameras = tool('wsdot_search_cameras', {
|
|
|
102
118
|
parts.push(`- **Start MP:** ${filters.startMilepost}`);
|
|
103
119
|
if (filters.endMilepost != null)
|
|
104
120
|
parts.push(`- **End MP:** ${filters.endMilepost}`);
|
|
121
|
+
if (filters.titleContains)
|
|
122
|
+
parts.push(`- **Title contains:** ${filters.titleContains}`);
|
|
105
123
|
return parts.length > 0
|
|
106
124
|
? `**Applied Filters:**\n${parts.join('\n')}`
|
|
107
125
|
: '**Applied Filters:** none';
|
|
@@ -125,24 +143,54 @@ export const searchCameras = tool('wsdot_search_cameras', {
|
|
|
125
143
|
recovery: 'Register an access code at https://wsdot.wa.gov/traffic/api/, set WSDOT_ACCESS_CODE on the server, and restart it.',
|
|
126
144
|
thrownBy: 'service',
|
|
127
145
|
},
|
|
146
|
+
{
|
|
147
|
+
reason: 'invalid_region',
|
|
148
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
149
|
+
when: 'The region is not one of the region codes the camera feed carries.',
|
|
150
|
+
recovery: `Pass one of the region codes ${REGIONS.join(', ')} (case-insensitive), or omit region.`,
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
reason: 'invalid_milepost_range',
|
|
154
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
155
|
+
when: 'startMilepost is greater than endMilepost.',
|
|
156
|
+
recovery: 'Pass startMilepost less than or equal to endMilepost, or give only one bound for an open-ended range.',
|
|
157
|
+
},
|
|
128
158
|
],
|
|
129
159
|
async handler(input, ctx) {
|
|
130
160
|
const stateRoute = input.stateRoute?.trim() || undefined;
|
|
131
161
|
const region = input.region?.trim() || undefined;
|
|
162
|
+
const titleContains = input.titleContains?.trim() || undefined;
|
|
163
|
+
if (region && !REGIONS.includes(region.toUpperCase())) {
|
|
164
|
+
throw ctx.fail('invalid_region', `Unknown region "${region}" — wsdot_search_cameras takes a WSDOT region code.`, { ...ctx.recoveryFor('invalid_region') });
|
|
165
|
+
}
|
|
166
|
+
if (input.startMilepost != null &&
|
|
167
|
+
input.endMilepost != null &&
|
|
168
|
+
input.startMilepost > input.endMilepost) {
|
|
169
|
+
throw ctx.fail('invalid_milepost_range', `startMilepost ${input.startMilepost} is greater than endMilepost ${input.endMilepost}.`, { ...ctx.recoveryFor('invalid_milepost_range') });
|
|
170
|
+
}
|
|
132
171
|
const fetched = await getTrafficApiService().searchCameras({
|
|
133
172
|
...(stateRoute && { stateRoute }),
|
|
134
173
|
...(region && { region }),
|
|
135
174
|
...(input.startMilepost != null && { startMilepost: input.startMilepost }),
|
|
136
175
|
...(input.endMilepost != null && { endMilepost: input.endMilepost }),
|
|
137
176
|
}, ctx);
|
|
177
|
+
// Every word must appear somewhere in the title; a camera with no title cannot match.
|
|
178
|
+
const tokens = titleContains?.toLowerCase().split(/\s+/);
|
|
179
|
+
const matched = tokens
|
|
180
|
+
? fetched.filter((c) => {
|
|
181
|
+
const title = c.title?.toLowerCase();
|
|
182
|
+
return title != null && tokens.every((t) => title.includes(t));
|
|
183
|
+
})
|
|
184
|
+
: fetched;
|
|
138
185
|
// The camera feed serves one camera set in more than one row order, so a given offset is only
|
|
139
186
|
// reproducible once the rows are ordered here. Cameras with no cameraId sort last.
|
|
140
|
-
const allCameras =
|
|
187
|
+
const allCameras = matched.toSorted(byIdThenContent((c) => c.cameraId));
|
|
141
188
|
const appliedFilters = {
|
|
142
189
|
...(stateRoute && { stateRoute }),
|
|
143
190
|
...(region && { region }),
|
|
144
191
|
...(input.startMilepost != null && { startMilepost: input.startMilepost }),
|
|
145
192
|
...(input.endMilepost != null && { endMilepost: input.endMilepost }),
|
|
193
|
+
...(titleContains && { titleContains }),
|
|
146
194
|
};
|
|
147
195
|
// Page the full filtered set so structuredContent and content[] carry the identical
|
|
148
196
|
// page (the service stays filter-only; paging is a tool-handler concern). totalCount
|
|
@@ -150,7 +198,8 @@ export const searchCameras = tool('wsdot_search_cameras', {
|
|
|
150
198
|
const totalCount = allCameras.length;
|
|
151
199
|
const offset = input.offset ?? 0;
|
|
152
200
|
const limit = input.limit ?? DEFAULT_LIMIT;
|
|
153
|
-
const
|
|
201
|
+
const requested = allCameras.slice(offset, offset + limit);
|
|
202
|
+
const cameras = fitPageToBudget(requested, renderCamera, appliedFilters);
|
|
154
203
|
const hasMore = offset + cameras.length < totalCount;
|
|
155
204
|
const nextOffset = hasMore ? offset + cameras.length : null;
|
|
156
205
|
ctx.log.info('Cameras fetched', { totalCount, offset, limit, returned: cameras.length });
|
|
@@ -158,15 +207,17 @@ export const searchCameras = tool('wsdot_search_cameras', {
|
|
|
158
207
|
if (totalCount === 0) {
|
|
159
208
|
const hasFilters = Object.keys(appliedFilters).length > 0;
|
|
160
209
|
ctx.enrich.notice(hasFilters
|
|
161
|
-
? 'No cameras matched the applied filters. Try removing the stateRoute, region, or
|
|
210
|
+
? 'No cameras matched the applied filters. Try removing the stateRoute, region, milepost, or titleContains filters.'
|
|
162
211
|
: 'No camera data available statewide.');
|
|
163
212
|
}
|
|
164
213
|
else if (cameras.length === 0) {
|
|
165
214
|
ctx.enrich.notice(`Offset ${offset} is past the end of ${totalCount} matching cameras. Use an offset between 0 and ${totalCount - 1}.`);
|
|
166
215
|
}
|
|
167
216
|
else {
|
|
168
|
-
const
|
|
169
|
-
ctx.enrich.notice(
|
|
217
|
+
const shown = `Showing cameras ${offset + 1}–${offset + cameras.length} of ${totalCount}. Camera images are copyright WSDOT.`;
|
|
218
|
+
ctx.enrich.notice(nextOffset === null
|
|
219
|
+
? shown
|
|
220
|
+
: `${shown} ${continuationNotice(nextOffset, cameras.length < requested.length)}`);
|
|
170
221
|
}
|
|
171
222
|
return { cameras };
|
|
172
223
|
},
|
|
@@ -174,39 +225,39 @@ export const searchCameras = tool('wsdot_search_cameras', {
|
|
|
174
225
|
if (result.cameras.length === 0) {
|
|
175
226
|
return [{ type: 'text', text: 'No cameras found.' }];
|
|
176
227
|
}
|
|
177
|
-
|
|
178
|
-
for (const c of result.cameras) {
|
|
179
|
-
lines.push(`### ${c.title ?? `Camera ${c.cameraId ?? ''}`}`);
|
|
180
|
-
if (c.description)
|
|
181
|
-
lines.push(c.description);
|
|
182
|
-
// Direction and milepost stand on their own — gating the whole line on roadName drops
|
|
183
|
-
// them from content[] for a camera that reports a position but no road name.
|
|
184
|
-
const loc = [c.roadName, c.direction, c.milePost != null ? `MP ${c.milePost}` : undefined]
|
|
185
|
-
.filter(Boolean)
|
|
186
|
-
.join(' ');
|
|
187
|
-
if (loc)
|
|
188
|
-
lines.push(`**Location:** ${loc}`);
|
|
189
|
-
if (c.region)
|
|
190
|
-
lines.push(`**Region:** ${c.region}`);
|
|
191
|
-
if (c.imageUrl)
|
|
192
|
-
lines.push(`**Image:** ${c.imageUrl}`);
|
|
193
|
-
if (c.imageWidth != null && c.imageHeight != null) {
|
|
194
|
-
lines.push(`**Size:** ${c.imageWidth}×${c.imageHeight}px`);
|
|
195
|
-
}
|
|
196
|
-
else if (c.imageWidth != null) {
|
|
197
|
-
lines.push(`**Size:** ${c.imageWidth}px wide (height not reported)`);
|
|
198
|
-
}
|
|
199
|
-
else if (c.imageHeight != null) {
|
|
200
|
-
lines.push(`**Size:** ${c.imageHeight}px tall (width not reported)`);
|
|
201
|
-
}
|
|
202
|
-
const coords = coordinatePair(c.latitude, c.longitude);
|
|
203
|
-
if (coords)
|
|
204
|
-
lines.push(`**Coords:** ${coords}`);
|
|
205
|
-
if (c.cameraId != null)
|
|
206
|
-
lines.push(`**ID:** ${c.cameraId}`);
|
|
207
|
-
lines.push('');
|
|
208
|
-
}
|
|
209
|
-
return [{ type: 'text', text: lines.join('\n') }];
|
|
228
|
+
return [{ type: 'text', text: renderPage(result.cameras, renderCamera) }];
|
|
210
229
|
},
|
|
211
230
|
});
|
|
231
|
+
/** One camera's `content[]` block — shared by `format()` and the page-budget charge. */
|
|
232
|
+
function renderCamera(c) {
|
|
233
|
+
const lines = [`### ${c.title ?? `Camera ${c.cameraId ?? ''}`}`];
|
|
234
|
+
if (c.description)
|
|
235
|
+
lines.push(c.description);
|
|
236
|
+
// Direction and milepost stand on their own — gating the whole line on roadName drops
|
|
237
|
+
// them from content[] for a camera that reports a position but no road name.
|
|
238
|
+
const loc = [c.roadName, c.direction, c.milePost != null ? `MP ${c.milePost}` : undefined]
|
|
239
|
+
.filter(Boolean)
|
|
240
|
+
.join(' ');
|
|
241
|
+
if (loc)
|
|
242
|
+
lines.push(`**Location:** ${loc}`);
|
|
243
|
+
if (c.region)
|
|
244
|
+
lines.push(`**Region:** ${c.region}`);
|
|
245
|
+
if (c.imageUrl)
|
|
246
|
+
lines.push(`**Image:** ${c.imageUrl}`);
|
|
247
|
+
if (c.imageWidth != null && c.imageHeight != null) {
|
|
248
|
+
lines.push(`**Size:** ${c.imageWidth}×${c.imageHeight}px`);
|
|
249
|
+
}
|
|
250
|
+
else if (c.imageWidth != null) {
|
|
251
|
+
lines.push(`**Size:** ${c.imageWidth}px wide (height not reported)`);
|
|
252
|
+
}
|
|
253
|
+
else if (c.imageHeight != null) {
|
|
254
|
+
lines.push(`**Size:** ${c.imageHeight}px tall (width not reported)`);
|
|
255
|
+
}
|
|
256
|
+
const coords = coordinatePair(c.latitude, c.longitude);
|
|
257
|
+
if (coords)
|
|
258
|
+
lines.push(`**Coords:** ${coords}`);
|
|
259
|
+
if (c.cameraId != null)
|
|
260
|
+
lines.push(`**ID:** ${c.cameraId}`);
|
|
261
|
+
return lines.join('\n');
|
|
262
|
+
}
|
|
212
263
|
//# sourceMappingURL=search-cameras.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-cameras.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-cameras.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,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,MAAM,aAAa,GAAG,EAAE,CAA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C,IAAI,CAAC,eAAe,MAAM,EAAE,CAAC,CAAC;YAChD,IAAI,CAAC,CAAC,QAAQ,IAAI,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC5D,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"}
|
|
1
|
+
{"version":3,"file":"search-cameras.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/search-cameras.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,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,GACX,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAE7E,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,4DAA4D;AAC5D,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEjE,MAAM,YAAY,GAAG,CAAC;KACnB,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IACrE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ot_get_toll_rates`). A page ends at `limit` or at the budget, whichever comes first, so
|
|
5
|
+
* one call stays within a bounded share of a model's context however large `limit` is or however
|
|
6
|
+
* long an upstream free-text field runs. Rows are rendered once here for both `format()` and the
|
|
7
|
+
* charge, so the bytes counted are the bytes sent.
|
|
8
|
+
* @module mcp-server/tools/page-budget
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Ceiling on each surface of a page, in UTF-8 bytes: the serialized `structuredContent` and the
|
|
12
|
+
* joined `content[]` text, enrichment included on both.
|
|
13
|
+
*/
|
|
14
|
+
export declare const PAGE_BYTE_BUDGET = 24000;
|
|
15
|
+
/**
|
|
16
|
+
* Bytes held back from the rows for what every page carries besides them: the output wrapper
|
|
17
|
+
* (`{"alerts":[…]}`), the enrichment counters and notice in `structuredContent`, and the
|
|
18
|
+
* `content[]` trailer that renders them with their labels. Caller-supplied filter values the
|
|
19
|
+
* enrichment echoes back are charged per call instead: capped at {@link MAX_FILTER_LENGTH}
|
|
20
|
+
* characters, one can still escape to about 1,200 JSON bytes (a control character serializes as a
|
|
21
|
+
* six-byte `\u` escape), and a camera search echoes two, which a fixed reserve would take from
|
|
22
|
+
* every page.
|
|
23
|
+
*/
|
|
24
|
+
export declare const PAGE_OVERHEAD_RESERVE_BYTES = 1000;
|
|
25
|
+
/**
|
|
26
|
+
* Longest value, in characters, a traffic tool's free-text filter accepts (`stateRoute`, `route`,
|
|
27
|
+
* `titleContains`, `region`). Each filter is echoed back on both surfaces, so an unbounded one
|
|
28
|
+
* would let the caller's own input push a response past the budget. The longest live value a
|
|
29
|
+
* filter is matched against is a 73-character corridor name; camera titles run to 50.
|
|
30
|
+
*/
|
|
31
|
+
export declare const MAX_FILTER_LENGTH = 200;
|
|
32
|
+
/**
|
|
33
|
+
* The `content[]` text of a page: each row's block, separated by a blank line, ending in a
|
|
34
|
+
* newline. `format()` renders through this so the text matches what {@link fitPageToBudget}
|
|
35
|
+
* charged.
|
|
36
|
+
*/
|
|
37
|
+
export declare function renderPage<T>(rows: readonly T[], renderRow: (row: T) => string): string;
|
|
38
|
+
/**
|
|
39
|
+
* The leading rows of `window` (a page already sliced to `limit`) that fit the budget. Each row
|
|
40
|
+
* is charged at the larger of its JSON and its rendered block, plus a separator, so one running
|
|
41
|
+
* total bounds both surfaces. The page stops before the row that would cross the budget and
|
|
42
|
+
* always keeps the first row, so a row larger than the whole budget comes back alone rather than
|
|
43
|
+
* blocking the walk.
|
|
44
|
+
*
|
|
45
|
+
* @param window - Rows from `offset` up to `limit`, in page order.
|
|
46
|
+
* @param renderRow - The per-row renderer `format()` uses.
|
|
47
|
+
* @param echoed - Caller-supplied values the page's enrichment repeats (e.g. `appliedFilters`).
|
|
48
|
+
* @returns The rows to return; shorter than `window` exactly when the budget ended the page.
|
|
49
|
+
*/
|
|
50
|
+
export declare function fitPageToBudget<T>(window: readonly T[], renderRow: (row: T) => string, echoed?: unknown): T[];
|
|
51
|
+
/**
|
|
52
|
+
* The continuation sentence of a page that has more rows after it. A page the budget ended says
|
|
53
|
+
* so, so a caller reads a short page as a size cut rather than the end of the set.
|
|
54
|
+
*/
|
|
55
|
+
export declare function continuationNotice(nextOffset: number, budgetEnded: boolean): string;
|
|
56
|
+
//# sourceMappingURL=page-budget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-budget.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/page-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,OAAQ,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAOrC;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAEvF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,EAC7B,MAAM,CAAC,EAAE,OAAO,GACf,CAAC,EAAE,CAWL;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,GAAG,MAAM,CAInF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Per-surface byte budget for the paged traffic collection tools
|
|
3
|
+
* (`wsdot_search_alerts`, `wsdot_search_cameras`, `wsdot_get_travel_times`,
|
|
4
|
+
* `wsdot_get_toll_rates`). A page ends at `limit` or at the budget, whichever comes first, so
|
|
5
|
+
* one call stays within a bounded share of a model's context however large `limit` is or however
|
|
6
|
+
* long an upstream free-text field runs. Rows are rendered once here for both `format()` and the
|
|
7
|
+
* charge, so the bytes counted are the bytes sent.
|
|
8
|
+
* @module mcp-server/tools/page-budget
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Ceiling on each surface of a page, in UTF-8 bytes: the serialized `structuredContent` and the
|
|
12
|
+
* joined `content[]` text, enrichment included on both.
|
|
13
|
+
*/
|
|
14
|
+
export const PAGE_BYTE_BUDGET = 24_000;
|
|
15
|
+
/**
|
|
16
|
+
* Bytes held back from the rows for what every page carries besides them: the output wrapper
|
|
17
|
+
* (`{"alerts":[…]}`), the enrichment counters and notice in `structuredContent`, and the
|
|
18
|
+
* `content[]` trailer that renders them with their labels. Caller-supplied filter values the
|
|
19
|
+
* enrichment echoes back are charged per call instead: capped at {@link MAX_FILTER_LENGTH}
|
|
20
|
+
* characters, one can still escape to about 1,200 JSON bytes (a control character serializes as a
|
|
21
|
+
* six-byte `\u` escape), and a camera search echoes two, which a fixed reserve would take from
|
|
22
|
+
* every page.
|
|
23
|
+
*/
|
|
24
|
+
export const PAGE_OVERHEAD_RESERVE_BYTES = 1_000;
|
|
25
|
+
/**
|
|
26
|
+
* Longest value, in characters, a traffic tool's free-text filter accepts (`stateRoute`, `route`,
|
|
27
|
+
* `titleContains`, `region`). Each filter is echoed back on both surfaces, so an unbounded one
|
|
28
|
+
* would let the caller's own input push a response past the budget. The longest live value a
|
|
29
|
+
* filter is matched against is a 73-character corridor name; camera titles run to 50.
|
|
30
|
+
*/
|
|
31
|
+
export const MAX_FILTER_LENGTH = 200;
|
|
32
|
+
/** Separates two rendered rows in `content[]`: one blank line. */
|
|
33
|
+
const ROW_SEPARATOR = '\n\n';
|
|
34
|
+
const utf8Bytes = (text) => Buffer.byteLength(text);
|
|
35
|
+
/**
|
|
36
|
+
* The `content[]` text of a page: each row's block, separated by a blank line, ending in a
|
|
37
|
+
* newline. `format()` renders through this so the text matches what {@link fitPageToBudget}
|
|
38
|
+
* charged.
|
|
39
|
+
*/
|
|
40
|
+
export function renderPage(rows, renderRow) {
|
|
41
|
+
return `${rows.map(renderRow).join(ROW_SEPARATOR)}\n`;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The leading rows of `window` (a page already sliced to `limit`) that fit the budget. Each row
|
|
45
|
+
* is charged at the larger of its JSON and its rendered block, plus a separator, so one running
|
|
46
|
+
* total bounds both surfaces. The page stops before the row that would cross the budget and
|
|
47
|
+
* always keeps the first row, so a row larger than the whole budget comes back alone rather than
|
|
48
|
+
* blocking the walk.
|
|
49
|
+
*
|
|
50
|
+
* @param window - Rows from `offset` up to `limit`, in page order.
|
|
51
|
+
* @param renderRow - The per-row renderer `format()` uses.
|
|
52
|
+
* @param echoed - Caller-supplied values the page's enrichment repeats (e.g. `appliedFilters`).
|
|
53
|
+
* @returns The rows to return; shorter than `window` exactly when the budget ended the page.
|
|
54
|
+
*/
|
|
55
|
+
export function fitPageToBudget(window, renderRow, echoed) {
|
|
56
|
+
let remaining = PAGE_BYTE_BUDGET -
|
|
57
|
+
PAGE_OVERHEAD_RESERVE_BYTES -
|
|
58
|
+
(echoed === undefined ? 0 : utf8Bytes(JSON.stringify(echoed)));
|
|
59
|
+
for (const [index, row] of window.entries()) {
|
|
60
|
+
remaining -=
|
|
61
|
+
Math.max(utf8Bytes(JSON.stringify(row)), utf8Bytes(renderRow(row))) + ROW_SEPARATOR.length;
|
|
62
|
+
if (remaining < 0)
|
|
63
|
+
return window.slice(0, Math.max(index, 1));
|
|
64
|
+
}
|
|
65
|
+
return [...window];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The continuation sentence of a page that has more rows after it. A page the budget ended says
|
|
69
|
+
* so, so a caller reads a short page as a size cut rather than the end of the set.
|
|
70
|
+
*/
|
|
71
|
+
export function continuationNotice(nextOffset, budgetEnded) {
|
|
72
|
+
return budgetEnded
|
|
73
|
+
? `The ${PAGE_BYTE_BUDGET.toLocaleString('en-US')}-byte response budget ended this page before limit — pass offset=${nextOffset} for the next page.`
|
|
74
|
+
: `Pass offset=${nextOffset} for the next page.`;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=page-budget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-budget.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/page-budget.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAErC,kEAAkE;AAClE,MAAM,aAAa,GAAG,MAAM,CAAC;AAE7B,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAE5D;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAI,IAAkB,EAAE,SAA6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
|
4
4
|
"description": "Query WA highway conditions, ferry schedules, vessel locations, toll rates, border waits, and alerts via MCP. STDIO or Streamable HTTP.",
|
|
5
5
|
"mcpName": "io.github.cyanheads/wsdot-mcp-server",
|
|
6
6
|
"type": "module",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@biomejs/biome": "^2.5.14",
|
|
92
92
|
"@socketsecurity/bun-security-scanner": "^1.1.2",
|
|
93
|
-
"@types/node": "^26.6.
|
|
93
|
+
"@types/node": "^26.6.2",
|
|
94
94
|
"depcheck": "^1.4.7",
|
|
95
95
|
"ignore": "^7.0.9",
|
|
96
96
|
"tsc-alias": "^1.9.5",
|
package/server.json
CHANGED
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"url": "https://wsdot.caseyjhand.com/mcp"
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
|
-
"version": "0.
|
|
15
|
+
"version": "0.3.0",
|
|
16
16
|
"packages": [
|
|
17
17
|
{
|
|
18
18
|
"registryType": "npm",
|
|
19
19
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
20
20
|
"identifier": "@cyanheads/wsdot-mcp-server",
|
|
21
21
|
"runtimeHint": "node",
|
|
22
|
-
"version": "0.
|
|
22
|
+
"version": "0.3.0",
|
|
23
23
|
"packageArguments": [
|
|
24
24
|
{
|
|
25
25
|
"type": "positional",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
55
55
|
"identifier": "@cyanheads/wsdot-mcp-server",
|
|
56
56
|
"runtimeHint": "node",
|
|
57
|
-
"version": "0.
|
|
57
|
+
"version": "0.3.0",
|
|
58
58
|
"packageArguments": [
|
|
59
59
|
{
|
|
60
60
|
"type": "positional",
|