KosmoKrator

data

OpenWeather Lua API for KosmoKrator Agents

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

Lua Namespace

Agents call this integration through app.integrations.openweather.*. Use lua_read_doc("integrations.openweather") 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 OpenWeather workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.openweather.current({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("openweather"))' --json
kosmo integrations:lua --eval 'print(docs.read("openweather.current"))' --json

Workflow file

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

workflow.lua
local openweather = app.integrations.openweather
local result = openweather.current({})

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.openweather, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.openweather.default.* or app.integrations.openweather.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need OpenWeather, 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.

OpenWeather

Namespace: openweather

OpenWeather provides current weather, 5 day / 3 hour forecast, One Call 3.0, air pollution, and geocoding data. All tools require an OpenWeather API key. Some One Call 3.0 tools require the API key to have access to the One Call subscription product.

Location Lookups

Prefer coordinates when possible. Current weather and 5 day forecast also accept legacy selectors such as q, id, or zip.

local places = openweather.geocoding_direct({
  q = "Berlin,DE",
  limit = 1,
})

local weather = openweather.current_weather({
  lat = 52.52,
  lon = 13.41,
  units = "metric",
})

Weather And Forecasts

  • openweather_current_weather returns the current /data/2.5/weather response for coordinates or a legacy city selector.
  • openweather_forecast_5_day returns the /data/2.5/forecast list of 3 hour forecast periods.
  • openweather_one_call returns One Call 3.0 current, minutely, hourly, daily, and alert sections unless excluded.
  • openweather_one_call_timemachine returns One Call 3.0 data for a Unix timestamp.
  • openweather_one_call_day_summary returns the One Call 3.0 daily aggregation for date.
  • openweather_one_call_overview returns OpenWeather’s overview summary output for a coordinate pair.

Use exclude as an array; the integration sends it as the comma-separated value OpenWeather expects.

local daily = openweather.one_call({
  lat = 52.52,
  lon = 13.41,
  exclude = { "current", "minutely", "hourly" },
  units = "metric",
})

Air Pollution

Air pollution tools require lat and lon. History additionally requires Unix timestamps:

local pollution = openweather.air_pollution_history({
  lat = 52.52,
  lon = 13.41,
  start = 1704067200,
  ["end"] = 1704153600,
})

Return Shape

The integration returns parsed OpenWeather JSON with minimal normalization. OpenWeather fields such as weather, main, wind, list, components, coord, lat, and lon keep their upstream names. API errors are returned as tool errors with the OpenWeather message when available.

Advanced official parameters can be passed through query, but top-level tool arguments override duplicate keys from query.

Raw agent markdown
# OpenWeather

Namespace: `openweather`

OpenWeather provides current weather, 5 day / 3 hour forecast, One Call 3.0, air pollution, and geocoding data. All tools require an OpenWeather API key. Some One Call 3.0 tools require the API key to have access to the One Call subscription product.

## Location Lookups

Prefer coordinates when possible. Current weather and 5 day forecast also accept legacy selectors such as `q`, `id`, or `zip`.

```lua
local places = openweather.geocoding_direct({
  q = "Berlin,DE",
  limit = 1,
})

local weather = openweather.current_weather({
  lat = 52.52,
  lon = 13.41,
  units = "metric",
})
```

## Weather And Forecasts

- `openweather_current_weather` returns the current `/data/2.5/weather` response for coordinates or a legacy city selector.
- `openweather_forecast_5_day` returns the `/data/2.5/forecast` list of 3 hour forecast periods.
- `openweather_one_call` returns One Call 3.0 current, minutely, hourly, daily, and alert sections unless excluded.
- `openweather_one_call_timemachine` returns One Call 3.0 data for a Unix timestamp.
- `openweather_one_call_day_summary` returns the One Call 3.0 daily aggregation for `date`.
- `openweather_one_call_overview` returns OpenWeather's overview summary output for a coordinate pair.

Use `exclude` as an array; the integration sends it as the comma-separated value OpenWeather expects.

```lua
local daily = openweather.one_call({
  lat = 52.52,
  lon = 13.41,
  exclude = { "current", "minutely", "hourly" },
  units = "metric",
})
```

## Air Pollution

Air pollution tools require `lat` and `lon`. History additionally requires Unix timestamps:

```lua
local pollution = openweather.air_pollution_history({
  lat = 52.52,
  lon = 13.41,
  start = 1704067200,
  ["end"] = 1704153600,
})
```

## Return Shape

The integration returns parsed OpenWeather JSON with minimal normalization. OpenWeather fields such as `weather`, `main`, `wind`, `list`, `components`, `coord`, `lat`, and `lon` keep their upstream names. API errors are returned as tool errors with the OpenWeather message when available.

Advanced official parameters can be passed through `query`, but top-level tool arguments override duplicate keys from `query`.
Metadata-derived Lua example
local result = app.integrations.openweather.current({})
print(result)

Functions

current Read

Get current weather data.

Lua path
app.integrations.openweather.current
Full name
openweather.openweather_current_weather
ParameterTypeRequiredDescription
No parameters.
5_day_forecast Read

Get 5 day / 3 hour forecast data.

Lua path
app.integrations.openweather.5_day_forecast
Full name
openweather.openweather_forecast_5_day
ParameterTypeRequiredDescription
No parameters.
one_call Read

Get One Call API 3.0 current weather, forecasts, and alerts.

Lua path
app.integrations.openweather.one_call
Full name
openweather.openweather_one_call
ParameterTypeRequiredDescription
No parameters.
one_call_timemachine Read

Get One Call API 3.0 data for a timestamp.

Lua path
app.integrations.openweather.one_call_timemachine
Full name
openweather.openweather_one_call_timemachine
ParameterTypeRequiredDescription
No parameters.
one_call_day_summary Read

Get daily aggregated weather data.

Lua path
app.integrations.openweather.one_call_day_summary
Full name
openweather.openweather_one_call_day_summary
ParameterTypeRequiredDescription
No parameters.
one_call_overview Read

Get human-readable weather overview output.

Lua path
app.integrations.openweather.one_call_overview
Full name
openweather.openweather_one_call_overview
ParameterTypeRequiredDescription
No parameters.
air_pollution Read

Get current air pollution data.

Lua path
app.integrations.openweather.air_pollution
Full name
openweather.openweather_air_pollution
ParameterTypeRequiredDescription
No parameters.
air_pollution_forecast Read

Get forecasted air pollution data.

Lua path
app.integrations.openweather.air_pollution_forecast
Full name
openweather.openweather_air_pollution_forecast
ParameterTypeRequiredDescription
No parameters.
air_pollution_history Read

Get historical air pollution data.

Lua path
app.integrations.openweather.air_pollution_history
Full name
openweather.openweather_air_pollution_history
ParameterTypeRequiredDescription
No parameters.
direct_geocoding Read

Convert a location name into coordinates.

Lua path
app.integrations.openweather.direct_geocoding
Full name
openweather.openweather_geocoding_direct
ParameterTypeRequiredDescription
No parameters.
reverse_geocoding Read

Convert coordinates into location names.

Lua path
app.integrations.openweather.reverse_geocoding
Full name
openweather.openweather_geocoding_reverse
ParameterTypeRequiredDescription
No parameters.
zip_geocoding Read

Convert a zip or post code into coordinates.

Lua path
app.integrations.openweather.zip_geocoding
Full name
openweather.openweather_geocoding_zip
ParameterTypeRequiredDescription
No parameters.