lookup_object
Find celestial objects by Messier number, NGC/IC designation, or common name. Check visibility from your location and time to plan observations.
Instructions
Look up a celestial object by Messier number (e.g. M31), NGC/IC designation (e.g. NGC7000), or common name (e.g. Andromeda Galaxy). Optionally compute visibility from a given location and time.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Object name, Messier number, NGC/IC designation, or common name | |
| latitude | No | Observer latitude in degrees (-90 to 90) | |
| longitude | No | Observer longitude in degrees (-180 to 180) | |
| date | No | Date/time in ISO 8601 format (defaults to now) |
Implementation Reference
- src/tools/lookup-object.ts:67-104 (handler)The handler function for the "lookup_object" tool, which looks up a celestial object in the catalog and optionally computes its visibility.
async ({ name, latitude, longitude, date }) => { const store = await getCatalog(); const obj = findObject(store, name); if (!obj) { return { content: [ { type: "text" as const, text: `No object found matching "${name}". Try the search_objects tool to browse by type, constellation, or magnitude.`, }, ], }; } let visibility; if (latitude !== undefined && longitude !== undefined) { const obsDate = date ? new Date(date) : new Date(); visibility = riseTransitSet( obj.ra, obj.dec, latitude as number, longitude as number, obsDate, ); } return { content: [ { type: "text" as const, text: formatObject(obj as import("../types.js").CelestialObject, visibility), }, ], }; }, ); } - src/tools/lookup-object.ts:40-104 (registration)Registration of the "lookup_object" tool on the McpServer.
export function registerLookupObject(server: McpServer): void { server.tool( "lookup_object", "Look up a celestial object by Messier number (e.g. M31), NGC/IC designation (e.g. NGC7000), or common name (e.g. Andromeda Galaxy). Optionally compute visibility from a given location and time.", { name: z .string() .describe( "Object name, Messier number, NGC/IC designation, or common name", ), latitude: z .number() .min(-90) .max(90) .optional() .describe("Observer latitude in degrees (-90 to 90)"), longitude: z .number() .min(-180) .max(180) .optional() .describe("Observer longitude in degrees (-180 to 180)"), date: z .string() .optional() .describe("Date/time in ISO 8601 format (defaults to now)"), }, async ({ name, latitude, longitude, date }) => { const store = await getCatalog(); const obj = findObject(store, name); if (!obj) { return { content: [ { type: "text" as const, text: `No object found matching "${name}". Try the search_objects tool to browse by type, constellation, or magnitude.`, }, ], }; } let visibility; if (latitude !== undefined && longitude !== undefined) { const obsDate = date ? new Date(date) : new Date(); visibility = riseTransitSet( obj.ra, obj.dec, latitude as number, longitude as number, obsDate, ); } return { content: [ { type: "text" as const, text: formatObject(obj as import("../types.js").CelestialObject, visibility), }, ], }; }, ); }