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
| Name | Required | Description | Default |
|---|---|---|---|
| celestial_object | Yes | ||
| lon | Yes | ||
| lat | Yes | ||
| time | Yes | ||
| time_zone | Yes |
Implementation Reference
- src/functions/celestial/impl.py:11-37 (handler)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 })