@cyanheads/astronomy-mcp-server 0.4.1 → 0.4.2
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 +9 -9
- package/CLAUDE.md +9 -9
- package/Dockerfile +3 -3
- package/README.md +13 -9
- package/changelog/0.4.x/0.4.2.md +37 -0
- package/dist/mcp-server/prompts/definitions/stargazing-plan.prompt.js +1 -1
- package/dist/mcp-server/prompts/definitions/stargazing-plan.prompt.js.map +1 -1
- package/dist/mcp-server/tools/definitions/find-events.tool.d.ts +31 -4
- package/dist/mcp-server/tools/definitions/find-events.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/find-events.tool.js +97 -23
- package/dist/mcp-server/tools/definitions/find-events.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-ephemeris.tool.d.ts +29 -7
- package/dist/mcp-server/tools/definitions/get-ephemeris.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-ephemeris.tool.js +216 -44
- package/dist/mcp-server/tools/definitions/get-ephemeris.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-moon-phase.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-moon-phase.tool.js +1 -0
- package/dist/mcp-server/tools/definitions/get-moon-phase.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-rise-set.tool.d.ts +49 -2
- package/dist/mcp-server/tools/definitions/get-rise-set.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-rise-set.tool.js +85 -43
- package/dist/mcp-server/tools/definitions/get-rise-set.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.d.ts +27 -3
- package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.js +95 -21
- package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-sky-position.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-sky-position.tool.js +1 -0
- package/dist/mcp-server/tools/definitions/get-sky-position.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/list-visible.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-visible.tool.js +1 -0
- package/dist/mcp-server/tools/definitions/list-visible.tool.js.map +1 -1
- package/dist/services/ephemeris/ephemeris-service.d.ts +78 -14
- package/dist/services/ephemeris/ephemeris-service.d.ts.map +1 -1
- package/dist/services/ephemeris/ephemeris-service.js +374 -97
- package/dist/services/ephemeris/ephemeris-service.js.map +1 -1
- package/dist/services/ephemeris/iso-time.d.ts +2 -2
- package/dist/services/ephemeris/iso-time.js +5 -5
- package/dist/services/ephemeris/types.d.ts +42 -1
- package/dist/services/ephemeris/types.d.ts.map +1 -1
- package/dist/services/ephemeris/types.js +16 -0
- package/dist/services/ephemeris/types.js.map +1 -1
- package/dist/services/horizons/horizons-service.d.ts +25 -3
- package/dist/services/horizons/horizons-service.d.ts.map +1 -1
- package/dist/services/horizons/horizons-service.js +154 -15
- package/dist/services/horizons/horizons-service.js.map +1 -1
- package/dist/services/horizons/types.d.ts +8 -4
- package/dist/services/horizons/types.d.ts.map +1 -1
- package/dist/services/satellite/satellite-service.d.ts +48 -10
- package/dist/services/satellite/satellite-service.d.ts.map +1 -1
- package/dist/services/satellite/satellite-service.js +215 -102
- package/dist/services/satellite/satellite-service.js.map +1 -1
- package/dist/services/satellite/types.d.ts +36 -2
- package/dist/services/satellite/types.d.ts.map +1 -1
- package/dist/services/satellite/types.js.map +1 -1
- package/package.json +6 -6
- package/server.json +3 -3
package/AGENTS.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** astronomy-mcp-server
|
|
4
|
-
**Version:** 0.4.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.
|
|
4
|
+
**Version:** 0.4.2
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.15`
|
|
6
6
|
**Engines:** Bun ≥1.4.0, Node ≥24.0.0
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/server` ^2.
|
|
8
|
-
**Zod:** ^4.6.
|
|
7
|
+
**MCP SDK:** `@modelcontextprotocol/server` ^2.3.1
|
|
8
|
+
**Zod:** ^4.6.6
|
|
9
9
|
|
|
10
10
|
> **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.
|
|
11
11
|
|
|
@@ -20,17 +20,17 @@ Observational astronomy, computed in-process. The core is keyless and offline
|
|
|
20
20
|
| Tool | What it computes |
|
|
21
21
|
|:-----|:-----------------|
|
|
22
22
|
| `astronomy_get_sky_position` | Apparent topocentric position of one body or named star — equatorial / horizontal / ecliptic, magnitude, angular diameter, phase, Sun elongation, constellation |
|
|
23
|
-
| `astronomy_get_rise_set` | Rise / set / transit cycles, plus twilight bands for the Sun; circumpolar / never-rises notes |
|
|
23
|
+
| `astronomy_get_rise_set` | Rise / set / transit cycles (31 per call), plus twilight bands for the Sun and `night_in_progress` when the start falls at night; circumpolar / never-rises notes |
|
|
24
24
|
| `astronomy_get_moon_phase` | Phase longitude, illumination, synodic age, next four quarter phases |
|
|
25
|
-
| `astronomy_find_events` | Next N of: equinox, solstice, moon_quarter, lunar/solar eclipse, opposition, conjunction, max_elongation, perigee_apogee |
|
|
25
|
+
| `astronomy_find_events` | Next N (20 per call) of: equinox, solstice, moon_quarter, lunar/solar eclipse, opposition, conjunction (with the Sun, or two bodies via `body2`), max_elongation, perigee_apogee |
|
|
26
26
|
| `astronomy_list_visible` | One-call "what is up now" — naked-eye bodies (+ optional catalog stars) above the horizon, ranked, with a sky-condition gate |
|
|
27
27
|
|
|
28
28
|
Plus the `astronomy://body/{body}` resource (static reference card) and the `astronomy_stargazing_plan` prompt (chains the tools for a "plan tonight from <place>" workflow).
|
|
29
29
|
|
|
30
30
|
**Two gated, network-backed extensions** register only when their env gate is on (default deployment is keyless + offline):
|
|
31
31
|
|
|
32
|
-
- `astronomy_get_ephemeris` — small-body / spacecraft ephemeris from JPL Horizons. Gate: `ASTRONOMY_ENABLE_HORIZONS`.
|
|
33
|
-
- `astronomy_get_satellite_passes` — visible passes via a CelesTrak TLE propagated with SGP4 offline. Gate: `ASTRONOMY_ENABLE_SATELLITES`.
|
|
32
|
+
- `astronomy_get_ephemeris` — small-body / spacecraft ephemeris from JPL Horizons, one page of up to 200 rows per call. Gate: `ASTRONOMY_ENABLE_HORIZONS`.
|
|
33
|
+
- `astronomy_get_satellite_passes` — visible passes (kept by their sunlit, dark-sky stretch, returned as `visible_*`) via a CelesTrak TLE propagated with SGP4 offline, 10 days per call. Gate: `ASTRONOMY_ENABLE_SATELLITES`.
|
|
34
34
|
|
|
35
35
|
Both extension services carry their own timeout + retry boundary, cache nothing on disk (Horizons is stateless; the satellite TLE cache is an in-process TTL `Map`), and degrade loudly — on any upstream failure they catch the framework's status-mapped `McpError` and re-throw a clean typed domain error (`{ reason, recovery }`, no `statusCode` / `responseBody` / `requestId` / internal URL), carrying the original as `cause` for server-side logs only. They never substitute core output.
|
|
36
36
|
|
|
@@ -238,7 +238,7 @@ Handlers throw — the framework catches, classifies, and formats.
|
|
|
238
238
|
|
|
239
239
|
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. The framework puts it on the wire whenever a failure carrying that `reason` arrives without a hint — a bare `ctx.fail('reason')` or a service throw with `data: { reason }` — as `data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim; override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Every error envelope also carries `data.requestId`, the id the server's log records for that call carry, and `content[]` closes with `(reason … · request <id>)`. Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
|
|
240
240
|
|
|
241
|
-
Most of this server's declared reasons are raised below the handler — `EphemerisService.resolveTime()` / `resolveTimezone()` / `lookupStar()`, `resolveBody()`, and the two extension services — and carry their hint inline because those call sites take no `ctx
|
|
241
|
+
Most of this server's declared reasons are raised below the handler — `EphemerisService.resolveTime()` / `resolveTimezone()` / `lookupStar()`, `resolveBody()` / `resolvePair()`, and the two extension services — and carry their hint inline because those call sites take no `ctx` — except `resolveTime()`'s `time_out_of_range`, which carries none, so each calling tool's declared `recovery` fills it (the `start` tools say "start date", and `get_satellite_passes` names the element set's epoch). Those entries are marked `thrownBy: 'service'`; the handler-local preconditions (`find_events`'s `incomplete_observer` and `body_required`, `invalid_target`, the `get_ephemeris` argument gates, `unknown_body`) are the ones that throw through `ctx.fail`. A contract entry whose hint is written at a service throw site must repeat that string verbatim, since nothing links the two — `tests/tools/error-contract-coverage.test.ts` holds both halves of that line.
|
|
242
242
|
|
|
243
243
|
```ts
|
|
244
244
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
package/CLAUDE.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** astronomy-mcp-server
|
|
4
|
-
**Version:** 0.4.
|
|
5
|
-
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.
|
|
4
|
+
**Version:** 0.4.2
|
|
5
|
+
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.13.15`
|
|
6
6
|
**Engines:** Bun ≥1.4.0, Node ≥24.0.0
|
|
7
|
-
**MCP SDK:** `@modelcontextprotocol/server` ^2.
|
|
8
|
-
**Zod:** ^4.6.
|
|
7
|
+
**MCP SDK:** `@modelcontextprotocol/server` ^2.3.1
|
|
8
|
+
**Zod:** ^4.6.6
|
|
9
9
|
|
|
10
10
|
> **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.
|
|
11
11
|
|
|
@@ -20,17 +20,17 @@ Observational astronomy, computed in-process. The core is keyless and offline
|
|
|
20
20
|
| Tool | What it computes |
|
|
21
21
|
|:-----|:-----------------|
|
|
22
22
|
| `astronomy_get_sky_position` | Apparent topocentric position of one body or named star — equatorial / horizontal / ecliptic, magnitude, angular diameter, phase, Sun elongation, constellation |
|
|
23
|
-
| `astronomy_get_rise_set` | Rise / set / transit cycles, plus twilight bands for the Sun; circumpolar / never-rises notes |
|
|
23
|
+
| `astronomy_get_rise_set` | Rise / set / transit cycles (31 per call), plus twilight bands for the Sun and `night_in_progress` when the start falls at night; circumpolar / never-rises notes |
|
|
24
24
|
| `astronomy_get_moon_phase` | Phase longitude, illumination, synodic age, next four quarter phases |
|
|
25
|
-
| `astronomy_find_events` | Next N of: equinox, solstice, moon_quarter, lunar/solar eclipse, opposition, conjunction, max_elongation, perigee_apogee |
|
|
25
|
+
| `astronomy_find_events` | Next N (20 per call) of: equinox, solstice, moon_quarter, lunar/solar eclipse, opposition, conjunction (with the Sun, or two bodies via `body2`), max_elongation, perigee_apogee |
|
|
26
26
|
| `astronomy_list_visible` | One-call "what is up now" — naked-eye bodies (+ optional catalog stars) above the horizon, ranked, with a sky-condition gate |
|
|
27
27
|
|
|
28
28
|
Plus the `astronomy://body/{body}` resource (static reference card) and the `astronomy_stargazing_plan` prompt (chains the tools for a "plan tonight from <place>" workflow).
|
|
29
29
|
|
|
30
30
|
**Two gated, network-backed extensions** register only when their env gate is on (default deployment is keyless + offline):
|
|
31
31
|
|
|
32
|
-
- `astronomy_get_ephemeris` — small-body / spacecraft ephemeris from JPL Horizons. Gate: `ASTRONOMY_ENABLE_HORIZONS`.
|
|
33
|
-
- `astronomy_get_satellite_passes` — visible passes via a CelesTrak TLE propagated with SGP4 offline. Gate: `ASTRONOMY_ENABLE_SATELLITES`.
|
|
32
|
+
- `astronomy_get_ephemeris` — small-body / spacecraft ephemeris from JPL Horizons, one page of up to 200 rows per call. Gate: `ASTRONOMY_ENABLE_HORIZONS`.
|
|
33
|
+
- `astronomy_get_satellite_passes` — visible passes (kept by their sunlit, dark-sky stretch, returned as `visible_*`) via a CelesTrak TLE propagated with SGP4 offline, 10 days per call. Gate: `ASTRONOMY_ENABLE_SATELLITES`.
|
|
34
34
|
|
|
35
35
|
Both extension services carry their own timeout + retry boundary, cache nothing on disk (Horizons is stateless; the satellite TLE cache is an in-process TTL `Map`), and degrade loudly — on any upstream failure they catch the framework's status-mapped `McpError` and re-throw a clean typed domain error (`{ reason, recovery }`, no `statusCode` / `responseBody` / `requestId` / internal URL), carrying the original as `cause` for server-side logs only. They never substitute core output.
|
|
36
36
|
|
|
@@ -238,7 +238,7 @@ Handlers throw — the framework catches, classifies, and formats.
|
|
|
238
238
|
|
|
239
239
|
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, recovery, retryable?, severity?, thrownBy? }]` on `tool()` / `resource()` to receive `ctx.fail(reason, …)` typed against the reason union. TypeScript catches typos at compile time, `data.reason` is auto-populated for observability, linter enforces conformance against the handler body. `recovery` is required (≥ 5 words, lint-validated) — the single source of truth for the agent's next move. The framework puts it on the wire whenever a failure carrying that `reason` arrives without a hint — a bare `ctx.fail('reason')` or a service throw with `data: { reason }` — as `data.recovery.hint`, mirrored into `content[]` text unless the message already contains it verbatim; override with an explicit `{ recovery: { hint: '...' } }` when dynamic runtime context matters. Every error envelope also carries `data.requestId`, the id the server's log records for that call carry, and `content[]` closes with `(reason … · request <id>)`. Mark an entry the service layer throws with `thrownBy: 'service'` so `error-contract-unthrown` skips it — lint-only metadata, nothing at runtime reads it. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`, `RequestCancelled`) bubble freely and don't need declaring.
|
|
240
240
|
|
|
241
|
-
Most of this server's declared reasons are raised below the handler — `EphemerisService.resolveTime()` / `resolveTimezone()` / `lookupStar()`, `resolveBody()`, and the two extension services — and carry their hint inline because those call sites take no `ctx
|
|
241
|
+
Most of this server's declared reasons are raised below the handler — `EphemerisService.resolveTime()` / `resolveTimezone()` / `lookupStar()`, `resolveBody()` / `resolvePair()`, and the two extension services — and carry their hint inline because those call sites take no `ctx` — except `resolveTime()`'s `time_out_of_range`, which carries none, so each calling tool's declared `recovery` fills it (the `start` tools say "start date", and `get_satellite_passes` names the element set's epoch). Those entries are marked `thrownBy: 'service'`; the handler-local preconditions (`find_events`'s `incomplete_observer` and `body_required`, `invalid_target`, the `get_ephemeris` argument gates, `unknown_body`) are the ones that throw through `ctx.fail`. A contract entry whose hint is written at a service throw site must repeat that string verbatim, since nothing links the two — `tests/tools/error-contract-coverage.test.ts` holds both halves of that line.
|
|
242
242
|
|
|
243
243
|
```ts
|
|
244
244
|
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
package/Dockerfile
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# output. A stage that compiles a native addon needs the target-arch toolchain
|
|
15
15
|
# and cannot cross-compile this way — drop the flag there.
|
|
16
16
|
# ==============================================================================
|
|
17
|
-
FROM --platform=$BUILDPLATFORM oven/bun:1.4.
|
|
17
|
+
FROM --platform=$BUILDPLATFORM oven/bun:1.4.3 AS build
|
|
18
18
|
|
|
19
19
|
WORKDIR /usr/src/app
|
|
20
20
|
|
|
@@ -46,7 +46,7 @@ RUN bun run build
|
|
|
46
46
|
# A clean image rather than `FROM build`: the build stage's node_modules holds
|
|
47
47
|
# devDependencies.
|
|
48
48
|
# ==============================================================================
|
|
49
|
-
FROM --platform=$BUILDPLATFORM oven/bun:1.4.
|
|
49
|
+
FROM --platform=$BUILDPLATFORM oven/bun:1.4.3 AS deps
|
|
50
50
|
|
|
51
51
|
WORKDIR /usr/src/app
|
|
52
52
|
|
|
@@ -113,7 +113,7 @@ RUN rm -rf node_modules/@socketsecurity/bun-security-scanner
|
|
|
113
113
|
# dependencies and build artifacts. Its only Bun invocations are HEALTHCHECK
|
|
114
114
|
# and CMD, which run on the real target at container start.
|
|
115
115
|
# ==============================================================================
|
|
116
|
-
FROM oven/bun:1.4.
|
|
116
|
+
FROM oven/bun:1.4.3-slim AS production
|
|
117
117
|
|
|
118
118
|
WORKDIR /usr/src/app
|
|
119
119
|
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/astronomy-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/astronomy-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -71,9 +71,11 @@ Design reference: [`docs/design.md`](./docs/design.md).
|
|
|
71
71
|
|
|
72
72
|
### `astronomy_get_rise_set` <sub>tool</sub>
|
|
73
73
|
|
|
74
|
-
- One `body` searched forward from `start` (default now) for the next `count` cycles, default 1,
|
|
74
|
+
- One `body` searched forward from `start` (default now) for the next `count` cycles, default 1; 31 are served per call, and a `count` up to 366 returns the first 31 with a notice naming the `start` and `count` that continue the series (or saying none can, once the next cycle falls after 2100)
|
|
75
75
|
- Each cycle carries `rise_utc`, `set_utc`, `transit_utc`, and `transit_altitude_degrees`; a circumpolar or never-rising body gets `null` rise/set and a `note` instead of an error, and one already up at `start` gets a `null` `rise_utc`
|
|
76
|
-
- For `body: "sun"`, a `twilight` block holds `civil`, `nautical`, and `astronomical` pairs covering the night after that cycle's set, so each `dawn_utc` falls the day after the cycle's rise
|
|
76
|
+
- For `body: "sun"`, a `twilight` block holds `civil`, `nautical`, and `astronomical` pairs covering the night after that cycle's set (after its culmination when it has none), so each `dawn_utc` falls the day after the cycle's rise; each pair is bounded to its own night, so a depth the night never reaches is `null`
|
|
77
|
+
- A `start` between sunset and sunrise adds `night_in_progress`, the night already under way (its dusk may precede `start`), because the first cycle then opens at the next sunrise; a continuation call repeats there the night the previous call's last cycle carried
|
|
78
|
+
- One cycle covers one day: a day the body neither rises nor sets on (polar night, midnight sun) is a cycle of its own, so each night appears in exactly one cycle; a start in the afternoon of a polar-night day opens with the rest of that day (rise, set, and transit `null`) and its night
|
|
77
79
|
|
|
78
80
|
---
|
|
79
81
|
|
|
@@ -86,8 +88,9 @@ Design reference: [`docs/design.md`](./docs/design.md).
|
|
|
86
88
|
|
|
87
89
|
### `astronomy_find_events` <sub>tool</sub>
|
|
88
90
|
|
|
89
|
-
- One `event` (`solar_eclipse`, `lunar_eclipse`, `equinox`, `solstice`, `moon_quarter`, `opposition`, `conjunction`, `max_elongation`, `perigee_apogee`) and the next `count` occurrences, default 1,
|
|
91
|
+
- One `event` (`solar_eclipse`, `lunar_eclipse`, `equinox`, `solstice`, `moon_quarter`, `opposition`, `conjunction`, `max_elongation`, `perigee_apogee`) and the next `count` occurrences, default 1; 20 are served per call, and a `count` up to 200 returns the first 20 with a notice naming the `start` and `count` that continue the series; searches stop at the end of 2100, with a notice when that returns fewer
|
|
90
92
|
- Body-relative events require `body` (`body_required`), and a body the event doesn't apply to fails as `body_not_supported`: `opposition` takes mars through pluto, `conjunction` any planet, `max_elongation` mercury or venus, and `perigee_apogee` the moon, `earth`, or a planet; `apsis_kind` and `conjunction_kind` label which kind came back
|
|
93
|
+
- `conjunction` with `body` alone is that planet's conjunction with the Sun; adding `body2` (the Moon or a planet, different from `body`) finds the instant the two share an ecliptic longitude seen from Earth's center and reports `separation_degrees` at that instant, which is not always their closest approach. `body2` with any other event, the same body twice, or a `sun`/`earth` `body` fails as `invalid_body_pair`
|
|
91
94
|
- Eclipses take an optional observer (`latitude` and `longitude` together, else `incomplete_observer`) that adds `local_visible` and `contact_altitudes_degrees` and limits `solar_eclipse` to locally visible events; a global solar search reports `peak_latitude_degrees`/`peak_longitude_degrees` for total and annular eclipses
|
|
92
95
|
|
|
93
96
|
---
|
|
@@ -101,16 +104,17 @@ Design reference: [`docs/design.md`](./docs/design.md).
|
|
|
101
104
|
|
|
102
105
|
### `astronomy_get_ephemeris` <sub>tool</sub>
|
|
103
106
|
|
|
104
|
-
- `designation` is passed to Horizons verbatim (`"433;"` for a numbered asteroid, `"DES=1P;CAP"` for a periodic comet, a negative SPK-ID for a spacecraft); `start` defaults to now, `stop` to 24 h later, and `step` to `"1h"` (a count plus `m`, `h`, `d`, `mo`, or `y`); `latitude` and `longitude` together add alt/az
|
|
105
|
-
-
|
|
107
|
+
- `designation` is passed to Horizons verbatim (`"433;"` for a numbered asteroid, `"DES=1P;CAP"` for a periodic comet, a negative SPK-ID for a spacecraft); `start` defaults to now, `stop` to 24 h later, and `step` to `"1h"` (a count plus `m`, `h`, `d`, `mo`, or `y`); `latitude` and `longitude` together add alt/az, with `elevation` then limited to the observer altitudes Horizons accepts (`invalid_elevation` outside them; a geocentric request ignores it)
|
|
108
|
+
- One page of up to 200 rows per call, and when `truncated` is true the notice names the `start` to resume from; `stop` equal to `start` returns the single row at that instant; `step` counts can be any positive integer up to 2147483647, months and years follow the calendar from `start`, and fractional seconds in `start` are kept; `start` and `stop` are Gregorian dates (extended before 1582) in years 0100 through 9999
|
|
109
|
+
- `target_name` is the object Horizons resolved, since a bare name can land on the wrong one; a name matching several major bodies fails as `ambiguous_designation` listing each ID number, Earth fails as `observer_is_target`, and a designation with an apostrophe or any character outside printable ASCII fails as `body_not_found` (use `DES=6P;CAP`, not `6P/d'Arrest`, and `2867;`, not `Šteins`); misses fail as `body_not_found`, a `step` longer than the target's data as `invalid_step`, spans outside the target's Horizons data as `time_out_of_range`, and a value Horizons refuses outright as `request_rejected`, which names the input to correct
|
|
106
110
|
- Registered only when `ASTRONOMY_ENABLE_HORIZONS=true`
|
|
107
111
|
|
|
108
112
|
---
|
|
109
113
|
|
|
110
114
|
### `astronomy_get_satellite_passes` <sub>tool</sub>
|
|
111
115
|
|
|
112
|
-
- Exactly one of `norad_id` or `name` (ISS, Hubble/HST, and Tiangong/CSS resolve directly; other names are substring-matched against CelesTrak, and an ambiguous one fails as `ambiguous_satellite_name` listing candidates); `start` must be within about a month of today, and `days` defaults to 7,
|
|
113
|
-
- Returns `norad_id`, `satellite_name`, and
|
|
116
|
+
- Exactly one of `norad_id` or `name` (ISS, Hubble/HST, and Tiangong/CSS resolve directly; other names are substring-matched against CelesTrak, and an ambiguous one fails as `ambiguous_satellite_name` listing candidates); `start` must be within about a month of today, and `days` defaults to 7; 10 are searched per call, and a `days` up to 30 searches the first 10 with a notice naming the `start` and `days` that continue the search, or saying none can when that start would lie more than about a month from the element set's epoch
|
|
117
|
+
- Returns `norad_id`, `satellite_name`, and `passes` kept by their visible stretch (satellite above the horizon and sunlit while the Sun is below −6°, reaching 10° elevation), each with rise/peak/set times (within 1 s) and azimuths, `peak_altitude_degrees`, `duration_seconds`, `sunlit` (illumination at the peak, so it can be `false` on a pass seen only before or after the satellite crosses Earth's shadow), and the stretch itself as `visible_start_utc`/`visible_end_utc` with their `_local`, altitude, and azimuth fields
|
|
114
118
|
- Registered only when `ASTRONOMY_ENABLE_SATELLITES=true`
|
|
115
119
|
|
|
116
120
|
---
|
|
@@ -125,7 +129,7 @@ Design reference: [`docs/design.md`](./docs/design.md).
|
|
|
125
129
|
### `astronomy_stargazing_plan` <sub>prompt</sub>
|
|
126
130
|
|
|
127
131
|
- Arguments: `location` required; `date` (`YYYY-MM-DD`) optional, defaults to tonight
|
|
128
|
-
- Returns one user message that chains `astronomy_get_rise_set` (sun, then moon), `astronomy_get_moon_phase`, and `astronomy_list_visible` with `include_stars`, anchored to the observer's local night, plus the geocoding and weather steps this server doesn't cover
|
|
132
|
+
- Returns one user message that chains `astronomy_get_rise_set` (sun, then moon), `astronomy_get_moon_phase`, and `astronomy_list_visible` with `include_stars`, anchored to the observer's local night (reading `night_in_progress` when the sun query starts after sunset), plus the geocoding and weather steps this server doesn't cover
|
|
129
133
|
|
|
130
134
|
## Features
|
|
131
135
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Two-body conjunctions in astronomy_find_events, per-call caps with continuation notices on rise/set, events, and satellite passes, night_in_progress and polar-day cycles in astronomy_get_rise_set, a visible-stretch pass rule for satellites, and Horizons paging, refusal, and calendar fixes."
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.4.2 — 2026-10-15
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`astronomy_find_events` `body2`** — a `conjunction` of two bodies (the Moon or a planet with another), found where they share an ecliptic longitude seen from Earth's center. Events carry `body2` and `separation_degrees`; `invalid_body_pair` rejects `body2` with another event, the same body twice, or a `sun`/`earth` `body`. (#51)
|
|
12
|
+
- **`astronomy_get_rise_set` `night_in_progress`** — for the Sun, a `start` between sunset and sunrise returns the night already under way (dusk through dawn, times before `start` included), since the first cycle then opens at the next sunrise. (#49)
|
|
13
|
+
- **`astronomy_get_satellite_passes` visible stretch** — each pass carries `visible_start_utc`/`visible_end_utc` with `_local`, altitude, and azimuth fields. (#47)
|
|
14
|
+
- **Typed Horizons refusals** — `ambiguous_designation` lists the candidate ID numbers of a name matching several major bodies, `observer_is_target` rejects Earth, `invalid_elevation` rejects observer elevations Horizons refuses, and `request_rejected` names the input of a request Horizons refuses with HTTP 400. `invalid_step` also covers a step longer than the target's data and a count past 2147483647. (#53)
|
|
15
|
+
|
|
16
|
+
## Changed
|
|
17
|
+
|
|
18
|
+
- **Per-call caps** — `astronomy_get_rise_set` `count` accepts up to 366 (31 cycles per call), `astronomy_find_events` `count` up to 200 (20 per call), and `astronomy_get_satellite_passes` `days` up to 30 (10 per call). A capped call returns a notice naming the exact `start` and `count`/`days` that continue the series, or saying no call can when the continuation falls past 2100 or beyond the element set's epoch horizon. Eclipse continuations resume 10 days past the last event. (#50)
|
|
19
|
+
- **`astronomy_get_satellite_passes` pass rule** — a pass is kept when its visible stretch (above the horizon, sunlit, Sun below −6°) reaches 10° elevation, wherever in the pass that falls; `sunlit` still reports the peak instant. Rise, set, and visible-stretch edges are bisected to 1 s. (#47, #52)
|
|
20
|
+
- **`astronomy_get_rise_set` twilight** — each cycle's pairs are bounded to their own night, so a depth the night never reaches is `null`. (#56)
|
|
21
|
+
- **`astronomy_get_rise_set` polar days** — a day with no rise or set (polar night, midnight sun) is a cycle of its own, so consecutive cycles are consecutive days and each night appears in exactly one. (#60)
|
|
22
|
+
- **`astronomy_get_ephemeris` request shape** — one request asks Horizons for one page, with `STOP_TIME` clamped to the 201st row, rather than the whole span. (#48)
|
|
23
|
+
- **`astronomy_get_ephemeris` dates** — `start` and `stop` are Gregorian (extended before 1582) in years 0100 through 9999; fractional seconds in `start` are kept; `stop` equal to `start` returns the single row at that instant. (#55, #57, #58)
|
|
24
|
+
- **`time_out_of_range` recovery** — a year-span rejection from any tool carries that tool's declared recovery on the wire; the satellite tool's declared hint covers both its year-span and epoch-distance checks. (#61)
|
|
25
|
+
- **Docs** — README, `docs/design.md`, `CLAUDE.md`, and `AGENTS.md` describe the changes above; the `astronomy_stargazing_plan` prompt reads `night_in_progress` when the sun query starts after sunset.
|
|
26
|
+
|
|
27
|
+
## Fixed
|
|
28
|
+
|
|
29
|
+
- **`astronomy_get_ephemeris` calendar-step resume** — a `mo` or `y` step with a count above 1 resumes on the row Horizons prints next, where it previously skipped rows (`5mo` from Jan 31 prints Jul 31). (#54)
|
|
30
|
+
- **`astronomy_get_ephemeris` apostrophes and non-ASCII designations** — a designation with an apostrophe (`6P/d'Arrest`) or a character outside printable ASCII (`Šteins`) fails as `body_not_found` naming the record-resolving form (`DES=6P;CAP`, `2867;`), where Horizons searched the text before the apostrophe. (#59)
|
|
31
|
+
|
|
32
|
+
## Dependencies
|
|
33
|
+
|
|
34
|
+
- `@cyanheads/mcp-ts-core` ^0.13.14 → ^0.13.15; `@modelcontextprotocol/server` ^2.2.0 → ^2.3.1 comes in through the framework.
|
|
35
|
+
- Bun 1.4.2 → 1.4.3 (`packageManager`, the Dockerfile `oven/bun` base images, README badge).
|
|
36
|
+
- `zod` ^4.6.5 → ^4.6.6; dev `@types/node` ^26.6.4 → ^26.6.5, `vitest` ^5.0.3 → ^5.0.4.
|
|
37
|
+
- `framework-skills/` re-synced to mcp-ts-core 0.13.15.
|
|
@@ -33,7 +33,7 @@ export const stargazingPlanPrompt = prompt('astronomy_stargazing_plan', {
|
|
|
33
33
|
'Using the location and date above, work through these steps in order:',
|
|
34
34
|
'',
|
|
35
35
|
`1. Resolve the location to latitude/longitude with a geocoding tool (e.g. openstreetmap_search_places), and its IANA timezone with a timezone lookup (e.g. ref_timezone_lookup, given the place's city or region). This astronomy server does not geocode. Pass that zone as the \`timezone\` parameter on every astronomy call below: without it the tools answer in UTC only, and you cannot tell which local night a returned instant belongs to.`,
|
|
36
|
-
`2. Call astronomy_get_rise_set with body "sun" at those coordinates for the local evening of <date> in that timezone, to find sunset and the astronomical-dusk time (the start of the dark window). Anchor <date> in the observer's zone, not UTC — resolving it against UTC midnight lands on the adjacent local night for any observer far enough from Greenwich.`,
|
|
36
|
+
`2. Call astronomy_get_rise_set with body "sun" at those coordinates for the local evening of <date> in that timezone, to find sunset and the astronomical-dusk time (the start of the dark window). Anchor <date> in the observer's zone, not UTC — resolving it against UTC midnight lands on the adjacent local night for any observer far enough from Greenwich. If the call's \`start\` falls after sunset, read that night's dusk and dawn from \`night_in_progress\`: the first cycle then opens at the next sunrise, and its twilight is the following night's.`,
|
|
37
37
|
`3. Call astronomy_get_moon_phase for <date> and note the illuminated fraction — a bright moon washes out faint objects.`,
|
|
38
38
|
`4. Call astronomy_get_rise_set with body "moon" at those coordinates across the same local <date> night in that timezone, to get moonrise and moonset, then compare them against the dark window from step 2. Phase alone is geocentric and does not say whether the moon is above the observer's horizon; a full moon that has already set does not interfere.`,
|
|
39
39
|
`5. Call astronomy_list_visible at those coordinates with \`include_stars\` set to true, at a time just after the astronomical dusk found in step 2 on the local <date> night in that timezone, to get the ranked list of what is up. The tool omits the bundled bright-star catalog unless \`include_stars\` is true, so leaving it off returns solar-system bodies only — not the named stars a stargazer is most likely to be asking about.`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stargazing-plan.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/stargazing-plan.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,2BAA2B,EAAE;IACtE,WAAW,EACT,8TAA8T;IAChU,KAAK,EAAE,+CAA+C;IACtD,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,QAAQ,CAAC,oEAAoE,CAAC;QACjF,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,4EAA4E,CAAC;KAC1F,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC;QACzC,MAAM,IAAI,GAAG;YACX,yCAAyC;YACzC,EAAE;YACF,iNAAiN;YACjN,EAAE;YACF,aAAa,IAAI,CAAC,QAAQ,aAAa;YACvC,SAAS,SAAS,SAAS;YAC3B,EAAE;YACF,uEAAuE;YACvE,EAAE;YACF,sbAAsb;YACtb,
|
|
1
|
+
{"version":3,"file":"stargazing-plan.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/stargazing-plan.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,2BAA2B,EAAE;IACtE,WAAW,EACT,8TAA8T;IAChU,KAAK,EAAE,+CAA+C;IACtD,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,QAAQ,EAAE,CAAC;aACR,MAAM,EAAE;aACR,QAAQ,CAAC,oEAAoE,CAAC;QACjF,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,4EAA4E,CAAC;KAC1F,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC;QACzC,MAAM,IAAI,GAAG;YACX,yCAAyC;YACzC,EAAE;YACF,iNAAiN;YACjN,EAAE;YACF,aAAa,IAAI,CAAC,QAAQ,aAAa;YACvC,SAAS,SAAS,SAAS;YAC3B,EAAE;YACF,uEAAuE;YACvE,EAAE;YACF,sbAAsb;YACtb,wiBAAwiB;YACxiB,yHAAyH;YACzH,iWAAiW;YACjW,+aAA+a;YAC/a,+KAA+K;YAC/K,EAAE;YACF,uOAAuO;SACxO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
* @fileoverview astronomy_find_events — consolidated forward search for nine event
|
|
3
3
|
* classes under one `event` enum. Both eclipse classes take an optional observer:
|
|
4
4
|
* solar eclipses are global without one and local with one, and lunar eclipses gain
|
|
5
|
-
* the Moon's altitude at each contact. Every other class is geocentric
|
|
6
|
-
*
|
|
5
|
+
* the Moon's altitude at each contact. Every other class is geocentric; `body2` turns a
|
|
6
|
+
* conjunction with the Sun into one of two bodies. Every search stops at the end of the
|
|
7
|
+
* supported span, with a notice when that cuts a list short, and serves at most
|
|
8
|
+
* `EVENTS_PER_CALL` events per call with a notice naming the `start` and `count` that
|
|
9
|
+
* continue.
|
|
7
10
|
* Validation gates fail fast when an event needs a body that was not supplied, when an
|
|
8
11
|
* eclipse observer is half-specified, or when the body has no such event.
|
|
9
12
|
* @module mcp-server/tools/definitions/find-events.tool
|
|
@@ -45,6 +48,8 @@ export declare const FindEventsOutput: z.ZodObject<{
|
|
|
45
48
|
new: "new";
|
|
46
49
|
}>>;
|
|
47
50
|
body: z.ZodOptional<z.ZodString>;
|
|
51
|
+
body2: z.ZodOptional<z.ZodString>;
|
|
52
|
+
separation_degrees: z.ZodOptional<z.ZodNumber>;
|
|
48
53
|
conjunction_kind: z.ZodOptional<z.ZodEnum<{
|
|
49
54
|
inferior: "inferior";
|
|
50
55
|
superior: "superior";
|
|
@@ -92,6 +97,17 @@ export declare const findEventsTool: import("@cyanheads/mcp-ts-core").ToolDefini
|
|
|
92
97
|
uranus: "uranus";
|
|
93
98
|
venus: "venus";
|
|
94
99
|
}>>;
|
|
100
|
+
body2: z.ZodOptional<z.ZodEnum<{
|
|
101
|
+
jupiter: "jupiter";
|
|
102
|
+
mars: "mars";
|
|
103
|
+
mercury: "mercury";
|
|
104
|
+
moon: "moon";
|
|
105
|
+
neptune: "neptune";
|
|
106
|
+
pluto: "pluto";
|
|
107
|
+
saturn: "saturn";
|
|
108
|
+
uranus: "uranus";
|
|
109
|
+
venus: "venus";
|
|
110
|
+
}>>;
|
|
95
111
|
latitude: z.ZodOptional<z.ZodNumber>;
|
|
96
112
|
longitude: z.ZodOptional<z.ZodNumber>;
|
|
97
113
|
elevation: z.ZodDefault<z.ZodNumber>;
|
|
@@ -131,6 +147,8 @@ export declare const findEventsTool: import("@cyanheads/mcp-ts-core").ToolDefini
|
|
|
131
147
|
new: "new";
|
|
132
148
|
}>>;
|
|
133
149
|
body: z.ZodOptional<z.ZodString>;
|
|
150
|
+
body2: z.ZodOptional<z.ZodString>;
|
|
151
|
+
separation_degrees: z.ZodOptional<z.ZodNumber>;
|
|
134
152
|
conjunction_kind: z.ZodOptional<z.ZodEnum<{
|
|
135
153
|
inferior: "inferior";
|
|
136
154
|
superior: "superior";
|
|
@@ -162,8 +180,14 @@ export declare const findEventsTool: import("@cyanheads/mcp-ts-core").ToolDefini
|
|
|
162
180
|
}, {
|
|
163
181
|
readonly reason: "body_not_supported";
|
|
164
182
|
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
165
|
-
readonly when: "The body has no such event — opposition for the Sun, Moon, Earth, or an inner planet; conjunction for the Sun, Moon, or Earth; max_elongation for anything but mercury or venus; perigee_apogee for the Sun.";
|
|
166
|
-
readonly recovery: "Pick a body the event is defined for: a superior planet (mars through pluto) for opposition, any planet for conjunction, mercury or venus for max_elongation, and the moon, earth, or a planet for perigee_apogee.";
|
|
183
|
+
readonly when: "The body has no such event — opposition for the Sun, Moon, Earth, or an inner planet; conjunction without `body2` for the Sun, Moon, or Earth; max_elongation for anything but mercury or venus; perigee_apogee for the Sun.";
|
|
184
|
+
readonly recovery: "Pick a body the event is defined for: a superior planet (mars through pluto) for opposition, any planet for conjunction (or the Moon with a planet as body2), mercury or venus for max_elongation, and the moon, earth, or a planet for perigee_apogee.";
|
|
185
|
+
readonly thrownBy: "service";
|
|
186
|
+
}, {
|
|
187
|
+
readonly reason: "invalid_body_pair";
|
|
188
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
189
|
+
readonly when: "`body2` was supplied with an event other than conjunction, names the same body as `body`, or is paired with a `body` of sun or earth.";
|
|
190
|
+
readonly recovery: "body2 applies only to event \"conjunction\" and pairs two different bodies among the Moon and the planets (mercury through pluto). For a planet's conjunction with the Sun, pass the planet as body and omit body2; for the Moon's, search moon_quarter for the new moon.";
|
|
167
191
|
readonly thrownBy: "service";
|
|
168
192
|
}, {
|
|
169
193
|
readonly reason: "invalid_time";
|
|
@@ -185,6 +209,9 @@ export declare const findEventsTool: import("@cyanheads/mcp-ts-core").ToolDefini
|
|
|
185
209
|
readonly thrownBy: "service";
|
|
186
210
|
}], {
|
|
187
211
|
readonly totalCount: z.ZodNumber;
|
|
212
|
+
readonly truncated: z.ZodOptional<z.ZodBoolean>;
|
|
213
|
+
readonly shown: z.ZodOptional<z.ZodNumber>;
|
|
214
|
+
readonly cap: z.ZodOptional<z.ZodNumber>;
|
|
188
215
|
readonly notice: z.ZodOptional<z.ZodString>;
|
|
189
216
|
}>;
|
|
190
217
|
//# sourceMappingURL=find-events.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find-events.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-events.tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"find-events.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-events.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA6CjE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0H3B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEpE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgSzB,CAAC"}
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
* @fileoverview astronomy_find_events — consolidated forward search for nine event
|
|
3
3
|
* classes under one `event` enum. Both eclipse classes take an optional observer:
|
|
4
4
|
* solar eclipses are global without one and local with one, and lunar eclipses gain
|
|
5
|
-
* the Moon's altitude at each contact. Every other class is geocentric
|
|
6
|
-
*
|
|
5
|
+
* the Moon's altitude at each contact. Every other class is geocentric; `body2` turns a
|
|
6
|
+
* conjunction with the Sun into one of two bodies. Every search stops at the end of the
|
|
7
|
+
* supported span, with a notice when that cuts a list short, and serves at most
|
|
8
|
+
* `EVENTS_PER_CALL` events per call with a notice naming the `start` and `count` that
|
|
9
|
+
* continue.
|
|
7
10
|
* Validation gates fail fast when an event needs a body that was not supplied, when an
|
|
8
11
|
* eclipse observer is half-specified, or when the body has no such event.
|
|
9
12
|
* @module mcp-server/tools/definitions/find-events.tool
|
|
@@ -13,14 +16,34 @@ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
|
13
16
|
import { getServerConfig } from '../../../config/server-config.js';
|
|
14
17
|
import { num, pct, sig } from '../format-numbers.js';
|
|
15
18
|
import { getEphemerisService, SUPPORTED_SPAN } from '../../../services/ephemeris/ephemeris-service.js';
|
|
16
|
-
import { EVENT_BODY_NAMES, EVENT_NAMES } from '../../../services/ephemeris/types.js';
|
|
19
|
+
import { EVENT_BODY_NAMES, EVENT_NAMES, PAIR_BODY_NAMES, } from '../../../services/ephemeris/types.js';
|
|
20
|
+
/** Events computed per call; a larger `count` is served this many with a resume notice. */
|
|
21
|
+
const EVENTS_PER_CALL = 20;
|
|
22
|
+
/** Largest `count` accepted. Past it the schema rejects. */
|
|
23
|
+
const EVENTS_COUNT_CEILING = 200;
|
|
24
|
+
/**
|
|
25
|
+
* How far past the last returned event the resume `start` falls for every class but the
|
|
26
|
+
* eclipses. A second is too close for a search that can find the event it starts on
|
|
27
|
+
* again; an hour clears that and stays well under the closest spacing of two consecutive
|
|
28
|
+
* events of one search, about a day and a half.
|
|
29
|
+
*/
|
|
30
|
+
const RESUME_OFFSET_MS = 3_600_000;
|
|
31
|
+
/**
|
|
32
|
+
* The resume offset for both eclipse classes: ten days, the step astronomy-engine's own
|
|
33
|
+
* `Next*Eclipse` takes from one peak to the next search, so a continued series is the one
|
|
34
|
+
* a single search returns. Each eclipse search restarts at the next new or full moon after
|
|
35
|
+
* its start, and a local solar eclipse can peak more than two hours before the geocentric
|
|
36
|
+
* new moon, so an hour past it is still before that new moon and finds the same eclipse.
|
|
37
|
+
* Consecutive eclipses of one class lie at least 29 days apart, so none is skipped.
|
|
38
|
+
*/
|
|
39
|
+
const ECLIPSE_RESUME_OFFSET_MS = 10 * 86_400_000;
|
|
17
40
|
const BODY_EVENTS = new Set([
|
|
18
41
|
'opposition',
|
|
19
42
|
'conjunction',
|
|
20
43
|
'max_elongation',
|
|
21
44
|
'perigee_apogee',
|
|
22
45
|
]);
|
|
23
|
-
/** The event classes whose records an observer changes. */
|
|
46
|
+
/** The event classes whose records an observer changes, and that resume ten days on. */
|
|
24
47
|
const ECLIPSE_EVENTS = new Set(['solar_eclipse', 'lunar_eclipse']);
|
|
25
48
|
export const FindEventsOutput = z.object({
|
|
26
49
|
events: z
|
|
@@ -72,11 +95,19 @@ export const FindEventsOutput = z.object({
|
|
|
72
95
|
body: z
|
|
73
96
|
.string()
|
|
74
97
|
.optional()
|
|
75
|
-
.describe('The target body. Present for opposition/conjunction/max_elongation/perigee_apogee.'),
|
|
98
|
+
.describe('The target body — the first of the pair for a two-body conjunction. Present for opposition/conjunction/max_elongation/perigee_apogee.'),
|
|
99
|
+
body2: z
|
|
100
|
+
.string()
|
|
101
|
+
.optional()
|
|
102
|
+
.describe('The second body of a two-body conjunction, as requested. Present only when `body2` was supplied.'),
|
|
103
|
+
separation_degrees: z
|
|
104
|
+
.number()
|
|
105
|
+
.optional()
|
|
106
|
+
.describe("Angular separation in degrees between body and body2 seen from Earth's center at the conjunction instant. Not always their closest approach: two planets can pass closer days or weeks away. Present only for a two-body conjunction."),
|
|
76
107
|
conjunction_kind: z
|
|
77
108
|
.enum(['inferior', 'superior'])
|
|
78
109
|
.optional()
|
|
79
|
-
.describe('Whether the planet passes between Earth and the Sun (inferior) or behind the Sun (superior). Present only for mercury and venus conjunctions, the two bodies that reach both.'),
|
|
110
|
+
.describe('Whether the planet passes between Earth and the Sun (inferior) or behind the Sun (superior). Present only for mercury and venus conjunctions with the Sun, the two bodies that reach both.'),
|
|
80
111
|
elongation_degrees: z
|
|
81
112
|
.number()
|
|
82
113
|
.optional()
|
|
@@ -103,7 +134,7 @@ export const FindEventsOutput = z.object({
|
|
|
103
134
|
});
|
|
104
135
|
export const findEventsTool = tool('astronomy_find_events', {
|
|
105
136
|
title: 'astronomy-mcp-server: find sky events',
|
|
106
|
-
description: "Search forward from a start time for the next occurrences of one sky-event class, selected by the `event` enum: solar_eclipse, lunar_eclipse, equinox, solstice, moon_quarter, opposition, conjunction, max_elongation, or perigee_apogee. Both eclipse classes take an optional observer (latitude and longitude together). solar_eclipse without one returns global eclipses — kind, peak time, obscuration, and for a total or annular eclipse the latitude/longitude where it is greatest; with one it returns only eclipses visible from that point, with local contact times, `local_visible`, and the Sun's altitude at each contact. lunar_eclipse returns geocentric contact times, the same instants everywhere on Earth; an observer adds `local_visible` and the Moon's altitude at each contact. Every other class is geocentric and ignores a location. The body-relative events (opposition, conjunction, max_elongation, perigee_apogee) require a `body`: opposition applies to the superior planets (mars through pluto), conjunction to any planet, max_elongation to mercury and venus, and perigee_apogee to the moon (perigee/apogee), earth, or a planet (perihelion/aphelion). Returns the next `count` occurrences (default 1). Searches stop at the end of 2100, the close of the supported span; when that leaves fewer than `count`, a notice says so. Start defaults to now; pass an IANA `timezone` for observer-local timestamps.",
|
|
137
|
+
description: "Search forward from a start time for the next occurrences of one sky-event class, selected by the `event` enum: solar_eclipse, lunar_eclipse, equinox, solstice, moon_quarter, opposition, conjunction, max_elongation, or perigee_apogee. Both eclipse classes take an optional observer (latitude and longitude together). solar_eclipse without one returns global eclipses — kind, peak time, obscuration, and for a total or annular eclipse the latitude/longitude where it is greatest; with one it returns only eclipses visible from that point, with local contact times, `local_visible`, and the Sun's altitude at each contact. lunar_eclipse returns geocentric contact times, the same instants everywhere on Earth; an observer adds `local_visible` and the Moon's altitude at each contact. Every other class is geocentric and ignores a location. The body-relative events (opposition, conjunction, max_elongation, perigee_apogee) require a `body`: opposition applies to the superior planets (mars through pluto), conjunction to any planet, max_elongation to mercury and venus, and perigee_apogee to the moon (perigee/apogee), earth, or a planet (perihelion/aphelion). conjunction with `body` alone is that planet's conjunction with the Sun. Add `body2` for a conjunction of two bodies — the Moon or a planet with another: the instant they share one ecliptic longitude seen from Earth's center, with their `separation_degrees` at that instant. That separation is not always their closest approach, since two planets can pass closer days or weeks away, and listings that time conjunctions by right ascension differ by hours, or by days for slow pairs. Returns the next `count` occurrences (default 1), up to 20 per call: a larger `count`, up to 200, returns the first 20 and a notice naming the exact `start` and `count` that continue the series. Searches stop at the end of 2100, the close of the supported span; when that leaves fewer than `count`, a notice says so. Start defaults to now; pass an IANA `timezone` for observer-local timestamps.",
|
|
107
138
|
annotations: { readOnlyHint: true, openWorldHint: false, idempotentHint: true },
|
|
108
139
|
input: z.object({
|
|
109
140
|
event: z.enum(EVENT_NAMES).describe('Which class of event to search for.'),
|
|
@@ -115,13 +146,17 @@ export const findEventsTool = tool('astronomy_find_events', {
|
|
|
115
146
|
.number()
|
|
116
147
|
.int()
|
|
117
148
|
.min(1)
|
|
118
|
-
.max(
|
|
149
|
+
.max(EVENTS_COUNT_CEILING)
|
|
119
150
|
.default(1)
|
|
120
|
-
.describe(
|
|
151
|
+
.describe(`Number of forward occurrences to return. Default 1. At most ${EVENTS_PER_CALL} are computed per call; a count up to ${EVENTS_COUNT_CEILING} returns the first ${EVENTS_PER_CALL} with a notice naming the \`start\` and \`count\` that continue the series.`),
|
|
121
152
|
body: z
|
|
122
153
|
.enum(EVENT_BODY_NAMES)
|
|
123
154
|
.optional()
|
|
124
|
-
.describe('Target body — required for opposition, conjunction, max_elongation, and perigee_apogee; ignored otherwise. "earth" is accepted only for perigee_apogee, which returns its perihelion and aphelion.'),
|
|
155
|
+
.describe('Target body — required for opposition, conjunction, max_elongation, and perigee_apogee; ignored otherwise. "earth" is accepted only for perigee_apogee, which returns its perihelion and aphelion. With `body2`, the Moon or a planet.'),
|
|
156
|
+
body2: z
|
|
157
|
+
.enum(PAIR_BODY_NAMES)
|
|
158
|
+
.optional()
|
|
159
|
+
.describe('Second body for a conjunction of two bodies: the Moon or a planet, different from `body`. Accepted only with event "conjunction", where it replaces the conjunction of `body` with the Sun by the conjunction of `body` and `body2` in ecliptic longitude seen from Earth\'s center. For the Moon meeting the Sun, search moon_quarter for the new moon.'),
|
|
125
160
|
latitude: z
|
|
126
161
|
.number()
|
|
127
162
|
.min(-90)
|
|
@@ -146,10 +181,16 @@ export const findEventsTool = tool('astronomy_find_events', {
|
|
|
146
181
|
output: FindEventsOutput,
|
|
147
182
|
enrichment: {
|
|
148
183
|
totalCount: z.number().describe('Number of event occurrences returned.'),
|
|
184
|
+
truncated: z
|
|
185
|
+
.boolean()
|
|
186
|
+
.optional()
|
|
187
|
+
.describe('True when `count` exceeded the per-call cap and only the first events came back.'),
|
|
188
|
+
shown: z.number().optional().describe('Number of events returned when the cap applied.'),
|
|
189
|
+
cap: z.number().optional().describe('The per-call event cap that was applied.'),
|
|
149
190
|
notice: z
|
|
150
191
|
.string()
|
|
151
192
|
.optional()
|
|
152
|
-
.describe('Why the list is shorter than the requested count: the search reached the end of the supported span (2100). Absent when every requested occurrence came back.'),
|
|
193
|
+
.describe('Why the list is shorter than the requested count: either the per-call cap held events back, and the notice names the exact `start` and `count` to re-call with, or the search reached the end of the supported span (2100). Absent when every requested occurrence came back.'),
|
|
153
194
|
},
|
|
154
195
|
errors: [
|
|
155
196
|
{
|
|
@@ -167,8 +208,16 @@ export const findEventsTool = tool('astronomy_find_events', {
|
|
|
167
208
|
{
|
|
168
209
|
reason: 'body_not_supported',
|
|
169
210
|
code: JsonRpcErrorCode.InvalidParams,
|
|
170
|
-
when: 'The body has no such event — opposition for the Sun, Moon, Earth, or an inner planet; conjunction for the Sun, Moon, or Earth; max_elongation for anything but mercury or venus; perigee_apogee for the Sun.',
|
|
171
|
-
recovery: 'Pick a body the event is defined for: a superior planet (mars through pluto) for opposition, any planet for conjunction, mercury or venus for max_elongation, and the moon, earth, or a planet for perigee_apogee.',
|
|
211
|
+
when: 'The body has no such event — opposition for the Sun, Moon, Earth, or an inner planet; conjunction without `body2` for the Sun, Moon, or Earth; max_elongation for anything but mercury or venus; perigee_apogee for the Sun.',
|
|
212
|
+
recovery: 'Pick a body the event is defined for: a superior planet (mars through pluto) for opposition, any planet for conjunction (or the Moon with a planet as body2), mercury or venus for max_elongation, and the moon, earth, or a planet for perigee_apogee.',
|
|
213
|
+
thrownBy: 'service',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
reason: 'invalid_body_pair',
|
|
217
|
+
code: JsonRpcErrorCode.InvalidParams,
|
|
218
|
+
when: '`body2` was supplied with an event other than conjunction, names the same body as `body`, or is paired with a `body` of sun or earth.',
|
|
219
|
+
// Verbatim the hint EphemerisService throws with where it rejects the pair.
|
|
220
|
+
recovery: 'body2 applies only to event "conjunction" and pairs two different bodies among the Moon and the planets (mercury through pluto). For a planet\'s conjunction with the Sun, pass the planet as body and omit body2; for the Moon\'s, search moon_quarter for the new moon.',
|
|
172
221
|
thrownBy: 'service',
|
|
173
222
|
},
|
|
174
223
|
{
|
|
@@ -184,6 +233,7 @@ export const findEventsTool = tool('astronomy_find_events', {
|
|
|
184
233
|
reason: 'time_out_of_range',
|
|
185
234
|
code: JsonRpcErrorCode.InvalidParams,
|
|
186
235
|
when: "The requested start instant is outside the engine's high-accuracy span (≈1900–2100).",
|
|
236
|
+
// resolveTime() throws this reason with no hint, so this string is the wire hint.
|
|
187
237
|
recovery: 'Use a start date between 1900 and 2100 and retry.',
|
|
188
238
|
thrownBy: 'service',
|
|
189
239
|
},
|
|
@@ -221,26 +271,46 @@ export const findEventsTool = tool('astronomy_find_events', {
|
|
|
221
271
|
elevation: input.elevation,
|
|
222
272
|
}
|
|
223
273
|
: undefined;
|
|
274
|
+
const served = Math.min(input.count, EVENTS_PER_CALL);
|
|
224
275
|
const records = svc.findEvents(input.event, {
|
|
225
276
|
start,
|
|
226
|
-
count:
|
|
277
|
+
count: served,
|
|
227
278
|
...(input.body ? { body: input.body } : {}),
|
|
279
|
+
...(input.body2 ? { body2: input.body2 } : {}),
|
|
228
280
|
...(observer ? { observer } : {}),
|
|
229
281
|
...(timezone ? { timezone } : {}),
|
|
230
282
|
});
|
|
231
283
|
ctx.log.info('Found events', { event: input.event, count: records.length });
|
|
232
284
|
ctx.enrich.total(records.length);
|
|
233
285
|
/**
|
|
234
|
-
* Every search is unbounded except by the supported span, so
|
|
235
|
-
* span ended
|
|
236
|
-
*
|
|
286
|
+
* Every search is unbounded except by the supported span, so fewer than `served` means
|
|
287
|
+
* the span ended; a full `served` short of `count` means the cap held the rest back. The
|
|
288
|
+
* two never coincide, so `notice` — last-wins across enrichment writers — has one writer.
|
|
237
289
|
*/
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
290
|
+
const last = records.at(-1);
|
|
291
|
+
const spanEnd = `The search reached the end of the supported span (${SUPPORTED_SPAN.lastYear}) after ${records.length} of ${input.count} requested events; no occurrence after ${SUPPORTED_SPAN.lastYear} is computed.`;
|
|
292
|
+
if (records.length < served) {
|
|
293
|
+
ctx.enrich.notice(spanEnd);
|
|
294
|
+
}
|
|
295
|
+
else if (input.count > served && last) {
|
|
296
|
+
/**
|
|
297
|
+
* A 20th event within the resume offset of the span end puts the resume start past
|
|
298
|
+
* it, where every call fails time_out_of_range. The offset is shorter than the gap to
|
|
299
|
+
* the next event of the class, so no event lies in that window and the span ended.
|
|
300
|
+
*/
|
|
301
|
+
const offset = ECLIPSE_EVENTS.has(input.event) ? ECLIPSE_RESUME_OFFSET_MS : RESUME_OFFSET_MS;
|
|
302
|
+
const resumeAt = new Date(Date.parse(last.timeUtc) + offset);
|
|
303
|
+
if (resumeAt.getUTCFullYear() > SUPPORTED_SPAN.lastYear) {
|
|
304
|
+
ctx.enrich.notice(spanEnd);
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
ctx.enrich.truncated({
|
|
308
|
+
shown: records.length,
|
|
309
|
+
cap: EVENTS_PER_CALL,
|
|
310
|
+
guidance: `Returned ${records.length} of the ${input.count} requested events (${EVENTS_PER_CALL} per call). Re-call with start ${resumeAt.toISOString()} and count ${input.count - records.length} for the rest.`,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
241
313
|
}
|
|
242
|
-
if (caveats.length > 0)
|
|
243
|
-
ctx.enrich.notice(caveats.join(' '));
|
|
244
314
|
const out = {
|
|
245
315
|
events: records.map((r) => ({
|
|
246
316
|
event: r.event,
|
|
@@ -262,6 +332,8 @@ export const findEventsTool = tool('astronomy_find_events', {
|
|
|
262
332
|
...(r.which ? { which: r.which } : {}),
|
|
263
333
|
...(r.quarter ? { quarter: r.quarter } : {}),
|
|
264
334
|
...(r.body ? { body: r.body } : {}),
|
|
335
|
+
...(r.body2 ? { body2: r.body2 } : {}),
|
|
336
|
+
...(r.separationDegrees !== undefined ? { separation_degrees: r.separationDegrees } : {}),
|
|
265
337
|
...(r.conjunctionKind ? { conjunction_kind: r.conjunctionKind } : {}),
|
|
266
338
|
...(r.elongationDegrees !== undefined ? { elongation_degrees: r.elongationDegrees } : {}),
|
|
267
339
|
...(r.visibility ? { visibility: r.visibility } : {}),
|
|
@@ -282,13 +354,15 @@ export const findEventsTool = tool('astronomy_find_events', {
|
|
|
282
354
|
if (e.quarter)
|
|
283
355
|
headline += ` (${e.quarter})`;
|
|
284
356
|
if (e.body)
|
|
285
|
-
headline += ` — ${e.body}`;
|
|
357
|
+
headline += ` — ${e.body}${e.body2 ? ` and ${e.body2}` : ''}`;
|
|
286
358
|
lines.push(headline);
|
|
287
359
|
lines.push(`time_utc: ${e.time_utc}${e.time_local ? ` | time_local: ${e.time_local}` : ''}`);
|
|
288
360
|
if (e.kind)
|
|
289
361
|
lines.push(`**Kind:** ${e.kind}`);
|
|
290
362
|
if (e.conjunction_kind)
|
|
291
363
|
lines.push(`**Conjunction:** ${e.conjunction_kind}`);
|
|
364
|
+
if (e.separation_degrees !== undefined)
|
|
365
|
+
lines.push(`**Separation:** ${num(e.separation_degrees, 3, '°')}`);
|
|
292
366
|
if (e.obscuration !== undefined)
|
|
293
367
|
lines.push(`**Obscuration:** ${e.obscuration === null ? 'unavailable' : pct(e.obscuration, 1)}`);
|
|
294
368
|
if (e.local_visible !== undefined)
|