KosmoKrator

data

NASA Lua API for KosmoKrator Agents

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

6 functions 6 read 0 write API key auth

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.

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

get_apod

Get the NASA Astronomy Picture of the Day (APOD).

Parameters

NameTypeRequiredDescription
datestringnoSpecific date in YYYY-MM-DD format (defaults to today)
start_datestringnoStart date for a range in YYYY-MM-DD format
end_datestringnoEnd date for a range in YYYY-MM-DD format

Use date for a single entry, or start_date + end_date for multiple days.

Examples

-- Today's APOD
local result = app.integrations.nasa.get_apod({})

print(result.title)
print(result.explanation)
print("Image: " .. result.url)
print("HD: " .. (result.hdurl or "N/A"))
-- APOD for a specific date
local result = app.integrations.nasa.get_apod({
  date = "2025-06-15"
})

print(result.title)
-- APOD for a date range
local result = app.integrations.nasa.get_apod({
  start_date = "2025-06-01",
  end_date = "2025-06-07"
})

for _, entry in ipairs(result.entries) do
  print(entry.date .. ": " .. entry.title)
end

print("Total: " .. result.count .. " entries")

get_mars_rover_photos

Get photos from Mars rovers (Curiosity, Opportunity, Spirit, Perseverance).

Parameters

NameTypeRequiredDescription
roverstringyesRover name: "curiosity", "opportunity", "spirit", or "perseverance"
solintegernoMartian day (sol) number. Use this OR earth_date
earth_datestringnoEarth date in YYYY-MM-DD format. Use this OR sol
camerastringnoCamera abbreviation (e.g., "FHAZ", "MAST", "NAVCAM")
pageintegernoPage number (default 1, 25 photos per page)

Camera Abbreviations

CodeCamera
FHAZFront Hazard Avoidance Camera
RHAZRear Hazard Avoidance Camera
MASTMast Camera
CHEMCAMChemistry and Camera Complex
MAHLIMars Hand Lens Imager
MARDIMars Descent Imager
NAVCAMNavigation Camera
PANCAMPanoramic Camera
MINITESMiniature Thermal Emission Spectrometer

Example

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

print("Found " .. result.count .. " photos from " .. result.rover)

for _, photo in ipairs(result.photos) do
  print(photo.earth_date .. " | " .. photo.camera.full_name)
  print("  " .. photo.img_src)
end
-- By Earth date
local result = app.integrations.nasa.get_mars_rover_photos({
  rover = "perseverance",
  earth_date = "2025-03-15"
})

get_asteroids

Get Near Earth Objects (asteroids) for a date range.

Parameters

NameTypeRequiredDescription
start_datestringnoStart date in YYYY-MM-DD format (defaults to today)
end_datestringnoEnd date in YYYY-MM-DD format (max 7 days after start_date)

Example

local result = app.integrations.nasa.get_asteroids({
  start_date = "2025-06-01",
  end_date = "2025-06-08"
})

print("Total asteroids: " .. result.total_asteroids)

for date, asteroids in pairs(result.near_earth_objects) do
  print("\n" .. date .. ":")
  for _, ast in ipairs(asteroids) do
    local hazardous = ast.is_potentially_hazardous and " ⚠️" or ""
    print("  " .. ast.name .. hazardous)
    if ast.close_approach then
      print("    Distance: " .. math.floor(ast.close_approach.miss_distance_km) .. " km")
      print("    Speed: " .. math.floor(ast.close_approach.velocity_km_s) .. " km/s")
    end
  end
end

get_asteroid

Get detailed information about a specific asteroid by its NASA ID.

Parameters

NameTypeRequiredDescription
idstringyesThe asteroid’s NASA ID (find IDs with get_asteroids)

Example

local result = app.integrations.nasa.get_asteroid({
  id = "2534304"
})

print("Name: " .. result.name)
print("Potentially hazardous: " .. tostring(result.is_potentially_hazardous))
print("Diameter: " .. result.estimated_diameter_km.min .. " – " .. result.estimated_diameter_km.max .. " km")

if result.close_approaches then
  print("Close approaches:")
  for _, approach in ipairs(result.close_approaches) do
    print("  " .. approach.date .. " — " .. math.floor(approach.miss_distance_km) .. " km from " .. approach.orbiting_body)
  end
end

search_images

Search the NASA Image and Video Library.

Parameters

NameTypeRequiredDescription
qstringyesSearch query (e.g., "moon landing", "Mars", "Saturn rings")
media_typestringnoFilter: "image", "video", or "audio"
pageintegernoPage number (default 1)

Example

local result = app.integrations.nasa.search_images({
  q = "black hole",
  media_type = "image"
})

print("Total results: " .. result.total_hits)

for _, item in ipairs(result.items) do
  print(item.title)
  print("  " .. (item.thumbnail or "no image"))
  print("  Date: " .. (item.date_created or "unknown"))
end

get_current_user

Get the current NASA API configuration status.

Parameters

None.

Example

local info = app.integrations.nasa.get_current_user({})

print(info.service)
print(info.message)
print("Configured: " .. tostring(info.configured))
print(info.note)
Raw agent markdown
# NASA — Lua API Reference

## get_apod

Get the NASA Astronomy Picture of the Day (APOD).

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `date` | string | no | Specific date in YYYY-MM-DD format (defaults to today) |
| `start_date` | string | no | Start date for a range in YYYY-MM-DD format |
| `end_date` | string | no | End date for a range in YYYY-MM-DD format |

Use `date` for a single entry, or `start_date` + `end_date` for multiple days.

### Examples

```lua
-- Today's APOD
local result = app.integrations.nasa.get_apod({})

print(result.title)
print(result.explanation)
print("Image: " .. result.url)
print("HD: " .. (result.hdurl or "N/A"))
```

```lua
-- APOD for a specific date
local result = app.integrations.nasa.get_apod({
  date = "2025-06-15"
})

print(result.title)
```

```lua
-- APOD for a date range
local result = app.integrations.nasa.get_apod({
  start_date = "2025-06-01",
  end_date = "2025-06-07"
})

for _, entry in ipairs(result.entries) do
  print(entry.date .. ": " .. entry.title)
end

print("Total: " .. result.count .. " entries")
```

---

## get_mars_rover_photos

Get photos from Mars rovers (Curiosity, Opportunity, Spirit, Perseverance).

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `rover` | string | yes | Rover name: `"curiosity"`, `"opportunity"`, `"spirit"`, or `"perseverance"` |
| `sol` | integer | no | Martian day (sol) number. Use this OR `earth_date` |
| `earth_date` | string | no | Earth date in YYYY-MM-DD format. Use this OR `sol` |
| `camera` | string | no | Camera abbreviation (e.g., `"FHAZ"`, `"MAST"`, `"NAVCAM"`) |
| `page` | integer | no | Page number (default 1, 25 photos per page) |

### Camera Abbreviations

| Code | Camera |
|------|--------|
| FHAZ | Front Hazard Avoidance Camera |
| RHAZ | Rear Hazard Avoidance Camera |
| MAST | Mast Camera |
| CHEMCAM | Chemistry and Camera Complex |
| MAHLI | Mars Hand Lens Imager |
| MARDI | Mars Descent Imager |
| NAVCAM | Navigation Camera |
| PANCAM | Panoramic Camera |
| MINITES | Miniature Thermal Emission Spectrometer |

### Example

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

print("Found " .. result.count .. " photos from " .. result.rover)

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

```lua
-- By Earth date
local result = app.integrations.nasa.get_mars_rover_photos({
  rover = "perseverance",
  earth_date = "2025-03-15"
})
```

---

## get_asteroids

Get Near Earth Objects (asteroids) for a date range.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `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) |

### Example

```lua
local result = app.integrations.nasa.get_asteroids({
  start_date = "2025-06-01",
  end_date = "2025-06-08"
})

print("Total asteroids: " .. result.total_asteroids)

for date, asteroids in pairs(result.near_earth_objects) do
  print("\n" .. date .. ":")
  for _, ast in ipairs(asteroids) do
    local hazardous = ast.is_potentially_hazardous and " ⚠️" or ""
    print("  " .. ast.name .. hazardous)
    if ast.close_approach then
      print("    Distance: " .. math.floor(ast.close_approach.miss_distance_km) .. " km")
      print("    Speed: " .. math.floor(ast.close_approach.velocity_km_s) .. " km/s")
    end
  end
end
```

---

## get_asteroid

Get detailed information about a specific asteroid by its NASA ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The asteroid's NASA ID (find IDs with `get_asteroids`) |

### Example

```lua
local result = app.integrations.nasa.get_asteroid({
  id = "2534304"
})

print("Name: " .. result.name)
print("Potentially hazardous: " .. tostring(result.is_potentially_hazardous))
print("Diameter: " .. result.estimated_diameter_km.min .. " – " .. result.estimated_diameter_km.max .. " km")

if result.close_approaches then
  print("Close approaches:")
  for _, approach in ipairs(result.close_approaches) do
    print("  " .. approach.date .. " — " .. math.floor(approach.miss_distance_km) .. " km from " .. approach.orbiting_body)
  end
end
```

---

## search_images

Search the NASA Image and Video Library.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `q` | string | yes | Search query (e.g., `"moon landing"`, `"Mars"`, `"Saturn rings"`) |
| `media_type` | string | no | Filter: `"image"`, `"video"`, or `"audio"` |
| `page` | integer | no | Page number (default 1) |

### Example

```lua
local result = app.integrations.nasa.search_images({
  q = "black hole",
  media_type = "image"
})

print("Total results: " .. result.total_hits)

for _, item in ipairs(result.items) do
  print(item.title)
  print("  " .. (item.thumbnail or "no image"))
  print("  Date: " .. (item.date_created or "unknown"))
end
```

---

## get_current_user

Get the current NASA API configuration status.

### Parameters

None.

### Example

```lua
local info = app.integrations.nasa.get_current_user({})

print(info.service)
print(info.message)
print("Configured: " .. tostring(info.configured))
print(info.note)
```

Metadata-Derived Lua Example

local result = app.integrations.nasa.nasa_get_apod({
  date = "example_date",
  start_date = "example_start_date",
  end_date = "example_end_date"
})
print(result)

Functions

nasa_get_apod

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.

Operation
Read read
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.

nasa_get_asteroid

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.

Operation
Read read
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.

nasa_get_asteroids

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.

Operation
Read read
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).

nasa_get_current_user

Get information about the current NASA API configuration. The NASA API is public and does not require user authentication — this tool returns the API key status and available endpoints.

Operation
Read read
Full name
nasa.nasa_get_current_user
ParameterTypeRequiredDescription
No parameters.

nasa_get_mars_rover_photos

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.

Operation
Read read
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).

nasa_search_images

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.

Operation
Read read
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).