Skip to main content
Glama
gregario

astronomy-oracle

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
NameRequiredDescriptionDefault
nameYesObject name, Messier number, NGC/IC designation, or common name
latitudeNoObserver latitude in degrees (-90 to 90)
longitudeNoObserver longitude in degrees (-180 to 180)
dateNoDate/time in ISO 8601 format (defaults to now)

Implementation Reference

  • 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),
              },
            ],
          };
        },
      );
    }
  • 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),
              },
            ],
          };
        },
      );
    }
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gregario/astronomy-oracle'

If you have feedback or need assistance with the MCP directory API, please join our Discord server