@cyanheads/astronomy-mcp-server 0.1.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.
Files changed (86) hide show
  1. package/AGENTS.md +431 -0
  2. package/CLAUDE.md +431 -0
  3. package/Dockerfile +104 -0
  4. package/LICENSE +201 -0
  5. package/README.md +320 -0
  6. package/changelog/0.1.x/0.1.1.md +28 -0
  7. package/changelog/0.1.x/0.1.2.md +16 -0
  8. package/changelog/template.md +127 -0
  9. package/dist/config/server-config.d.ts +22 -0
  10. package/dist/config/server-config.d.ts.map +1 -0
  11. package/dist/config/server-config.js +40 -0
  12. package/dist/config/server-config.js.map +1 -0
  13. package/dist/index.d.ts +11 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +55 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/mcp-server/prompts/definitions/stargazing-plan.prompt.d.ts +12 -0
  18. package/dist/mcp-server/prompts/definitions/stargazing-plan.prompt.d.ts.map +1 -0
  19. package/dist/mcp-server/prompts/definitions/stargazing-plan.prompt.js +36 -0
  20. package/dist/mcp-server/prompts/definitions/stargazing-plan.prompt.js.map +1 -0
  21. package/dist/mcp-server/resources/definitions/body.resource.d.ts +29 -0
  22. package/dist/mcp-server/resources/definitions/body.resource.d.ts.map +1 -0
  23. package/dist/mcp-server/resources/definitions/body.resource.js +65 -0
  24. package/dist/mcp-server/resources/definitions/body.resource.js.map +1 -0
  25. package/dist/mcp-server/tools/definitions/find-events.tool.d.ts +157 -0
  26. package/dist/mcp-server/tools/definitions/find-events.tool.d.ts.map +1 -0
  27. package/dist/mcp-server/tools/definitions/find-events.tool.js +242 -0
  28. package/dist/mcp-server/tools/definitions/find-events.tool.js.map +1 -0
  29. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.d.ts +62 -0
  30. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.d.ts.map +1 -0
  31. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.js +161 -0
  32. package/dist/mcp-server/tools/definitions/get-ephemeris.tool.js.map +1 -0
  33. package/dist/mcp-server/tools/definitions/get-moon-phase.tool.d.ts +53 -0
  34. package/dist/mcp-server/tools/definitions/get-moon-phase.tool.d.ts.map +1 -0
  35. package/dist/mcp-server/tools/definitions/get-moon-phase.tool.js +109 -0
  36. package/dist/mcp-server/tools/definitions/get-moon-phase.tool.js.map +1 -0
  37. package/dist/mcp-server/tools/definitions/get-rise-set.tool.d.ts +100 -0
  38. package/dist/mcp-server/tools/definitions/get-rise-set.tool.d.ts.map +1 -0
  39. package/dist/mcp-server/tools/definitions/get-rise-set.tool.js +200 -0
  40. package/dist/mcp-server/tools/definitions/get-rise-set.tool.js.map +1 -0
  41. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.d.ts +77 -0
  42. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.d.ts.map +1 -0
  43. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.js +180 -0
  44. package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.js.map +1 -0
  45. package/dist/mcp-server/tools/definitions/get-sky-position.tool.d.ts +99 -0
  46. package/dist/mcp-server/tools/definitions/get-sky-position.tool.d.ts.map +1 -0
  47. package/dist/mcp-server/tools/definitions/get-sky-position.tool.js +196 -0
  48. package/dist/mcp-server/tools/definitions/get-sky-position.tool.js.map +1 -0
  49. package/dist/mcp-server/tools/definitions/list-visible.tool.d.ts +104 -0
  50. package/dist/mcp-server/tools/definitions/list-visible.tool.d.ts.map +1 -0
  51. package/dist/mcp-server/tools/definitions/list-visible.tool.js +151 -0
  52. package/dist/mcp-server/tools/definitions/list-visible.tool.js.map +1 -0
  53. package/dist/services/ephemeris/body-data.d.ts +25 -0
  54. package/dist/services/ephemeris/body-data.d.ts.map +1 -0
  55. package/dist/services/ephemeris/body-data.js +24 -0
  56. package/dist/services/ephemeris/body-data.js.map +1 -0
  57. package/dist/services/ephemeris/ephemeris-service.d.ts +93 -0
  58. package/dist/services/ephemeris/ephemeris-service.d.ts.map +1 -0
  59. package/dist/services/ephemeris/ephemeris-service.js +742 -0
  60. package/dist/services/ephemeris/ephemeris-service.js.map +1 -0
  61. package/dist/services/ephemeris/star-catalog.d.ts +17 -0
  62. package/dist/services/ephemeris/star-catalog.d.ts.map +1 -0
  63. package/dist/services/ephemeris/star-catalog.js +273 -0
  64. package/dist/services/ephemeris/star-catalog.js.map +1 -0
  65. package/dist/services/ephemeris/types.d.ts +150 -0
  66. package/dist/services/ephemeris/types.d.ts.map +1 -0
  67. package/dist/services/ephemeris/types.js +33 -0
  68. package/dist/services/ephemeris/types.js.map +1 -0
  69. package/dist/services/horizons/horizons-service.d.ts +47 -0
  70. package/dist/services/horizons/horizons-service.d.ts.map +1 -0
  71. package/dist/services/horizons/horizons-service.js +229 -0
  72. package/dist/services/horizons/horizons-service.js.map +1 -0
  73. package/dist/services/horizons/types.d.ts +21 -0
  74. package/dist/services/horizons/types.d.ts.map +1 -0
  75. package/dist/services/horizons/types.js +6 -0
  76. package/dist/services/horizons/types.js.map +1 -0
  77. package/dist/services/satellite/satellite-service.d.ts +48 -0
  78. package/dist/services/satellite/satellite-service.d.ts.map +1 -0
  79. package/dist/services/satellite/satellite-service.js +231 -0
  80. package/dist/services/satellite/satellite-service.js.map +1 -0
  81. package/dist/services/satellite/types.d.ts +32 -0
  82. package/dist/services/satellite/types.d.ts.map +1 -0
  83. package/dist/services/satellite/types.js +6 -0
  84. package/dist/services/satellite/types.js.map +1 -0
  85. package/package.json +104 -0
  86. package/server.json +139 -0
@@ -0,0 +1,242 @@
1
+ /**
2
+ * @fileoverview astronomy_find_events — consolidated forward search for nine event
3
+ * classes under one `event` enum. Eclipses take an observer for local
4
+ * circumstances; the rest are geocentric. Validation gates fail fast when an
5
+ * event needs a body or an observer that was not supplied.
6
+ * @module mcp-server/tools/definitions/find-events.tool
7
+ */
8
+ import { tool, z } from '@cyanheads/mcp-ts-core';
9
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
10
+ import { getServerConfig } from '../../../config/server-config.js';
11
+ import { getEphemerisService } from '../../../services/ephemeris/ephemeris-service.js';
12
+ import { BODY_NAMES, EVENT_NAMES } from '../../../services/ephemeris/types.js';
13
+ const BODY_EVENTS = new Set([
14
+ 'opposition',
15
+ 'conjunction',
16
+ 'max_elongation',
17
+ 'perigee_apogee',
18
+ ]);
19
+ export const FindEventsOutput = z.object({
20
+ events: z
21
+ .array(z
22
+ .object({
23
+ event: z.enum(EVENT_NAMES).describe('The event class this record belongs to.'),
24
+ time_utc: z.string().describe('Time of the event (peak, for eclipses) in ISO 8601 UTC.'),
25
+ time_local: z
26
+ .string()
27
+ .optional()
28
+ .describe('Event time in observer-local time, present only when a timezone was supplied.'),
29
+ kind: z
30
+ .string()
31
+ .optional()
32
+ .describe('Eclipse classification: "penumbral", "partial", "annular", or "total". Present for eclipses.'),
33
+ obscuration: z
34
+ .number()
35
+ .nullable()
36
+ .optional()
37
+ .describe('Peak fraction of the disc obscured, 0 to 1. Null/absent when undefined for a global partial solar eclipse.'),
38
+ local_visible: z
39
+ .boolean()
40
+ .optional()
41
+ .describe("True when a solar eclipse is above the observer's horizon at peak. Present for solar eclipses."),
42
+ contacts: z
43
+ .record(z.string(), z.string().nullable())
44
+ .optional()
45
+ .describe('Eclipse contact times in ISO 8601 UTC keyed by phase (e.g. partial_begin_utc, peak_utc); a phase that does not occur is null.'),
46
+ which: z
47
+ .enum(['march', 'september', 'june', 'december'])
48
+ .optional()
49
+ .describe('Which equinox or solstice. Present for equinox/solstice events.'),
50
+ quarter: z
51
+ .enum(['new', 'first_quarter', 'full', 'last_quarter'])
52
+ .optional()
53
+ .describe('Which lunar quarter. Present for moon_quarter events.'),
54
+ body: z
55
+ .string()
56
+ .optional()
57
+ .describe('The target body. Present for opposition/conjunction/max_elongation/perigee_apogee.'),
58
+ elongation_degrees: z
59
+ .number()
60
+ .optional()
61
+ .describe('Greatest-elongation angle in degrees from the Sun. Present for max_elongation.'),
62
+ visibility: z
63
+ .enum(['morning', 'evening'])
64
+ .optional()
65
+ .describe('Whether the apparition is in the morning or evening sky. Present for max_elongation.'),
66
+ apsis_kind: z
67
+ .enum(['perigee', 'apogee', 'perihelion', 'aphelion'])
68
+ .optional()
69
+ .describe('Apsis classification. Present for perigee_apogee events.'),
70
+ distance_km: z
71
+ .number()
72
+ .optional()
73
+ .describe('Center-to-center distance at the apsis in kilometers. Present for perigee_apogee.'),
74
+ distance_au: z
75
+ .number()
76
+ .optional()
77
+ .describe('Center-to-center distance at the apsis in astronomical units. Present for perigee_apogee.'),
78
+ })
79
+ .describe('One event occurrence; which detail fields are present depends on the event class.'))
80
+ .describe('The next occurrences of the requested event class, in chronological order.'),
81
+ });
82
+ export const findEventsTool = tool('astronomy_find_events', {
83
+ title: 'astronomy-mcp-server: find sky events',
84
+ 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. Solar and lunar eclipses take an observer location and report local visibility and contact times; equinoxes, solstices, and moon quarters are geocentric and need no location. The body-relative events (opposition, conjunction, max_elongation, perigee_apogee) require a `body` — max_elongation is defined only for mercury and venus, and perigee_apogee accepts the moon or a planet. Returns the next `count` occurrences (default 1). Start defaults to now; pass an IANA `timezone` for observer-local timestamps.',
85
+ annotations: { readOnlyHint: true, openWorldHint: false, idempotentHint: true },
86
+ input: z.object({
87
+ event: z.enum(EVENT_NAMES).describe('Which class of event to search for.'),
88
+ start: z
89
+ .string()
90
+ .optional()
91
+ .describe('Search start as an ISO 8601 UTC string, e.g. "2024-01-01T00:00:00Z". Defaults to now.'),
92
+ count: z
93
+ .number()
94
+ .int()
95
+ .min(1)
96
+ .max(20)
97
+ .default(1)
98
+ .describe('Number of forward occurrences to return. Default 1, max 20.'),
99
+ body: z
100
+ .enum(BODY_NAMES)
101
+ .optional()
102
+ .describe('Target body — required for opposition, conjunction, max_elongation, and perigee_apogee; ignored otherwise.'),
103
+ latitude: z
104
+ .number()
105
+ .min(-90)
106
+ .max(90)
107
+ .optional()
108
+ .describe('Observer latitude in decimal degrees — required for eclipse events to get local circumstances.'),
109
+ longitude: z
110
+ .number()
111
+ .min(-180)
112
+ .max(180)
113
+ .optional()
114
+ .describe('Observer longitude in decimal degrees — required for eclipse events.'),
115
+ elevation: z
116
+ .number()
117
+ .default(0)
118
+ .describe('Observer elevation in meters above sea level. Default 0.'),
119
+ timezone: z
120
+ .string()
121
+ .optional()
122
+ .describe('IANA timezone for localized output, e.g. "America/Los_Angeles". When omitted, output is UTC-only.'),
123
+ }),
124
+ output: FindEventsOutput,
125
+ enrichment: {
126
+ totalCount: z.number().describe('Number of event occurrences returned.'),
127
+ },
128
+ errors: [
129
+ {
130
+ reason: 'observer_required',
131
+ code: JsonRpcErrorCode.InvalidParams,
132
+ when: 'A solar_eclipse event was requested without observer latitude/longitude.',
133
+ recovery: 'Add observer latitude and longitude to receive local eclipse circumstances, then retry.',
134
+ },
135
+ {
136
+ reason: 'body_required',
137
+ code: JsonRpcErrorCode.InvalidParams,
138
+ when: 'A body-relative event was requested without a target body.',
139
+ recovery: 'Add the target body (e.g. "mars" for opposition or "venus" for max_elongation) and retry.',
140
+ },
141
+ {
142
+ reason: 'body_not_supported',
143
+ code: JsonRpcErrorCode.InvalidParams,
144
+ when: 'max_elongation was requested for a body other than mercury or venus.',
145
+ recovery: 'Use body "mercury" or "venus" for max_elongation; the outer planets have no greatest elongation.',
146
+ },
147
+ {
148
+ reason: 'time_out_of_range',
149
+ code: JsonRpcErrorCode.InvalidParams,
150
+ when: "The requested start instant is outside the engine's high-accuracy span (≈1900–2100).",
151
+ recovery: 'Use a start date between 1900 and 2100 and retry.',
152
+ },
153
+ ],
154
+ handler(input, ctx) {
155
+ const svc = getEphemerisService();
156
+ const timezone = svc.resolveTimezone(input.timezone ?? getServerConfig().defaultTimezone);
157
+ const start = svc.resolveTime(input.start);
158
+ const hasObserver = typeof input.latitude === 'number' && typeof input.longitude === 'number';
159
+ if (input.event === 'solar_eclipse' && !hasObserver) {
160
+ // Solar eclipses require an observer for local circumstances; lunar eclipses are geocentric.
161
+ throw ctx.fail('observer_required', undefined, { ...ctx.recoveryFor('observer_required') });
162
+ }
163
+ if (BODY_EVENTS.has(input.event) && !input.body) {
164
+ throw ctx.fail('body_required', undefined, { ...ctx.recoveryFor('body_required') });
165
+ }
166
+ const observer = hasObserver
167
+ ? {
168
+ latitude: input.latitude,
169
+ longitude: input.longitude,
170
+ elevation: input.elevation,
171
+ }
172
+ : undefined;
173
+ const records = svc.findEvents(input.event, {
174
+ start,
175
+ count: input.count,
176
+ ...(input.body ? { body: input.body } : {}),
177
+ ...(observer ? { observer } : {}),
178
+ ...(timezone ? { timezone } : {}),
179
+ });
180
+ ctx.log.info('Found events', { event: input.event, count: records.length });
181
+ ctx.enrich.total(records.length);
182
+ const out = {
183
+ events: records.map((r) => ({
184
+ event: r.event,
185
+ time_utc: r.timeUtc,
186
+ ...(r.timeLocal ? { time_local: r.timeLocal } : {}),
187
+ ...(r.kind ? { kind: r.kind } : {}),
188
+ ...(r.obscuration !== undefined ? { obscuration: r.obscuration } : {}),
189
+ ...(r.localVisible !== undefined ? { local_visible: r.localVisible } : {}),
190
+ ...(r.contacts ? { contacts: r.contacts } : {}),
191
+ ...(r.which ? { which: r.which } : {}),
192
+ ...(r.quarter ? { quarter: r.quarter } : {}),
193
+ ...(r.body ? { body: r.body } : {}),
194
+ ...(r.elongationDegrees !== undefined ? { elongation_degrees: r.elongationDegrees } : {}),
195
+ ...(r.visibility ? { visibility: r.visibility } : {}),
196
+ ...(r.apsisKind ? { apsis_kind: r.apsisKind } : {}),
197
+ ...(r.distanceKm !== undefined ? { distance_km: r.distanceKm } : {}),
198
+ ...(r.distanceAu !== undefined ? { distance_au: r.distanceAu } : {}),
199
+ })),
200
+ };
201
+ return out;
202
+ },
203
+ format: (r) => {
204
+ const lines = [];
205
+ for (const e of r.events) {
206
+ let headline = `## ${e.event}`;
207
+ if (e.which)
208
+ headline += ` (${e.which})`;
209
+ if (e.quarter)
210
+ headline += ` (${e.quarter})`;
211
+ if (e.body)
212
+ headline += ` — ${e.body}`;
213
+ lines.push(headline);
214
+ lines.push(`time_utc: ${e.time_utc}${e.time_local ? ` | time_local: ${e.time_local}` : ''}`);
215
+ if (e.kind)
216
+ lines.push(`**Kind:** ${e.kind}`);
217
+ if (e.obscuration !== undefined)
218
+ lines.push(`**Obscuration:** ${e.obscuration === null ? 'unavailable' : `${(e.obscuration * 100).toFixed(1)}%`}`);
219
+ if (e.local_visible !== undefined)
220
+ lines.push(`**Locally visible:** ${e.local_visible ? 'yes' : 'no'}`);
221
+ if (e.elongation_degrees !== undefined)
222
+ lines.push(`**Elongation:** ${e.elongation_degrees.toFixed(1)}°`);
223
+ if (e.visibility)
224
+ lines.push(`**Apparition:** ${e.visibility}`);
225
+ if (e.apsis_kind)
226
+ lines.push(`**Apsis:** ${e.apsis_kind}`);
227
+ if (e.distance_km !== undefined)
228
+ lines.push(`**Distance:** ${e.distance_km.toFixed(0)} km`);
229
+ if (e.distance_au !== undefined)
230
+ lines.push(`**Distance:** ${e.distance_au.toFixed(6)} AU`);
231
+ if (e.contacts) {
232
+ const parts = Object.entries(e.contacts)
233
+ .filter(([, v]) => v !== null)
234
+ .map(([k, v]) => `${k.replace(/_utc$/, '')} ${v}`);
235
+ if (parts.length > 0)
236
+ lines.push(`**Contacts:** ${parts.join(', ')}`);
237
+ }
238
+ }
239
+ return [{ type: 'text', text: lines.join('\n') }];
240
+ },
241
+ });
242
+ //# sourceMappingURL=find-events.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-events.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/find-events.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,O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,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACrD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;oBAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACxE,CAAC;QACH,CAAC;QACD,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @fileoverview astronomy_get_ephemeris — gated extension. Ephemeris for a small body
3
+ * (asteroid/comet) or spacecraft via JPL Horizons. Covers what the in-process
4
+ * major-body engine cannot. Registered only when ASTRONOMY_ENABLE_HORIZONS is set.
5
+ * @module mcp-server/tools/definitions/get-ephemeris.tool
6
+ */
7
+ import { z } from '@cyanheads/mcp-ts-core';
8
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
9
+ export declare const EphemerisOutput: z.ZodObject<{
10
+ designation: z.ZodString;
11
+ points: z.ZodArray<z.ZodObject<{
12
+ time_utc: z.ZodString;
13
+ ra_hours: z.ZodNumber;
14
+ dec_degrees: z.ZodNumber;
15
+ distance_au: z.ZodNumber;
16
+ magnitude: z.ZodNullable<z.ZodNumber>;
17
+ altitude_degrees: z.ZodOptional<z.ZodNumber>;
18
+ azimuth_degrees: z.ZodOptional<z.ZodNumber>;
19
+ }, z.core.$strip>>;
20
+ }, z.core.$strip>;
21
+ export type EphemerisOutputType = z.infer<typeof EphemerisOutput>;
22
+ export declare const getEphemerisTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
23
+ designation: z.ZodString;
24
+ latitude: z.ZodOptional<z.ZodNumber>;
25
+ longitude: z.ZodOptional<z.ZodNumber>;
26
+ elevation: z.ZodDefault<z.ZodNumber>;
27
+ start: z.ZodOptional<z.ZodString>;
28
+ stop: z.ZodOptional<z.ZodString>;
29
+ step: z.ZodDefault<z.ZodString>;
30
+ }, z.core.$strip>, z.ZodObject<{
31
+ designation: z.ZodString;
32
+ points: z.ZodArray<z.ZodObject<{
33
+ time_utc: z.ZodString;
34
+ ra_hours: z.ZodNumber;
35
+ dec_degrees: z.ZodNumber;
36
+ distance_au: z.ZodNumber;
37
+ magnitude: z.ZodNullable<z.ZodNumber>;
38
+ altitude_degrees: z.ZodOptional<z.ZodNumber>;
39
+ azimuth_degrees: z.ZodOptional<z.ZodNumber>;
40
+ }, z.core.$strip>>;
41
+ }, z.core.$strip>, readonly [{
42
+ readonly reason: "invalid_time";
43
+ readonly code: JsonRpcErrorCode.InvalidParams;
44
+ readonly when: "The start or stop timestamp is not a parseable ISO 8601 instant.";
45
+ readonly recovery: "Pass start and stop as ISO 8601 UTC timestamps, e.g. 2024-01-01T00:00:00Z, then retry.";
46
+ }, {
47
+ readonly reason: "body_not_found";
48
+ readonly code: JsonRpcErrorCode.NotFound;
49
+ readonly when: "JPL Horizons has no match for the designation, or the designation is ambiguous (a bare comet name matches multiple apparition records).";
50
+ readonly recovery: "Use a record-resolving form: a numbered asteroid as \"<number>;\" (e.g. \"433;\"), a periodic comet as \"DES=<designation>;CAP\" (e.g. \"DES=1P;CAP\"), or a spacecraft as its negative SPK-ID. Verify the designation at ssd.jpl.nasa.gov/tools/sbdb_lookup.html.";
51
+ }, {
52
+ readonly reason: "horizons_unavailable";
53
+ readonly code: JsonRpcErrorCode.ServiceUnavailable;
54
+ readonly when: "The JPL Horizons API failed after retries.";
55
+ readonly retryable: true;
56
+ readonly recovery: "JPL Horizons is degraded or timed out; retry in a few minutes.";
57
+ }], {
58
+ readonly truncated: z.ZodBoolean;
59
+ readonly shown: z.ZodNumber;
60
+ readonly cap: z.ZodNumber;
61
+ }>;
62
+ //# sourceMappingURL=get-ephemeris.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-ephemeris.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-ephemeris.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMjE,eAAO,MAAM,eAAe;;;;;;;;;;;iBA8B1B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuJ3B,CAAC"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * @fileoverview astronomy_get_ephemeris — gated extension. Ephemeris for a small body
3
+ * (asteroid/comet) or spacecraft via JPL Horizons. Covers what the in-process
4
+ * major-body engine cannot. Registered only when ASTRONOMY_ENABLE_HORIZONS is set.
5
+ * @module mcp-server/tools/definitions/get-ephemeris.tool
6
+ */
7
+ import { tool, z } from '@cyanheads/mcp-ts-core';
8
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
9
+ import { getHorizonsService } from '../../../services/horizons/horizons-service.js';
10
+ /** Inline ephemeris-row cap disclosed via enrichment — mirrors HorizonsService MAX_ROWS. */
11
+ const INLINE_ROW_CAP = 200;
12
+ export const EphemerisOutput = z.object({
13
+ designation: z.string().describe('The body designation echoed from the request.'),
14
+ points: z
15
+ .array(z
16
+ .object({
17
+ time_utc: z.string().describe('Step instant in ISO 8601 UTC.'),
18
+ ra_hours: z.number().describe('Right ascension in sidereal hours [0,24).'),
19
+ dec_degrees: z.number().describe('Declination in degrees [-90,90].'),
20
+ distance_au: z.number().describe('Observer-to-body distance in astronomical units.'),
21
+ magnitude: z
22
+ .number()
23
+ .nullable()
24
+ .describe('Apparent magnitude, or null when Horizons omits it for this body.'),
25
+ altitude_degrees: z
26
+ .number()
27
+ .optional()
28
+ .describe('Refraction-corrected altitude in degrees. Present only when an observer was supplied.'),
29
+ azimuth_degrees: z
30
+ .number()
31
+ .optional()
32
+ .describe('Azimuth in degrees (0=N, 90=E, 180=S, 270=W). Present only when an observer was supplied.'),
33
+ })
34
+ .describe('One ephemeris step: position and, with an observer, alt/az.'))
35
+ .describe('Time-series of positions, one per step, in chronological order.'),
36
+ });
37
+ export const getEphemerisTool = tool('astronomy_get_ephemeris', {
38
+ title: 'astronomy-mcp-server: get small-body ephemeris',
39
+ description: 'Fetch a time-series ephemeris for a small body (asteroid or comet) or spacecraft from JPL Horizons — RA/Dec, distance, and apparent magnitude over a span, optionally with observer-relative altitude/azimuth. This covers objects the in-process major-body set cannot. The designation is passed to Horizons verbatim, so it must be in a form Horizons resolves to a single record: a numbered asteroid takes a trailing-semicolon record lookup (e.g. "433;" for Eros, "1;" for Ceres), and a periodic comet takes the DES + closest-apparition form (e.g. "DES=1P;CAP" for Halley) — a bare name like "433 Eros" or "1P/Halley" returns no match or an ambiguous record list and is rejected. Spacecraft take their negative SPK-ID. `start` and `stop` are ISO 8601 UTC; `step` is a Horizons step string such as "1d", "1h", or "10m". Supplying observer latitude/longitude yields topocentric coordinates and adds alt/az. This is a gated, network-backed extension (JPL Horizons is keyless but rate-limited and best-effort); large spans truncate inline — widen the step to reduce rows.',
40
+ annotations: { readOnlyHint: true, openWorldHint: true, idempotentHint: true },
41
+ input: z.object({
42
+ designation: z
43
+ .string()
44
+ .min(1)
45
+ .describe('JPL Horizons target, passed verbatim — use a form that resolves to one record. Numbered asteroid: trailing-semicolon record lookup, e.g. "433;" (Eros), "1;" (Ceres). Periodic comet: DES + closest-apparition flag, e.g. "DES=1P;CAP" (Halley), "DES=2P;CAP" (Encke). Spacecraft: negative SPK-ID, e.g. "-48" (Hubble). A bare name like "433 Eros" or "1P/Halley" fails. Look up designations at ssd.jpl.nasa.gov/tools/sbdb_lookup.html.'),
46
+ latitude: z
47
+ .number()
48
+ .min(-90)
49
+ .max(90)
50
+ .optional()
51
+ .describe('Observer latitude in decimal degrees — supply with longitude for topocentric coordinates and alt/az.'),
52
+ longitude: z
53
+ .number()
54
+ .min(-180)
55
+ .max(180)
56
+ .optional()
57
+ .describe('Observer longitude in decimal degrees.'),
58
+ elevation: z
59
+ .number()
60
+ .default(0)
61
+ .describe('Observer elevation in meters above sea level. Default 0.'),
62
+ start: z
63
+ .string()
64
+ .optional()
65
+ .describe('Ephemeris start as an ISO 8601 UTC string, e.g. "2024-01-01T00:00:00Z". Defaults to now.'),
66
+ stop: z
67
+ .string()
68
+ .optional()
69
+ .describe('Ephemeris stop as an ISO 8601 UTC string. Defaults to 24 hours after start.'),
70
+ step: z
71
+ .string()
72
+ .default('1h')
73
+ .describe('Horizons step size string, e.g. "1d", "1h", "10m". Default "1h".'),
74
+ }),
75
+ output: EphemerisOutput,
76
+ enrichment: {
77
+ truncated: z.boolean().describe('True when Horizons returned more rows than the inline cap.'),
78
+ shown: z.number().describe('Number of ephemeris rows returned.'),
79
+ cap: z.number().describe('The inline row cap that was applied.'),
80
+ },
81
+ errors: [
82
+ {
83
+ reason: 'invalid_time',
84
+ code: JsonRpcErrorCode.InvalidParams,
85
+ when: 'The start or stop timestamp is not a parseable ISO 8601 instant.',
86
+ recovery: 'Pass start and stop as ISO 8601 UTC timestamps, e.g. 2024-01-01T00:00:00Z, then retry.',
87
+ },
88
+ {
89
+ reason: 'body_not_found',
90
+ code: JsonRpcErrorCode.NotFound,
91
+ when: 'JPL Horizons has no match for the designation, or the designation is ambiguous (a bare comet name matches multiple apparition records).',
92
+ recovery: 'Use a record-resolving form: a numbered asteroid as "<number>;" (e.g. "433;"), a periodic comet as "DES=<designation>;CAP" (e.g. "DES=1P;CAP"), or a spacecraft as its negative SPK-ID. Verify the designation at ssd.jpl.nasa.gov/tools/sbdb_lookup.html.',
93
+ },
94
+ {
95
+ reason: 'horizons_unavailable',
96
+ code: JsonRpcErrorCode.ServiceUnavailable,
97
+ when: 'The JPL Horizons API failed after retries.',
98
+ retryable: true,
99
+ recovery: 'JPL Horizons is degraded or timed out; retry in a few minutes.',
100
+ },
101
+ ],
102
+ async handler(input, ctx) {
103
+ const svc = getHorizonsService();
104
+ /**
105
+ * Validate caller-supplied timestamps before they reach `new Date(...).toISOString()`,
106
+ * which throws an opaque RangeError on an unparseable string. Deliberately not routed
107
+ * through the core resolveTime() — JPL Horizons covers historical and future epochs far
108
+ * outside its 1900–2100 high-accuracy span, so only reject genuinely unparseable input.
109
+ */
110
+ if (input.start !== undefined && Number.isNaN(new Date(input.start).getTime())) {
111
+ throw ctx.fail('invalid_time', `Invalid start "${input.start}". Expected an ISO 8601 instant, e.g. 2024-01-01T00:00:00Z.`, { ...ctx.recoveryFor('invalid_time') });
112
+ }
113
+ if (input.stop !== undefined && Number.isNaN(new Date(input.stop).getTime())) {
114
+ throw ctx.fail('invalid_time', `Invalid stop "${input.stop}". Expected an ISO 8601 instant, e.g. 2024-01-02T00:00:00Z.`, { ...ctx.recoveryFor('invalid_time') });
115
+ }
116
+ const start = input.start ?? new Date().toISOString();
117
+ const stop = input.stop ?? new Date(new Date(start).getTime() + 24 * 3600 * 1000).toISOString();
118
+ const observer = typeof input.latitude === 'number' && typeof input.longitude === 'number'
119
+ ? { latitude: input.latitude, longitude: input.longitude, elevation: input.elevation }
120
+ : undefined;
121
+ const result = await svc.ephemeris(input.designation, start, stop, input.step, ctx, observer);
122
+ ctx.log.info('Fetched Horizons ephemeris', {
123
+ designation: input.designation,
124
+ points: result.points.length,
125
+ });
126
+ /**
127
+ * Emit the truncation enrichment on every call — the declared block requires
128
+ * `truncated`/`shown`/`cap`, so a non-truncated result must still populate them
129
+ * or the effective-output parse fails. INLINE_ROW_CAP mirrors the service's MAX_ROWS.
130
+ */
131
+ ctx.enrich({ truncated: result.truncated, shown: result.points.length, cap: INLINE_ROW_CAP });
132
+ if (result.truncated) {
133
+ ctx.enrich.notice('Widen the step (e.g. from "10m" to "1h") or shorten the time span to fit within the inline row cap.');
134
+ }
135
+ const out = {
136
+ designation: result.designation,
137
+ points: result.points.map((p) => ({
138
+ time_utc: p.timeUtc,
139
+ ra_hours: p.raHours,
140
+ dec_degrees: p.decDegrees,
141
+ distance_au: p.distanceAu,
142
+ magnitude: p.magnitude,
143
+ ...(p.altitudeDegrees !== undefined ? { altitude_degrees: p.altitudeDegrees } : {}),
144
+ ...(p.azimuthDegrees !== undefined ? { azimuth_degrees: p.azimuthDegrees } : {}),
145
+ })),
146
+ };
147
+ return out;
148
+ },
149
+ format: (r) => {
150
+ const lines = [];
151
+ lines.push(`## ${r.designation} — ${r.points.length} points`);
152
+ for (const p of r.points) {
153
+ const altAz = p.altitude_degrees !== undefined
154
+ ? `, alt ${p.altitude_degrees.toFixed(1)}°, az ${p.azimuth_degrees?.toFixed(1)}°`
155
+ : '';
156
+ lines.push(`- ${p.time_utc}: RA ${p.ra_hours.toFixed(4)} h, Dec ${p.dec_degrees.toFixed(4)}°, ${p.distance_au.toFixed(4)} AU, mag ${p.magnitude === null ? 'n/a' : p.magnitude.toFixed(1)}${altAz}`);
157
+ }
158
+ return [{ type: 'text', text: lines.join('\n') }];
159
+ },
160
+ });
161
+ //# sourceMappingURL=get-ephemeris.tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-ephemeris.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-ephemeris.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,4FAA4F;AAC5F,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,C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AAC;IACpD,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * @fileoverview astronomy_get_moon_phase — illuminated fraction, phase name, age,
3
+ * phase angle, and the next four lunar quarters for a given instant.
4
+ * @module mcp-server/tools/definitions/get-moon-phase.tool
5
+ */
6
+ import { z } from '@cyanheads/mcp-ts-core';
7
+ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
8
+ export declare const MoonPhaseOutput: z.ZodObject<{
9
+ time_utc: z.ZodString;
10
+ time_local: z.ZodOptional<z.ZodString>;
11
+ phase_angle_degrees: z.ZodNumber;
12
+ illuminated_fraction: z.ZodNumber;
13
+ phase_name: z.ZodString;
14
+ age_days: z.ZodNumber;
15
+ next_quarters: z.ZodArray<z.ZodObject<{
16
+ quarter: z.ZodEnum<{
17
+ new: "new";
18
+ first_quarter: "first_quarter";
19
+ full: "full";
20
+ last_quarter: "last_quarter";
21
+ }>;
22
+ time_utc: z.ZodString;
23
+ time_local: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strip>>;
25
+ }, z.core.$strip>;
26
+ export type MoonPhaseOutputType = z.infer<typeof MoonPhaseOutput>;
27
+ export declare const getMoonPhaseTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
28
+ time: z.ZodOptional<z.ZodString>;
29
+ timezone: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strip>, z.ZodObject<{
31
+ time_utc: z.ZodString;
32
+ time_local: z.ZodOptional<z.ZodString>;
33
+ phase_angle_degrees: z.ZodNumber;
34
+ illuminated_fraction: z.ZodNumber;
35
+ phase_name: z.ZodString;
36
+ age_days: z.ZodNumber;
37
+ next_quarters: z.ZodArray<z.ZodObject<{
38
+ quarter: z.ZodEnum<{
39
+ new: "new";
40
+ first_quarter: "first_quarter";
41
+ full: "full";
42
+ last_quarter: "last_quarter";
43
+ }>;
44
+ time_utc: z.ZodString;
45
+ time_local: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$strip>>;
47
+ }, z.core.$strip>, readonly [{
48
+ readonly reason: "time_out_of_range";
49
+ readonly code: JsonRpcErrorCode.InvalidParams;
50
+ readonly when: "The requested instant is outside the engine's high-accuracy span (≈1900–2100).";
51
+ readonly recovery: "Use a date between 1900 and 2100 and retry.";
52
+ }], undefined>;
53
+ //# sourceMappingURL=get-moon-phase.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-moon-phase.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-moon-phase.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAWjE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;iBAsC1B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;cAsE3B,CAAC"}