get_nearest_event
Return the nearest occurrence of one event type before or after a date —
walks outward from any date in years -5000..+5000, instant.
Ideal for questions like "when is the next Kumbh Mela?", "when does Guru
go retrograde next?", "when is Makara Sankranti?" or "when was the last
total solar eclipse before 1500 CE?" without scanning a whole range.
Args:
event_type: One of the values listed in get_astro_events (e.g.
"kumbh_mela", "solar_eclipse", "adhik_maas", "sankranti").
from_date: Reference date, YYYY-MM-DD (BC years like "-0500-01-01" allowed).
direction: "next" (first after from_date) or "prev" (last before).
ayanamsa: "Lahiri" (default) or "Sayan".
grah: Optional grah filter for grah-specific event types.
location: Optional Kumbh Mela location (Haridwar/Prayagraj/Ujjain/Nashik).
Returns:
Dict with event_type, direction, from_date, ayanamsa, valid_range, and
`event` (null if the reference date is outside the data range).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| grah | No | ||
| ayanamsa | No | Lahiri | |
| location | No | ||
| direction | No | next | |
| from_date | Yes | ||
| event_type | Yes |