Skip to main content
Glama

get_celestial_pos

Calculate altitude and azimuth angles for celestial objects like the sun, moon, and stars at specific locations and times.

Instructions

Calculate the altitude and azimuth angles of a celestial object.

Args: celestial_object: Name of object (e.g. "sun", "moon", "andromeda") lon: Observer longitude in degrees lat: Observer latitude in degrees time: Observation time string "YYYY-MM-DD HH:MM:SS" time_zone: IANA timezone string

Returns: Dict with keys "data", "_meta". "data" contains "altitude" and "azimuth" (degrees).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
celestial_objectYes
lonYes
latYes
timeYes
time_zoneYes

Implementation Reference

  • The async handler function decorated with @mcp.tool() that implements the core logic of the get_celestial_pos tool, processing inputs, calling the celestial_pos computation, and formatting the response.
    @mcp.tool()
    async def get_celestial_pos(
        celestial_object: str,
        lon: float,
        lat: float,
        time: str,
        time_zone: str
    ) -> Dict[str, Any]:
        """Calculate the altitude and azimuth angles of a celestial object.
    
        Args:
            celestial_object: Name of object (e.g. "sun", "moon", "andromeda")
            lon: Observer longitude in degrees
            lat: Observer latitude in degrees
            time: Observation time string "YYYY-MM-DD HH:MM:SS"
            time_zone: IANA timezone string
    
        Returns:
            Dict with keys "data", "_meta". "data" contains "altitude" and "azimuth" (degrees).
        """
        location, time_info = process_location_and_time(lon, lat, time, time_zone)
        # Run synchronous celestial calculations in a separate thread to avoid blocking the event loop
        alt, az = await asyncio.to_thread(celestial_pos, celestial_object, location, time_info)
        return format_response({
            "altitude": alt,
            "azimuth": az
        })

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/StarGazer1995/mcp-stargazing'

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