@squawk/mcp 0.8.5 → 0.8.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"flight-math.d.ts","sourceRoot":"","sources":["../../src/tools/flight-math.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAiFzE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAuwB/D"}
1
+ {"version":3,"file":"flight-math.d.ts","sourceRoot":"","sources":["../../src/tools/flight-math.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAkFzE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAuwB/D"}
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { airspeed, atmosphere, descent, glide, magnetic, navigation, planning, solar, turn, wind, } from '@squawk/flight-math';
17
17
  import { z } from 'zod';
18
+ import { extractErrorMessage } from './tool-helpers.js';
18
19
  /** Reusable zod fragment describing a latitude input. */
19
20
  const latFragment = z
20
21
  .number()
@@ -64,7 +65,7 @@ function buildMagneticOptions(altitudeFt, dateUtc) {
64
65
  date = parseIsoDate(dateUtc);
65
66
  }
66
67
  catch (err) {
67
- return { ok: false, message: err instanceof Error ? err.message : String(err) };
68
+ return { ok: false, message: extractErrorMessage(err) };
68
69
  }
69
70
  }
70
71
  const options = {
@@ -437,7 +438,7 @@ export function registerFlightMathTools(server) {
437
438
  date = parseIsoDate(dateUtc);
438
439
  }
439
440
  catch (err) {
440
- const message = err instanceof Error ? err.message : String(err);
441
+ const message = extractErrorMessage(err);
441
442
  return {
442
443
  content: [{ type: 'text', text: message }],
443
444
  structuredContent: { times: null },
@@ -470,7 +471,7 @@ export function registerFlightMathTools(server) {
470
471
  date = parseIsoDate(dateTimeUtc);
471
472
  }
472
473
  catch (err) {
473
- const message = err instanceof Error ? err.message : String(err);
474
+ const message = extractErrorMessage(err);
474
475
  return {
475
476
  content: [{ type: 'text', text: message }],
476
477
  structuredContent: { isDaytime: null },
@@ -33,6 +33,18 @@ export interface ParseRecordErrorSummary {
33
33
  * @returns The errors with each `error` value reduced to its message string.
34
34
  */
35
35
  export declare function summarizeParseErrors(errors: readonly ParseRecordErrorLike[]): ParseRecordErrorSummary[];
36
+ /**
37
+ * Reduces an unknown thrown value to a string message. Used uniformly by tool
38
+ * handlers that catch errors thrown by lower-level parsers so the resulting
39
+ * MCP payloads never leak raw `Error` objects, while non-`Error` throwables
40
+ * (rare, but possible from third-party code) still produce a meaningful
41
+ * message via `String(err)`.
42
+ *
43
+ * @param err - The thrown value caught in a `try`/`catch`.
44
+ * @returns The error's message string when `err` is an `Error`, otherwise
45
+ * `String(err)`.
46
+ */
47
+ export declare function extractErrorMessage(err: unknown): string;
36
48
  /**
37
49
  * Runs a synchronous parser inside a tool handler and packages the outcome
38
50
  * into the MCP result shape. On success the parsed record is returned as
@@ -1 +1 @@
1
- {"version":3,"file":"tool-helpers.d.ts","sourceRoot":"","sources":["../../src/tools/tool-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,KAAK,EAAE,OAAO,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC;IACZ,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,oBAAoB,EAAE,GACtC,uBAAuB,EAAE,CAK3B;AAED;;;;;;;;;;;;;;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M,CAAA;KAAE,EAAE,CAAC;IAC1C,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IAC5C,+DAA+D;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAeA"}
@@ -14,9 +14,23 @@
14
14
  export function summarizeParseErrors(errors) {
15
15
  return errors.map((err) => ({
16
16
  raw: err.raw,
17
- message: err.error instanceof Error ? err.error.message : String(err.error),
17
+ message: extractErrorMessage(err.error),
18
18
  }));
19
19
  }
20
+ /**
21
+ * Reduces an unknown thrown value to a string message. Used uniformly by tool
22
+ * handlers that catch errors thrown by lower-level parsers so the resulting
23
+ * MCP payloads never leak raw `Error` objects, while non-`Error` throwables
24
+ * (rare, but possible from third-party code) still produce a meaningful
25
+ * message via `String(err)`.
26
+ *
27
+ * @param err - The thrown value caught in a `try`/`catch`.
28
+ * @returns The error's message string when `err` is an `Error`, otherwise
29
+ * `String(err)`.
30
+ */
31
+ export function extractErrorMessage(err) {
32
+ return err instanceof Error ? err.message : String(err);
33
+ }
20
34
  /**
21
35
  * Runs a synchronous parser inside a tool handler and packages the outcome
22
36
  * into the MCP result shape. On success the parsed record is returned as
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squawk/mcp",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "type": "module",
5
5
  "description": "Model Context Protocol server exposing squawk's aviation libraries as tools for LLM clients",
6
6
  "author": "Neil Cochran",
@@ -32,7 +32,8 @@
32
32
  ],
33
33
  "scripts": {
34
34
  "build": "tsc && chmod +x dist/bin.js",
35
- "test": "node --test 'dist/**/*.spec.js'",
35
+ "test": "vitest run",
36
+ "test:coverage": "vitest run --coverage",
36
37
  "lint": "tsc --noEmit && eslint src",
37
38
  "lint:pack": "publint && attw --pack . --profile esm-only"
38
39
  },
@@ -50,11 +51,11 @@
50
51
  "@squawk/flightplan": "^0.4.4",
51
52
  "@squawk/geo": "^0.4.0",
52
53
  "@squawk/icao-registry": "^0.3.3",
53
- "@squawk/icao-registry-data": "^0.7.1",
54
+ "@squawk/icao-registry-data": "^0.8.0",
54
55
  "@squawk/navaid-data": "^0.6.1",
55
56
  "@squawk/navaids": "^0.3.4",
56
57
  "@squawk/notams": "^0.3.3",
57
- "@squawk/procedure-data": "^0.6.1",
58
+ "@squawk/procedure-data": "^0.7.0",
58
59
  "@squawk/procedures": "^0.4.3",
59
60
  "@squawk/types": "^0.7.1",
60
61
  "@squawk/weather": "^0.5.2",