Define collection
define_collectionCreate or update a collection in the site database (e.g. contact form messages, products, bookings). See site_guide for using it from pages.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"site": "<site>",
"name": "<name>",
"fields": "<fields>"
},
"name": "define_collection"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| site | Yes | Site slug (e.g. "kopitiam-muar") or id | |
| rules | No | insert: public | visitor (signed in) | owner. read: public | visitor (any signed-in visitor) | own (each visitor sees only their own) | owner | |
| fields | Yes | ||
| notify | No | Email the owner on each new public submission | |
| confirm | No | Send the visitor a confirmation email. field = the email field; {field_name} placeholders are filled in, e.g. "Hi {name}, we got your booking for {date}." | |
| payment | No | Take payment for each record (orders, deposits, tickets). Use k.pay() in the page. See site_guide "Taking payment". | |
| whatsapp_alert | No | Also send the owner a WhatsApp alert for each new record (needs a linked Komers store) |