productivity
Magento Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Magento KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.magento.*.
Use lua_read_doc("integrations.magento") 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
Magento workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.magento.list_products({search_criteria = "example_search_criteria", page_size = 1, current_page = 1}))' --json kosmo integrations:lua --eval 'print(docs.read("magento"))' --json
kosmo integrations:lua --eval 'print(docs.read("magento.list_products"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local magento = app.integrations.magento
local result = magento.list_products({search_criteria = "example_search_criteria", page_size = 1, current_page = 1})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.magento, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.magento.default.* or app.integrations.magento.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Magento, use the narrower 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.
Magento Integration
Magento is an open-source e-commerce platform that enables online merchants to manage products, orders, customers, and more.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
access_token | secret | Yes | Your Magento API access token. Generate one in Magento Admin under System → Integrations or via OAuth. |
url | url | No | API base URL. Default: https://api.magento.com/v1. |
Authentication
All requests use Bearer token authentication via the Authorization: Bearer <token> header. The access token must have the appropriate permissions for the endpoints you intend to use.
Tools
magento_list_products
List products from the Magento catalog.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
search_criteria | string | No | Search criteria filter expression (e.g., "name:like:%shirt%"). |
page_size | integer | No | Number of products per page (default: 20). |
current_page | integer | No | Current page number for pagination (starts at 1). |
Example:
magento_list_products({ page_size = 50, current_page = 1 })
magento_get_product
Get details of a specific product by its SKU.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
sku | string | Yes | The product SKU (Stock Keeping Unit) to retrieve. |
Example:
magento_get_product({ sku = "WSH01-XS-Red" })
magento_create_product
Create a new product in the Magento catalog.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
sku | string | Yes | Unique product SKU. |
name | string | Yes | Product name. |
price | number | Yes | Product price (e.g., 29.99). |
attribute_set_id | integer | No | Attribute set ID (default: 4 for Default). |
type_id | string | No | Product type (simple, configurable, virtual, etc.). Default: "simple". |
weight | number | No | Product weight. |
description | string | No | Full product description. |
short_description | string | No | Short product description. |
visibility | integer | No | Visibility (1=Not Visible, 2=Catalog, 3=Search, 4=Catalog & Search). Default: 4. |
status | integer | No | Product status (1=Enabled, 2=Disabled). Default: 1. |
Example:
magento_create_product({
sku = "TSHIRT-001",
name = "Cotton T-Shirt",
price = 29.99,
type_id = "simple",
description = "A comfortable cotton t-shirt."
})
magento_list_orders
List orders from the Magento store.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
search_criteria | string | No | Search criteria filter expression (e.g., "status:pending"). |
page_size | integer | No | Number of orders per page (default: 20). |
current_page | integer | No | Current page number for pagination (starts at 1). |
Example:
magento_list_orders({ page_size = 50, current_page = 1 })
magento_get_order
Get details of a specific order by its ID.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
order_id | string | Yes | The order increment ID or entity ID. |
Example:
magento_get_order({ order_id = "000000001" })
magento_list_customers
List customers from the Magento store.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
search_criteria | string | No | Search criteria filter expression. |
page_size | integer | No | Number of customers per page (default: 20). |
current_page | integer | No | Current page number for pagination (starts at 1). |
Example:
magento_list_customers({ page_size = 50, current_page = 1 })
magento_get_current_user
Verify Magento API connectivity and get current user information. Useful as a health check.
Parameters: None.
Example:
magento_get_current_user()
Notes
- The
skuis Magento’s unique product identifier. - Search criteria follow Magento’s REST API filter syntax.
- Product prices are in the store’s base currency.
- Always use the correct base URL for your Magento instance.
Raw agent markdown
# Magento Integration
Magento is an open-source e-commerce platform that enables online merchants to manage products, orders, customers, and more.
## Configuration
| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `access_token` | secret | Yes | Your Magento API access token. Generate one in Magento Admin under **System → Integrations** or via OAuth. |
| `url` | url | No | API base URL. Default: `https://api.magento.com/v1`. |
## Authentication
All requests use Bearer token authentication via the `Authorization: Bearer <token>` header. The access token must have the appropriate permissions for the endpoints you intend to use.
## Tools
### magento_list_products
List products from the Magento catalog.
**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `search_criteria` | string | No | Search criteria filter expression (e.g., `"name:like:%shirt%"`). |
| `page_size` | integer | No | Number of products per page (default: 20). |
| `current_page` | integer | No | Current page number for pagination (starts at 1). |
**Example:**
```lua
magento_list_products({ page_size = 50, current_page = 1 })
```
---
### magento_get_product
Get details of a specific product by its SKU.
**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `sku` | string | Yes | The product SKU (Stock Keeping Unit) to retrieve. |
**Example:**
```lua
magento_get_product({ sku = "WSH01-XS-Red" })
```
---
### magento_create_product
Create a new product in the Magento catalog.
**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `sku` | string | Yes | Unique product SKU. |
| `name` | string | Yes | Product name. |
| `price` | number | Yes | Product price (e.g., `29.99`). |
| `attribute_set_id` | integer | No | Attribute set ID (default: 4 for Default). |
| `type_id` | string | No | Product type (`simple`, `configurable`, `virtual`, etc.). Default: `"simple"`. |
| `weight` | number | No | Product weight. |
| `description` | string | No | Full product description. |
| `short_description` | string | No | Short product description. |
| `visibility` | integer | No | Visibility (1=Not Visible, 2=Catalog, 3=Search, 4=Catalog & Search). Default: 4. |
| `status` | integer | No | Product status (1=Enabled, 2=Disabled). Default: 1. |
**Example:**
```lua
magento_create_product({
sku = "TSHIRT-001",
name = "Cotton T-Shirt",
price = 29.99,
type_id = "simple",
description = "A comfortable cotton t-shirt."
})
```
---
### magento_list_orders
List orders from the Magento store.
**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `search_criteria` | string | No | Search criteria filter expression (e.g., `"status:pending"`). |
| `page_size` | integer | No | Number of orders per page (default: 20). |
| `current_page` | integer | No | Current page number for pagination (starts at 1). |
**Example:**
```lua
magento_list_orders({ page_size = 50, current_page = 1 })
```
---
### magento_get_order
Get details of a specific order by its ID.
**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `order_id` | string | Yes | The order increment ID or entity ID. |
**Example:**
```lua
magento_get_order({ order_id = "000000001" })
```
---
### magento_list_customers
List customers from the Magento store.
**Parameters:**
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `search_criteria` | string | No | Search criteria filter expression. |
| `page_size` | integer | No | Number of customers per page (default: 20). |
| `current_page` | integer | No | Current page number for pagination (starts at 1). |
**Example:**
```lua
magento_list_customers({ page_size = 50, current_page = 1 })
```
---
### magento_get_current_user
Verify Magento API connectivity and get current user information. Useful as a health check.
**Parameters:** None.
**Example:**
```lua
magento_get_current_user()
```
---
## Notes
- The `sku` is Magento's unique product identifier.
- Search criteria follow Magento's REST API filter syntax.
- Product prices are in the store's base currency.
- Always use the correct base URL for your Magento instance. local result = app.integrations.magento.list_products({search_criteria = "example_search_criteria", page_size = 1, current_page = 1})
print(result) Functions
list_products Read
List products from the Magento catalog. Returns a list of products with support for search criteria filtering and pagination.
- Lua path
app.integrations.magento.list_products- Full name
magento.magento_list_products
| Parameter | Type | Required | Description |
|---|---|---|---|
search_criteria | string | no | Search criteria filter expression (e.g., "name:like:%shirt%"). |
page_size | integer | no | Number of products per page (default: 20). |
current_page | integer | no | Current page number for pagination (starts at 1). |
get_product Read
Get details of a specific Magento product by its SKU. Returns the full product object including attributes, pricing, and stock information.
- Lua path
app.integrations.magento.get_product- Full name
magento.magento_get_product
| Parameter | Type | Required | Description |
|---|---|---|---|
sku | string | yes | The product SKU (Stock Keeping Unit) to retrieve. |
create_product Write
Create a new product in the Magento catalog. Requires SKU, name, price, and attribute set ID. Returns the created product object.
- Lua path
app.integrations.magento.create_product- Full name
magento.magento_create_product
| Parameter | Type | Required | Description |
|---|---|---|---|
sku | string | yes | Unique product SKU. |
name | string | yes | Product name. |
price | number | yes | Product price (e.g., 29.99). |
attribute_set_id | integer | no | Attribute set ID (default: 4 for Default). |
type_id | string | no | Product type (simple, configurable, virtual, etc.). Default: "simple". |
weight | number | no | Product weight. |
description | string | no | Full product description. |
short_description | string | no | Short product description. |
visibility | integer | no | Visibility (1=Not Visible, 2=Catalog, 3=Search, 4=Catalog & Search). Default: 4. |
status | integer | no | Product status (1=Enabled, 2=Disabled). Default: 1. |
list_orders Read
List orders from the Magento store. Returns a list of orders with support for search criteria filtering and pagination.
- Lua path
app.integrations.magento.list_orders- Full name
magento.magento_list_orders
| Parameter | Type | Required | Description |
|---|---|---|---|
search_criteria | string | no | Search criteria filter expression (e.g., "status:pending"). |
page_size | integer | no | Number of orders per page (default: 20). |
current_page | integer | no | Current page number for pagination (starts at 1). |
get_order Read
Get details of a specific Magento order by its ID. Returns the full order object including items, addresses, payment, and totals.
- Lua path
app.integrations.magento.get_order- Full name
magento.magento_get_order
| Parameter | Type | Required | Description |
|---|---|---|---|
order_id | string | yes | The order increment ID or entity ID. |
list_customers Read
List customers from the Magento store. Returns a list of customers with support for search criteria filtering and pagination.
- Lua path
app.integrations.magento.list_customers- Full name
magento.magento_list_customers
| Parameter | Type | Required | Description |
|---|---|---|---|
search_criteria | string | no | Search criteria filter expression. |
page_size | integer | no | Number of customers per page (default: 20). |
current_page | integer | no | Current page number for pagination (starts at 1). |
get_current_user Read
Verify Magento API connectivity and retrieve current user information. Useful as a health check to confirm the integration is properly configured.
- Lua path
app.integrations.magento.get_current_user- Full name
magento.magento_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||