KosmoKrator

data

NASA Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the NASA KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.nasa.*. Use lua_read_doc("integrations.nasa") inside KosmoKrator to discover the same reference at runtime.

Call Lua from the Headless CLI

Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic NASA workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.nasa.get_apod({date = "example_date", start_date = "example_start_date", end_date = "example_end_date", count = 1, thumbs = true}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("nasa"))' --json
kosmo integrations:lua --eval 'print(docs.read("nasa.get_apod"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local nasa = app.integrations.nasa
local result = nasa.get_apod({date = "example_date", start_date = "example_start_date", end_date = "example_end_date", count = 1, thumbs = true})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.nasa, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.nasa.default.* or app.integrations.nasa.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need NASA, use the narrower mcp:lua command.

MCP Lua command
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

NASA Lua API Reference

Namespace: app.integrations.nasa

NASA tools use three public NASA surfaces:

  • api.nasa.gov for APOD, Mars rover photos, NeoWs, DONKI, EPIC, and Earth imagery/assets. These requests send the configured API key or DEMO_KEY.
  • images-api.nasa.gov for Image and Video Library search, assets, metadata, and captions. These requests do not send the API key.
  • eonet.gsfc.nasa.gov/api/v3 for EONET natural events. These requests do not send the API key.

APOD

get_apod({ date?, start_date?, end_date?, count?, thumbs? })

Returns a single APOD entry, entries when a date range or random count returns multiple entries, and includes thumbnail_url for videos when requested and available.

local apod = app.integrations.nasa.get_apod({
  date = "2026-01-15",
  thumbs = true
})

print(apod.title)
print(apod.url)

Mars Rover Photos

get_mars_rover_photos({ rover, sol?, earth_date?, camera?, page? })

Use sol or earth_date. Rovers include curiosity, opportunity, spirit, and perseverance.

local photos = app.integrations.nasa.get_mars_rover_photos({
  rover = "curiosity",
  sol = 1000,
  camera = "MAST"
})

for _, photo in ipairs(photos.photos) do
  print(photo.earth_date .. " " .. photo.img_src)
end

Asteroids

get_asteroids({ start_date?, end_date? })

Returns a NeoWs feed grouped by date. NASA limits feed date ranges to about seven days.

browse_asteroids({ page?, size? })

Browses the overall NeoWs dataset and is useful for finding asteroid IDs.

get_asteroid({ id })

Fetches one asteroid by NASA/JPL ID.

local feed = app.integrations.nasa.get_asteroids({
  start_date = "2026-01-01",
  end_date = "2026-01-07"
})

print(feed.total_asteroids)

DONKI

get_donki_events({ type, start_date?, end_date?, most_accurate_only?, complete_entry_only?, speed?, half_angle?, catalog?, keyword?, location?, notification_type? })

Supported type values are CME, CMEAnalysis, GST, IPS, FLR, SEP, MPC, RBE, HSS, WSAEnlilSimulations, and notifications.

local flares = app.integrations.nasa.get_donki_events({
  type = "FLR",
  start_date = "2026-01-01",
  end_date = "2026-01-07"
})

EPIC

get_epic_images({ collection?, date?, all_dates? })

collection is natural or enhanced. With no date, the tool returns latest image metadata. With all_dates = true, it returns available dates instead of image metadata.

local latest = app.integrations.nasa.get_epic_images({
  collection = "natural"
})

local dates = app.integrations.nasa.get_epic_images({
  collection = "enhanced",
  all_dates = true
})

Earth

get_earth_imagery({ lon, lat, date?, dim? })

Returns NASA Earth imagery data for a coordinate. Some NASA responses are binary image content; in that case the tool returns content_type, size_bytes, and a note instead of embedding the image bytes.

get_earth_assets({ lon, lat, date?, dim? })

Returns available Earth asset dates for a coordinate.

local assets = app.integrations.nasa.get_earth_assets({
  lon = -122.4194,
  lat = 37.7749,
  date = "2026-01-01"
})

Image Library

search_images({ q, media_type?, page?, year_start?, year_end?, center?, keywords?, nasa_id? })

Searches the NASA Image and Video Library and returns normalized items with nasa_id, title, description, date_created, media_type, keywords, center, photographer, thumbnail, and links.

get_image_asset({ nasa_id })

Returns the asset manifest for a media ID.

get_image_metadata({ nasa_id })

Returns the metadata document for a media ID.

get_image_captions({ nasa_id })

Returns caption file locations for a media ID.

local results = app.integrations.nasa.search_images({
  q = "apollo 11",
  media_type = "image"
})

local first = results.items[1]
local asset = app.integrations.nasa.get_image_asset({
  nasa_id = first.nasa_id
})

EONET

get_eonet_events({ status?, category?, source?, limit?, days?, start?, end? })

Lists EONET v3 natural events.

get_eonet_event({ id })

Fetches one event by ID.

get_eonet_categories({})

Lists category IDs for filters.

get_eonet_sources({})

Lists source IDs for filters.

local events = app.integrations.nasa.get_eonet_events({
  status = "open",
  category = "wildfires",
  limit = 10
})

for _, event in ipairs(events.events or {}) do
  print(event.id .. " " .. event.title)
end
Raw agent markdown
# NASA Lua API Reference

Namespace: `app.integrations.nasa`

NASA tools use three public NASA surfaces:

- `api.nasa.gov` for APOD, Mars rover photos, NeoWs, DONKI, EPIC, and Earth imagery/assets. These requests send the configured API key or `DEMO_KEY`.
- `images-api.nasa.gov` for Image and Video Library search, assets, metadata, and captions. These requests do not send the API key.
- `eonet.gsfc.nasa.gov/api/v3` for EONET natural events. These requests do not send the API key.

## APOD

`get_apod({ date?, start_date?, end_date?, count?, thumbs? })`

Returns a single APOD entry, `entries` when a date range or random count returns multiple entries, and includes `thumbnail_url` for videos when requested and available.

```lua
local apod = app.integrations.nasa.get_apod({
  date = "2026-01-15",
  thumbs = true
})

print(apod.title)
print(apod.url)
```

## Mars Rover Photos

`get_mars_rover_photos({ rover, sol?, earth_date?, camera?, page? })`

Use `sol` or `earth_date`. Rovers include `curiosity`, `opportunity`, `spirit`, and `perseverance`.

```lua
local photos = app.integrations.nasa.get_mars_rover_photos({
  rover = "curiosity",
  sol = 1000,
  camera = "MAST"
})

for _, photo in ipairs(photos.photos) do
  print(photo.earth_date .. " " .. photo.img_src)
end
```

## Asteroids

`get_asteroids({ start_date?, end_date? })`

Returns a NeoWs feed grouped by date. NASA limits feed date ranges to about seven days.

`browse_asteroids({ page?, size? })`

Browses the overall NeoWs dataset and is useful for finding asteroid IDs.

`get_asteroid({ id })`

Fetches one asteroid by NASA/JPL ID.

```lua
local feed = app.integrations.nasa.get_asteroids({
  start_date = "2026-01-01",
  end_date = "2026-01-07"
})

print(feed.total_asteroids)
```

## DONKI

`get_donki_events({ type, start_date?, end_date?, most_accurate_only?, complete_entry_only?, speed?, half_angle?, catalog?, keyword?, location?, notification_type? })`

Supported `type` values are `CME`, `CMEAnalysis`, `GST`, `IPS`, `FLR`, `SEP`, `MPC`, `RBE`, `HSS`, `WSAEnlilSimulations`, and `notifications`.

```lua
local flares = app.integrations.nasa.get_donki_events({
  type = "FLR",
  start_date = "2026-01-01",
  end_date = "2026-01-07"
})
```

## EPIC

`get_epic_images({ collection?, date?, all_dates? })`

`collection` is `natural` or `enhanced`. With no date, the tool returns latest image metadata. With `all_dates = true`, it returns available dates instead of image metadata.

```lua
local latest = app.integrations.nasa.get_epic_images({
  collection = "natural"
})

local dates = app.integrations.nasa.get_epic_images({
  collection = "enhanced",
  all_dates = true
})
```

## Earth

`get_earth_imagery({ lon, lat, date?, dim? })`

Returns NASA Earth imagery data for a coordinate. Some NASA responses are binary image content; in that case the tool returns `content_type`, `size_bytes`, and a note instead of embedding the image bytes.

`get_earth_assets({ lon, lat, date?, dim? })`

Returns available Earth asset dates for a coordinate.

```lua
local assets = app.integrations.nasa.get_earth_assets({
  lon = -122.4194,
  lat = 37.7749,
  date = "2026-01-01"
})
```

## Image Library

`search_images({ q, media_type?, page?, year_start?, year_end?, center?, keywords?, nasa_id? })`

Searches the NASA Image and Video Library and returns normalized items with `nasa_id`, `title`, `description`, `date_created`, `media_type`, `keywords`, `center`, `photographer`, `thumbnail`, and `links`.

`get_image_asset({ nasa_id })`

Returns the asset manifest for a media ID.

`get_image_metadata({ nasa_id })`

Returns the metadata document for a media ID.

`get_image_captions({ nasa_id })`

Returns caption file locations for a media ID.

```lua
local results = app.integrations.nasa.search_images({
  q = "apollo 11",
  media_type = "image"
})

local first = results.items[1]
local asset = app.integrations.nasa.get_image_asset({
  nasa_id = first.nasa_id
})
```

## EONET

`get_eonet_events({ status?, category?, source?, limit?, days?, start?, end? })`

Lists EONET v3 natural events.

`get_eonet_event({ id })`

Fetches one event by ID.

`get_eonet_categories({})`

Lists category IDs for filters.

`get_eonet_sources({})`

Lists source IDs for filters.

```lua
local events = app.integrations.nasa.get_eonet_events({
  status = "open",
  category = "wildfires",
  limit = 10
})

for _, event in ipairs(events.events or {}) do
  print(event.id .. " " .. event.title)
end
```
Metadata-derived Lua example
local result = app.integrations.nasa.get_apod({date = "example_date", start_date = "example_start_date", end_date = "example_end_date", count = 1, thumbs = true})
print(result)

Functions

get_apod Read

Get the NASA Astronomy Picture of the Day (APOD). Returns the daily astronomical image or photo along with an explanation written by a professional astronomer. You can request a specific date or a range of dates.

Lua path
app.integrations.nasa.get_apod
Full name
nasa.nasa_get_apod
ParameterTypeRequiredDescription
date string no A specific date in YYYY-MM-DD format (defaults to today).
start_date string no Start date for a date range in YYYY-MM-DD format. Use with end_date to get multiple APOD entries.
end_date string no End date for a date range in YYYY-MM-DD format. Must be used together with start_date.
count integer no Return this many random APOD entries. Do not combine with date or date ranges.
thumbs boolean no When true, include thumbnail URLs for video entries when NASA provides them.
mars_rover_photos Read

Get photos from NASA Mars rovers (Curiosity, Opportunity, Spirit, Perseverance). Query by sol (Martian day) or Earth date, and optionally filter by camera. Returns photo URLs and metadata.

Lua path
app.integrations.nasa.mars_rover_photos
Full name
nasa.nasa_get_mars_rover_photos
ParameterTypeRequiredDescription
rover string yes Rover name: "curiosity", "opportunity", "spirit", or "perseverance".
sol integer no The sol (Martian day) number. Use this OR earth_date, not both.
earth_date string no Earth date in YYYY-MM-DD format. Use this OR sol, not both.
camera string no Camera abbreviation: FHAZ, RHAZ, MAST, CHEMCAM, MAHLI, MARDI, NAVCAM, PANCAM, MINITES, etc.
page integer no Page number for pagination (default 1, 25 photos per page).
asteroid_feed Read

Get Near Earth Objects (asteroids) for a date range from NASA. Returns a list of asteroids with their estimated diameter, velocity, distance from Earth, and whether they are potentially hazardous.

Lua path
app.integrations.nasa.asteroid_feed
Full name
nasa.nasa_get_asteroids
ParameterTypeRequiredDescription
start_date string no Start date in YYYY-MM-DD format (defaults to today).
end_date string no End date in YYYY-MM-DD format (max 7 days after start_date).
browse_asteroids Read

Browse the overall NASA Near Earth Object dataset. Use this when you need asteroid IDs before looking up a specific object.

Lua path
app.integrations.nasa.browse_asteroids
Full name
nasa.nasa_browse_asteroids
ParameterTypeRequiredDescription
page integer no Optional page number.
size integer no Optional page size.
asteroid_detail Read

Get detailed information about a specific Near Earth Object (asteroid) by its NASA ID. Returns orbital data, estimated diameter, close approach history, and hazard assessment.

Lua path
app.integrations.nasa.asteroid_detail
Full name
nasa.nasa_get_asteroid
ParameterTypeRequiredDescription
id string yes The asteroid's unique NASA ID (e.g., "2534304"). You can find IDs using the nasa_get_asteroids tool.
donki_events Read

Get DONKI space-weather events such as CME, CMEAnalysis, GST, IPS, FLR, SEP, MPC, RBE, HSS, WSAEnlilSimulations, or notifications.

Lua path
app.integrations.nasa.donki_events
Full name
nasa.nasa_get_donki_events
ParameterTypeRequiredDescription
type string yes DONKI event type: CME, CMEAnalysis, GST, IPS, FLR, SEP, MPC, RBE, HSS, WSAEnlilSimulations, or notifications.
start_date string no Start date in YYYY-MM-DD format.
end_date string no End date in YYYY-MM-DD format.
most_accurate_only boolean no CMEAnalysis filter for most accurate results.
complete_entry_only boolean no CMEAnalysis filter for complete entries.
speed integer no CMEAnalysis lower speed limit.
half_angle integer no CMEAnalysis lower half-angle limit.
catalog string no DONKI catalog filter where supported.
keyword string no DONKI keyword filter where supported.
location string no IPS location filter where supported.
notification_type string no Notification filter such as all, FLR, SEP, CME, IPS, MPC, GST, RBE, or report.
epic_images Read

Get NASA EPIC image metadata for latest images, a specific date, or all available dates from the natural or enhanced collection.

Lua path
app.integrations.nasa.epic_images
Full name
nasa.nasa_get_epic_images
ParameterTypeRequiredDescription
collection string no EPIC collection: natural or enhanced. Defaults to natural.
date string no Optional date in YYYY-MM-DD format.
all_dates boolean no When true, return all available dates instead of image metadata.
earth_imagery Read

Get Landsat Earth imagery for a longitude, latitude, date, and optional image dimension.

Lua path
app.integrations.nasa.earth_imagery
Full name
nasa.nasa_get_earth_imagery
ParameterTypeRequiredDescription
lon number yes Longitude.
lat number yes Latitude.
date string no Optional date in YYYY-MM-DD format.
dim number no Optional image width and height in degrees.
earth_assets Read

Get available Landsat Earth asset dates for a longitude, latitude, optional date, and optional dimension.

Lua path
app.integrations.nasa.earth_assets
Full name
nasa.nasa_get_earth_assets
ParameterTypeRequiredDescription
lon number yes Longitude.
lat number yes Latitude.
date string no Optional date in YYYY-MM-DD format.
dim number no Optional image width and height in degrees.
search_images Read

Search the NASA Image and Video Library for space, astronomy, and mission imagery. Returns image URLs, titles, descriptions, and metadata from NASA's vast collection.

Lua path
app.integrations.nasa.search_images
Full name
nasa.nasa_search_images
ParameterTypeRequiredDescription
q string yes The search query (e.g., "moon landing", "Mars", "black hole", "Saturn rings").
media_type string no Filter by media type: "image", "video", or "audio". Defaults to all types.
page integer no Page number for pagination (default 1).
year_start string no Optional starting year for media creation date filtering.
year_end string no Optional ending year for media creation date filtering.
center string no Optional NASA center filter such as JPL, KSC, or GSFC.
keywords string no Optional comma-separated keyword filter.
nasa_id string no Optional exact NASA media ID filter.
image_asset Read

Get a NASA Image and Video Library asset manifest by NASA media ID, including downloadable asset URLs.

Lua path
app.integrations.nasa.image_asset
Full name
nasa.nasa_get_image_asset
ParameterTypeRequiredDescription
nasa_id string yes NASA media ID returned by nasa_search_images.
image_metadata Read

Get the metadata document for a NASA Image and Video Library media asset by NASA media ID.

Lua path
app.integrations.nasa.image_metadata
Full name
nasa.nasa_get_image_metadata
ParameterTypeRequiredDescription
nasa_id string yes NASA media ID returned by nasa_search_images.
image_captions Read

Get caption file locations for a NASA Image and Video Library media asset by NASA media ID.

Lua path
app.integrations.nasa.image_captions
Full name
nasa.nasa_get_image_captions
ParameterTypeRequiredDescription
nasa_id string yes NASA media ID returned by nasa_search_images.
eonet_events Read

List NASA EONET v3 natural events with optional filters for status, category, source, limit, and date range.

Lua path
app.integrations.nasa.eonet_events
Full name
nasa.nasa_get_eonet_events
ParameterTypeRequiredDescription
status string no Event status such as open, closed, or all.
category string no Category ID or comma-separated category IDs.
source string no Source ID or comma-separated source IDs.
limit integer no Maximum number of events to return.
days integer no Only return events from the last number of days.
start string no Start date in YYYY-MM-DD format.
end string no End date in YYYY-MM-DD format.
eonet_event Read

Get one NASA EONET v3 natural event by event ID, including geometries, categories, and sources.

Lua path
app.integrations.nasa.eonet_event
Full name
nasa.nasa_get_eonet_event
ParameterTypeRequiredDescription
id string yes EONET event ID.
eonet_categories Read

List NASA EONET v3 natural event categories for filtering event searches.

Lua path
app.integrations.nasa.eonet_categories
Full name
nasa.nasa_get_eonet_categories
ParameterTypeRequiredDescription
No parameters.
eonet_sources Read

List NASA EONET v3 natural event sources for filtering event searches.

Lua path
app.integrations.nasa.eonet_sources
Full name
nasa.nasa_get_eonet_sources
ParameterTypeRequiredDescription
No parameters.