Skip to main content
Glama

get_visible_planets

Find which planets are visible from your location by providing coordinates, date, and timezone to identify solar system planets currently above the horizon.

Instructions

Get a list of solar system planets currently visible (above horizon).

Args: 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" is a list of planet dicts (name, altitude, azimuth).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lonYes
latYes
timeYes
time_zoneYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler for 'get_visible_planets'. Processes location/time inputs, delegates to core calculation via asyncio.to_thread, and formats the response with format_response.
    @mcp.tool()
    async def get_visible_planets(
        lon: float,
        lat: float,
        time: str,
        time_zone: str
    ) -> Dict[str, Any]:
        """Get a list of solar system planets currently visible (above horizon).
        
        Args:
            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" is a list of planet dicts (name, altitude, azimuth).
        """
        location, time_info = process_location_and_time(lon, lat, time, time_zone)
        # Note: Function name collision with imported function 'get_visible_planets'
        # Use the imported function from src.celestial
        from src.celestial import get_visible_planets as calc_visible_planets
        planets = await asyncio.to_thread(calc_visible_planets, location, time_info)
        return format_response(planets)
  • Core implementation that iterates over solar system planets, computes their alt/az using astropy.get_body and AltAz frame, and collects those with altitude > 0.
    def get_visible_planets(
        observer_location: EarthLocation,
        time: Union[Time, datetime]
    ) -> list[Dict[str, Any]]:
        """
        Get a list of planets currently above the horizon.
        
        Args:
            observer_location: Observer's EarthLocation.
            time: Observation time.
            
        Returns:
            List of dicts containing planet name, altitude, azimuth, and magnitude (if available).
        """
        # Convert local time to UTC if input is datetime
        if isinstance(time, datetime):
            if time.tzinfo is None:
                raise ValueError("Input datetime must be timezone-aware for local time.")
            time = Time(time.astimezone(pytz.UTC))
    
        planets = ["mercury", "venus", "mars", "jupiter", "saturn", "uranus", "neptune"]
        visible_planets = []
        
        for planet in planets:
            # Get coordinates
            obj_coord = get_body(planet, time)
            altaz_frame = AltAz(obstime=time, location=observer_location)
            altaz = obj_coord.transform_to(altaz_frame)
            
            # Check if above horizon
            if altaz.alt.deg > 0:
                visible_planets.append({
                    "name": planet.capitalize(),
                    "altitude": float(altaz.alt.deg),
                    "azimuth": float(altaz.az.deg),
                    "constellation": None # Placeholder for future implementation
                })
                
        return visible_planets
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses the return format (dict with 'data' and '_meta' keys) and what 'data' contains, which is useful behavioral context. However, it doesn't mention error conditions, rate limits, or authentication needs, leaving gaps for a tool with 4 required parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose, followed by structured Args and Returns sections. Every sentence adds value: the first states what the tool does, the Args explain parameters, and Returns clarifies output. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 required parameters, 0% schema coverage, no annotations, but with an output schema (implied by Returns section), the description does well by explaining parameters and return format. It could be more complete by mentioning error handling or example usage, but covers the essentials for a read-only query tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaning by explaining each parameter's purpose (observer coordinates, observation time, timezone) and provides format examples ('YYYY-MM-DD HH:MM:SS', 'IANA timezone string'), which goes beyond the bare schema types. However, it doesn't specify valid ranges for lon/lat or time formats beyond the example.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get a list') and resource ('solar system planets currently visible'), with precise scope ('above horizon'). It distinguishes from siblings like get_celestial_pos (general positions) or get_moon_info (specific to moon) by focusing on planetary visibility from an observer's location.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for checking visible planets at a specific time and location, but doesn't explicitly state when to use this vs. alternatives like get_celestial_rise_set (which might provide rise/set times) or get_constellation (which focuses on constellations). No exclusions or prerequisites are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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