@cyanheads/nws-weather-mcp-server 0.5.7 → 0.5.9
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 +34 -12
- package/Dockerfile +2 -2
- package/README.md +3 -3
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/resources/definitions/alert-types.resource.d.ts +1 -1
- package/dist/mcp-server/resources/definitions/alert-types.resource.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/find-stations.tool.d.ts +9 -3
- package/dist/mcp-server/tools/definitions/find-stations.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/find-stations.tool.js +15 -6
- package/dist/mcp-server/tools/definitions/find-stations.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-forecast.tool.d.ts +10 -4
- package/dist/mcp-server/tools/definitions/get-forecast.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-forecast.tool.js +25 -10
- package/dist/mcp-server/tools/definitions/get-forecast.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-observations.tool.d.ts +38 -12
- package/dist/mcp-server/tools/definitions/get-observations.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-observations.tool.js +78 -44
- package/dist/mcp-server/tools/definitions/get-observations.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/list-alert-types.tool.d.ts +1 -1
- package/dist/mcp-server/tools/definitions/list-alert-types.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-alerts.tool.d.ts +17 -1
- package/dist/mcp-server/tools/definitions/search-alerts.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-alerts.tool.js +30 -15
- package/dist/mcp-server/tools/definitions/search-alerts.tool.js.map +1 -1
- package/dist/services/nws/nws-service.d.ts.map +1 -1
- package/dist/services/nws/nws-service.js +50 -22
- package/dist/services/nws/nws-service.js.map +1 -1
- package/package.json +9 -11
- package/server.json +3 -3
package/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** nws-weather-mcp-server
|
|
4
|
-
**Version:** 0.5.
|
|
4
|
+
**Version:** 0.5.9
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
|
|
6
6
|
|
|
7
7
|
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
@@ -181,24 +181,42 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
181
181
|
|
|
182
182
|
## Errors
|
|
183
183
|
|
|
184
|
-
Handlers throw — the framework catches, classifies, and formats.
|
|
184
|
+
Handlers throw — the framework catches, classifies, and formats.
|
|
185
|
+
|
|
186
|
+
**Recommended: typed error contract.** Tools that surface domain-specific failures declare `errors: [{ reason, code, when, recovery, retryable? }]`. The handler then receives `ctx.fail(reason, msg?, data?)` typed against the reason union (`ctx.fail('typo')` is a TS error). Spread `ctx.recoveryFor('reason')` to copy the contract's recovery hint onto the wire — the framework mirrors `data.recovery.hint` into `content[]` text. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely without declaration.
|
|
185
187
|
|
|
186
188
|
```ts
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
189
|
+
errors: [
|
|
190
|
+
{ reason: 'out_of_scope', code: JsonRpcErrorCode.ValidationError,
|
|
191
|
+
when: 'Coordinates fall outside US National Weather Service coverage',
|
|
192
|
+
recovery: 'Provide coordinates within US states, territories, or adjacent marine areas.' },
|
|
193
|
+
],
|
|
194
|
+
async handler(input, ctx) {
|
|
195
|
+
if (badCoords(input)) throw ctx.fail('out_of_scope', undefined, { ...ctx.recoveryFor('out_of_scope') });
|
|
196
|
+
// ...
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
In services that throw on behalf of contract-bearing tools, pass `data: { reason: 'X', ...ctx.recoveryFor('X') }` to error factories. The conformance lint scans handler source only — services are wire-correct via `data.reason` but not lint-enforced.
|
|
190
201
|
|
|
191
|
-
|
|
192
|
-
|
|
202
|
+
**Fallback (no contract entry fits):** factories or plain `Error`.
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
// Error factories — explicit code, concise
|
|
206
|
+
import { notFound, validationError, serviceUnavailable } from '@cyanheads/mcp-ts-core/errors';
|
|
193
207
|
throw notFound('Item not found', { itemId });
|
|
194
208
|
throw serviceUnavailable('API unavailable', { url }, { cause: err });
|
|
195
209
|
|
|
196
|
-
//
|
|
210
|
+
// Plain Error — framework auto-classifies from message patterns
|
|
211
|
+
throw new Error('Item not found'); // → NotFound
|
|
212
|
+
throw new Error('Invalid query format'); // → ValidationError
|
|
213
|
+
|
|
214
|
+
// McpError — when no factory exists for the code
|
|
197
215
|
import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
198
216
|
throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
|
|
199
217
|
```
|
|
200
218
|
|
|
201
|
-
|
|
219
|
+
Use `validationError` for semantic post-shape validation (the wrong-field-shape kind is rare post-Zod); `invalidParams` is for malformed JSON-RPC params. See framework CLAUDE.md for the full auto-classification table, all available factories, and the contract reference.
|
|
202
220
|
|
|
203
221
|
---
|
|
204
222
|
|
|
@@ -258,11 +276,14 @@ Available skills:
|
|
|
258
276
|
| `maintenance` | Investigate changelogs, adopt upstream changes, sync skills to agent dirs |
|
|
259
277
|
| `report-issue-framework` | File a bug or feature request against `@cyanheads/mcp-ts-core` via `gh` CLI |
|
|
260
278
|
| `report-issue-local` | File a bug or feature request against this server's own repo via `gh` CLI |
|
|
279
|
+
| `tool-defs-analysis` | Read-only audit of tool/resource/prompt language: voice, leaks, defaults, recovery hints, sparsity |
|
|
261
280
|
| `api-auth` | Auth modes, scopes, JWT/OAuth |
|
|
281
|
+
| `api-canvas` | DataCanvas: tabular SQL workspace + `spillover()` for big result sets (Tier 3 opt-in) |
|
|
262
282
|
| `api-config` | AppConfig, parseConfig, env vars |
|
|
263
283
|
| `api-context` | Context interface, logger, state, progress |
|
|
264
|
-
| `api-errors` | McpError, JsonRpcErrorCode, error patterns |
|
|
284
|
+
| `api-errors` | McpError, JsonRpcErrorCode, error contracts, factory patterns |
|
|
265
285
|
| `api-services` | LLM, Speech, Graph services |
|
|
286
|
+
| `api-telemetry` | OTel catalog: spans, metrics, completion logs, env config, cardinality rules |
|
|
266
287
|
| `api-testing` | createMockContext, test patterns |
|
|
267
288
|
| `api-utils` | Formatting, parsing, security, pagination, scheduling |
|
|
268
289
|
| `api-workers` | Cloudflare Workers runtime |
|
|
@@ -283,8 +304,6 @@ When you complete a skill's checklist, check the boxes and add a completion time
|
|
|
283
304
|
| `bun run format` | Auto-fix formatting |
|
|
284
305
|
| `bun run lint:mcp` | Validate MCP tool/resource definitions |
|
|
285
306
|
| `bun run test` | Run tests |
|
|
286
|
-
| `bun run dev:stdio` | Dev mode (stdio) |
|
|
287
|
-
| `bun run dev:http` | Dev mode (HTTP) |
|
|
288
307
|
| `bun run start:stdio` | Production mode (stdio) |
|
|
289
308
|
| `bun run start:http` | Production mode (HTTP) |
|
|
290
309
|
|
|
@@ -326,6 +345,9 @@ import { getNwsService } from '@/services/nws/nws-service.js';
|
|
|
326
345
|
- [ ] `ctx.log` for logging, `ctx.state` for storage
|
|
327
346
|
- [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
|
|
328
347
|
- [ ] `format()` renders all data the LLM needs — different clients forward different surfaces (Claude Code → `structuredContent`, Claude Desktop → `content[]`); both must carry the same data (enforced at lint time)
|
|
348
|
+
- [ ] NWS API wrap: raw/domain/output schemas reviewed against real upstream sparsity/nullability (many fields are null on incomplete observation reports)
|
|
349
|
+
- [ ] NWS API wrap: normalization and `format()` preserve uncertainty — do not fabricate facts from missing upstream data (a null temperature is not 0)
|
|
350
|
+
- [ ] NWS API wrap: tests include at least one sparse payload case with omitted upstream fields
|
|
329
351
|
- [ ] Registered in `createApp()` arrays (directly or via barrel exports)
|
|
330
352
|
- [ ] Tests use `createMockContext()` from `@cyanheads/mcp-ts-core/testing`
|
|
331
353
|
- [ ] `bun run devcheck` passes
|
package/Dockerfile
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# This stage installs all dependencies (including dev), builds the TypeScript
|
|
5
5
|
# source code into JavaScript, and prepares the production assets.
|
|
6
6
|
# ==============================================================================
|
|
7
|
-
FROM oven/bun:1 AS build
|
|
7
|
+
FROM oven/bun:1.3 AS build
|
|
8
8
|
|
|
9
9
|
WORKDIR /usr/src/app
|
|
10
10
|
|
|
@@ -28,7 +28,7 @@ RUN bun run build
|
|
|
28
28
|
# application. It uses a slim base image and only includes production
|
|
29
29
|
# dependencies and build artifacts.
|
|
30
30
|
# ==============================================================================
|
|
31
|
-
FROM oven/bun:1-slim AS production
|
|
31
|
+
FROM oven/bun:1.3-slim AS production
|
|
32
32
|
|
|
33
33
|
WORKDIR /usr/src/app
|
|
34
34
|
|
package/README.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
8
|
|
|
9
|
-
[](https://www.npmjs.com/package/@cyanheads/nws-weather-mcp-server) [](https://www.npmjs.com/package/@cyanheads/nws-weather-mcp-server) [](./CHANGELOG.md) [](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) [](https://modelcontextprotocol.io/)
|
|
10
10
|
|
|
11
|
-
[](./LICENSE) [](https://www.typescriptlang.org/) [](./LICENSE) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
12
12
|
|
|
13
13
|
</div>
|
|
14
14
|
|
|
@@ -193,7 +193,7 @@ MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
|
|
|
193
193
|
|
|
194
194
|
### Prerequisites
|
|
195
195
|
|
|
196
|
-
- [Node.js
|
|
196
|
+
- [Node.js v24+](https://nodejs.org/) or [Bun v1.3+](https://bun.sh/)
|
|
197
197
|
|
|
198
198
|
### Installation
|
|
199
199
|
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ await createApp({
|
|
|
16
16
|
listAlertTypesTool,
|
|
17
17
|
],
|
|
18
18
|
resources: [alertTypesResource],
|
|
19
|
+
instructions: 'Use the nws_* tools for real-time US weather data from the National Weather Service: forecasts, active alerts, current observations, and station discovery. Coverage is the 50 states, US territories, and adjacent marine areas; the API does not geocode, so resolve place names to latitude/longitude before calling.',
|
|
19
20
|
setup() {
|
|
20
21
|
initNwsService();
|
|
21
22
|
},
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,SAAS,CAAC;IACd,KAAK,EAAE;QACL,eAAe;QACf,gBAAgB;QAChB,mBAAmB;QACnB,gBAAgB;QAChB,kBAAkB;KACnB;IACD,SAAS,EAAE,CAAC,kBAAkB,CAAC;IAC/B,KAAK;QACH,cAAc,EAAE,CAAC;IACnB,CAAC;CACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAC;AACjF,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,SAAS,CAAC;IACd,KAAK,EAAE;QACL,eAAe;QACf,gBAAgB;QAChB,mBAAmB;QACnB,gBAAgB;QAChB,kBAAkB;KACnB;IACD,SAAS,EAAE,CAAC,kBAAkB,CAAC;IAC/B,YAAY,EACV,0TAA0T;IAC5T,KAAK;QACH,cAAc,EAAE,CAAC;IACnB,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* @module mcp-server/resources/definitions/alert-types
|
|
4
4
|
*/
|
|
5
5
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
-
export declare const alertTypesResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{}, z.core.$strip>, undefined>;
|
|
6
|
+
export declare const alertTypesResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<z.ZodObject<{}, z.core.$strip>, undefined, undefined>;
|
|
7
7
|
//# sourceMappingURL=alert-types.resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-types.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/alert-types.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGrD,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"alert-types.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/alert-types.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAGrD,eAAO,MAAM,kBAAkB,2GAsB7B,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module mcp-server/tools/definitions/find-stations
|
|
4
4
|
*/
|
|
5
5
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
6
7
|
export declare const findStationsTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
7
8
|
latitude: z.ZodNumber;
|
|
8
9
|
longitude: z.ZodNumber;
|
|
@@ -11,12 +12,17 @@ export declare const findStationsTool: import("@cyanheads/mcp-ts-core").ToolDefi
|
|
|
11
12
|
stations: z.ZodArray<z.ZodObject<{
|
|
12
13
|
stationId: z.ZodString;
|
|
13
14
|
name: z.ZodString;
|
|
14
|
-
|
|
15
|
+
distanceKm: z.ZodNumber;
|
|
15
16
|
bearing: z.ZodString;
|
|
16
|
-
|
|
17
|
+
elevationM: z.ZodNullable<z.ZodNumber>;
|
|
17
18
|
timeZone: z.ZodString;
|
|
18
19
|
county: z.ZodString;
|
|
19
20
|
forecastZone: z.ZodString;
|
|
20
21
|
}, z.core.$strip>>;
|
|
21
|
-
}, z.core.$strip
|
|
22
|
+
}, z.core.$strip>, readonly [{
|
|
23
|
+
readonly reason: "out_of_scope";
|
|
24
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
25
|
+
readonly when: "Coordinates fall outside US National Weather Service coverage";
|
|
26
|
+
readonly recovery: "Provide coordinates within US states, territories, or adjacent marine areas.";
|
|
27
|
+
}]>;
|
|
22
28
|
//# sourceMappingURL=find-stations.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-stations.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-stations.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"find-stations.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-stations.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;;;;;;;;;;;;;;;;;;;;GAiF3B,CAAC"}
|
|
@@ -3,10 +3,19 @@
|
|
|
3
3
|
* @module mcp-server/tools/definitions/find-stations
|
|
4
4
|
*/
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
6
7
|
import { getNwsService } from '../../../services/nws/nws-service.js';
|
|
7
8
|
export const findStationsTool = tool('nws_find_stations', {
|
|
8
9
|
description: 'Find weather observation stations near a location. Returns stations sorted by proximity with distance and bearing. Use to discover station IDs for nws_get_observations.',
|
|
9
10
|
annotations: { readOnlyHint: true },
|
|
11
|
+
errors: [
|
|
12
|
+
{
|
|
13
|
+
reason: 'out_of_scope',
|
|
14
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
15
|
+
when: 'Coordinates fall outside US National Weather Service coverage',
|
|
16
|
+
recovery: 'Provide coordinates within US states, territories, or adjacent marine areas.',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
10
19
|
input: z.object({
|
|
11
20
|
latitude: z.number().min(-90).max(90).describe('Center latitude for proximity search.'),
|
|
12
21
|
longitude: z.number().min(-180).max(180).describe('Center longitude for proximity search.'),
|
|
@@ -18,9 +27,9 @@ export const findStationsTool = tool('nws_find_stations', {
|
|
|
18
27
|
.object({
|
|
19
28
|
stationId: z.string().describe('Station identifier (e.g., "KSEA")'),
|
|
20
29
|
name: z.string().describe('Station name'),
|
|
21
|
-
|
|
30
|
+
distanceKm: z.number().describe('Distance from query point in kilometers'),
|
|
22
31
|
bearing: z.string().describe('Compass bearing from query point (e.g., "NW")'),
|
|
23
|
-
|
|
32
|
+
elevationM: z.number().nullable().describe('Elevation in meters'),
|
|
24
33
|
timeZone: z.string().describe('IANA time zone'),
|
|
25
34
|
county: z.string().describe('County zone code (e.g., "WAC033")'),
|
|
26
35
|
forecastZone: z.string().describe('Forecast zone code (e.g., "WAZ315")'),
|
|
@@ -34,9 +43,9 @@ export const findStationsTool = tool('nws_find_stations', {
|
|
|
34
43
|
stations: result.stations.map((s) => ({
|
|
35
44
|
stationId: s.stationId,
|
|
36
45
|
name: s.name,
|
|
37
|
-
|
|
46
|
+
distanceKm: s.distance,
|
|
38
47
|
bearing: s.bearing,
|
|
39
|
-
|
|
48
|
+
elevationM: s.elevation.value != null ? Math.round(s.elevation.value) : null,
|
|
40
49
|
timeZone: s.timeZone,
|
|
41
50
|
county: s.county,
|
|
42
51
|
forecastZone: s.forecastZone,
|
|
@@ -53,8 +62,8 @@ export const findStationsTool = tool('nws_find_stations', {
|
|
|
53
62
|
lines.push('| Station | Name | Distance | Bearing | Elevation | Time Zone | County | Zone |');
|
|
54
63
|
lines.push('|:--------|:-----|:---------|:--------|:----------|:----------|:-------|:-----|');
|
|
55
64
|
for (const s of result.stations) {
|
|
56
|
-
const elev = s.
|
|
57
|
-
lines.push(`| ${s.stationId} | ${s.name} | ${s.
|
|
65
|
+
const elev = s.elevationM != null ? `${Math.round(s.elevationM)}m` : '—';
|
|
66
|
+
lines.push(`| ${s.stationId} | ${s.name} | ${s.distanceKm} km | ${s.bearing} | ${elev} | ${s.timeZone} | ${s.county} | ${s.forecastZone} |`);
|
|
58
67
|
}
|
|
59
68
|
return [{ type: 'text', text: lines.join('\n') }];
|
|
60
69
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-stations.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-stations.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAA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MAAM,MAAM,CAAC,CAAC,YAAY,IAAI,CACjI,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module mcp-server/tools/definitions/get-forecast
|
|
4
4
|
*/
|
|
5
5
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
6
7
|
export declare const getForecastTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
7
8
|
latitude: z.ZodNumber;
|
|
8
9
|
longitude: z.ZodNumber;
|
|
@@ -27,9 +28,14 @@ export declare const getForecastTool: import("@cyanheads/mcp-ts-core").ToolDefin
|
|
|
27
28
|
windDirection: z.ZodString;
|
|
28
29
|
shortForecast: z.ZodString;
|
|
29
30
|
detailedForecast: z.ZodString;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
precipChancePct: z.ZodNullable<z.ZodNumber>;
|
|
32
|
+
dewpointC: z.ZodNullable<z.ZodNumber>;
|
|
33
|
+
relativeHumidityPct: z.ZodNullable<z.ZodNumber>;
|
|
33
34
|
}, z.core.$strip>>;
|
|
34
|
-
}, z.core.$strip
|
|
35
|
+
}, z.core.$strip>, readonly [{
|
|
36
|
+
readonly reason: "out_of_scope";
|
|
37
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
38
|
+
readonly when: "Coordinates fall outside US National Weather Service coverage";
|
|
39
|
+
readonly recovery: "Provide coordinates within US states, territories, or adjacent marine areas.";
|
|
40
|
+
}]>;
|
|
35
41
|
//# sourceMappingURL=get-forecast.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-forecast.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-forecast.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-forecast.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-forecast.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAqBjE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsJ1B,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module mcp-server/tools/definitions/get-forecast
|
|
4
4
|
*/
|
|
5
5
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
6
7
|
import { getNwsService } from '../../../services/nws/nws-service.js';
|
|
7
8
|
import { cToF, formatTimestamp, fToC } from '../format-utils.js';
|
|
8
9
|
/**
|
|
@@ -26,6 +27,14 @@ function periodLabel(name, startTime, timeZone) {
|
|
|
26
27
|
export const getForecastTool = tool('nws_get_forecast', {
|
|
27
28
|
description: 'Get the weather forecast for a US location. Returns either named 12-hour periods (default) or hourly breakdowns. Internally resolves coordinates to the NWS grid.',
|
|
28
29
|
annotations: { readOnlyHint: true },
|
|
30
|
+
errors: [
|
|
31
|
+
{
|
|
32
|
+
reason: 'out_of_scope',
|
|
33
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
34
|
+
when: 'Coordinates fall outside US National Weather Service coverage',
|
|
35
|
+
recovery: 'Provide coordinates within US states, territories, or adjacent marine areas.',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
29
38
|
input: z.object({
|
|
30
39
|
latitude: z
|
|
31
40
|
.number()
|
|
@@ -66,9 +75,15 @@ export const getForecastTool = tool('nws_get_forecast', {
|
|
|
66
75
|
windDirection: z.string().describe('Wind direction (e.g., "NW")'),
|
|
67
76
|
shortForecast: z.string().describe('Brief forecast (e.g., "Mostly Sunny")'),
|
|
68
77
|
detailedForecast: z.string().describe('Full narrative forecast'),
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
precipChancePct: z
|
|
79
|
+
.number()
|
|
80
|
+
.nullable()
|
|
81
|
+
.describe('Probability of precipitation in percent (0-100)'),
|
|
82
|
+
dewpointC: z.number().nullable().describe('Dewpoint in Celsius (hourly only)'),
|
|
83
|
+
relativeHumidityPct: z
|
|
84
|
+
.number()
|
|
85
|
+
.nullable()
|
|
86
|
+
.describe('Relative humidity in percent (0-100, hourly only)'),
|
|
72
87
|
})
|
|
73
88
|
.describe('Single forecast period with time range, conditions, and narrative'))
|
|
74
89
|
.describe('Forecast periods'),
|
|
@@ -88,9 +103,9 @@ export const getForecastTool = tool('nws_get_forecast', {
|
|
|
88
103
|
windDirection: p.windDirection,
|
|
89
104
|
shortForecast: p.shortForecast,
|
|
90
105
|
detailedForecast: p.detailedForecast,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
precipChancePct: p.probabilityOfPrecipitation.value,
|
|
107
|
+
dewpointC: p.dewpoint.value != null ? Math.round(p.dewpoint.value * 10) / 10 : null,
|
|
108
|
+
relativeHumidityPct: p.relativeHumidity.value != null ? Math.round(p.relativeHumidity.value * 10) / 10 : null,
|
|
94
109
|
})),
|
|
95
110
|
};
|
|
96
111
|
},
|
|
@@ -108,10 +123,10 @@ export const getForecastTool = tool('nws_get_forecast', {
|
|
|
108
123
|
}
|
|
109
124
|
const periods = result.periods.slice(0, 48);
|
|
110
125
|
for (const p of periods) {
|
|
111
|
-
const precip = p.
|
|
112
|
-
const humidity = p.
|
|
113
|
-
const dew = p.
|
|
114
|
-
? ` | **Dewpoint:** ${cToF(p.
|
|
126
|
+
const precip = p.precipChancePct != null ? ` | **Precip:** ${p.precipChancePct}%` : '';
|
|
127
|
+
const humidity = p.relativeHumidityPct != null ? ` | **Humidity:** ${p.relativeHumidityPct}%` : '';
|
|
128
|
+
const dew = p.dewpointC != null
|
|
129
|
+
? ` | **Dewpoint:** ${cToF(p.dewpointC)}°F (${Math.round(p.dewpointC)}°C)`
|
|
115
130
|
: '';
|
|
116
131
|
const timeRange = `${formatTimestamp(p.startTime, loc.timeZone)} → ${formatTimestamp(p.endTime, loc.timeZone)}`;
|
|
117
132
|
lines.push(`### ${periodLabel(p.name, p.startTime, loc.timeZone)} — ${p.shortForecast}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-forecast.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-forecast.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;;GAIG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,SAAiB,EAAE,QAAgB;IACpE,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9B,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC;IAChD,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE;QAC/B,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,QAAQ;KACT,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,kBAAkB,EAAE;IACtD,WAAW,EACT,mKAAmK;IACrK,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"get-forecast.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-forecast.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,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAEjE;;;;GAIG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,SAAiB,EAAE,QAAgB;IACpE,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IACtB,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9B,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC;IAChD,OAAO,CAAC,CAAC,cAAc,CAAC,OAAO,EAAE;QAC/B,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;QACjB,QAAQ;KACT,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,kBAAkB,EAAE;IACtD,WAAW,EACT,mKAAmK;IACrK,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;IACnC,MAAM,EAAE;QACN;YACE,MAAM,EAAE,cAAc;YACtB,IAAI,EAAE,gBAAgB,CAAC,eAAe;YACtC,IAAI,EAAE,+DAA+D;YACrE,QAAQ,EAAE,8EAA8E;SACzF;KACF;IAED,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,EAAE,CAAC;aACR,GAAG,CAAC,EAAE,CAA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IAAI,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC;YAC7B,MAAM,QAAQ,GACZ,CAAC,CAAC,eAAe,KAAK,GAAG;gBACvB,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,eAAe,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK;gBACpE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,eAAe,GAAG,CAAC;YACzE,KAAK,CAAC,IAAI,CACR,KAAK,QAAQ,kBAAkB,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,aAAa,GAAG,MAAM,GAAG,QAAQ,GAAG,GAAG,EAAE,CAC1F,CAAC;YACF,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;gBACvB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;YACjC,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CACR,WAAW,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,kBAAkB,MAAM,CAAC,OAAO,CAAC,MAAM,WAAW,CACxF,CAAC;QACJ,CAAC;QAED,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module mcp-server/tools/definitions/get-observations
|
|
4
4
|
*/
|
|
5
5
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
6
7
|
export declare const getObservationsTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
7
8
|
latitude: z.ZodOptional<z.ZodNumber>;
|
|
8
9
|
longitude: z.ZodOptional<z.ZodNumber>;
|
|
@@ -13,19 +14,44 @@ export declare const getObservationsTool: import("@cyanheads/mcp-ts-core").ToolD
|
|
|
13
14
|
timestamp: z.ZodString;
|
|
14
15
|
timeZone: z.ZodNullable<z.ZodString>;
|
|
15
16
|
textDescription: z.ZodString;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
temperatureC: z.ZodNullable<z.ZodNumber>;
|
|
18
|
+
dewpointC: z.ZodNullable<z.ZodNumber>;
|
|
19
|
+
windSpeedKmh: z.ZodNullable<z.ZodNumber>;
|
|
20
|
+
windDirectionDeg: z.ZodNullable<z.ZodNumber>;
|
|
21
|
+
windGustKmh: z.ZodNullable<z.ZodNumber>;
|
|
22
|
+
barometricPressurePa: z.ZodNullable<z.ZodNumber>;
|
|
23
|
+
visibilityM: z.ZodNullable<z.ZodNumber>;
|
|
24
|
+
relativeHumidityPct: z.ZodNullable<z.ZodNumber>;
|
|
25
|
+
heatIndexC: z.ZodNullable<z.ZodNumber>;
|
|
26
|
+
windChillC: z.ZodNullable<z.ZodNumber>;
|
|
26
27
|
cloudLayers: z.ZodArray<z.ZodObject<{
|
|
27
28
|
amount: z.ZodString;
|
|
28
|
-
|
|
29
|
+
baseM: z.ZodNullable<z.ZodNumber>;
|
|
29
30
|
}, z.core.$strip>>;
|
|
30
|
-
}, z.core.$strip
|
|
31
|
+
}, z.core.$strip>, readonly [{
|
|
32
|
+
readonly reason: "missing_input";
|
|
33
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
34
|
+
readonly when: "Neither station_id nor a (latitude, longitude) pair was provided";
|
|
35
|
+
readonly recovery: "Provide either station_id or both latitude and longitude.";
|
|
36
|
+
}, {
|
|
37
|
+
readonly reason: "station_not_found";
|
|
38
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
39
|
+
readonly when: "Station ID does not exist in the NWS network";
|
|
40
|
+
readonly recovery: "Use nws_find_stations to discover valid station IDs near a coordinate.";
|
|
41
|
+
}, {
|
|
42
|
+
readonly reason: "no_observations";
|
|
43
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
44
|
+
readonly when: "Station has no recent observations available";
|
|
45
|
+
readonly recovery: "Try a different station — use nws_find_stations to find alternatives nearby.";
|
|
46
|
+
}, {
|
|
47
|
+
readonly reason: "no_stations_nearby";
|
|
48
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
49
|
+
readonly when: "No observation stations exist near the requested coordinates";
|
|
50
|
+
readonly recovery: "Try a different location or broaden the search by moving inland.";
|
|
51
|
+
}, {
|
|
52
|
+
readonly reason: "out_of_scope";
|
|
53
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
54
|
+
readonly when: "Coordinates fall outside US National Weather Service coverage";
|
|
55
|
+
readonly recovery: "Provide coordinates within US states, territories, or adjacent marine areas.";
|
|
56
|
+
}]>;
|
|
31
57
|
//# sourceMappingURL=get-observations.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-observations.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-observations.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"get-observations.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-observations.tool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAyDjE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0M9B,CAAC"}
|