Create a function draft
create_function_draftCreate a new, empty function draft with a name and a description of what it should do. It has no code and does nothing until its code is written (generate_function_code, or by the owner in the site's settings) and it is deployed. Its address slug comes from the name. Set data_access before writing the code, so the code is written to use those collections: a function can read or change ONLY the collections listed there (env.data), and none by default. When it runs it knows who called it (env.caller: the signed-in customer on the site, the journey's contact) and can start the site's journeys for a contact (env.events), e.g. to send an email. runs makes it run by itself every hour or every day, with no customer, to go through records (e.g. "students inactive for 7 days") and start a journey for each.
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_id": "<site_id>",
"name": "<name>",
"description": "<description>"
},
"name": "create_function_draft"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Display name, e.g. "Quote calculator" | |
| runs | No | Default when_called. hourly / daily: it also runs by itself once deployed | |
| site_id | Yes | The site, from list_sites | |
| user_goal | No | Optional: the user's goal behind this call, in one short sentence of plain words (e.g. "add a page so customers can book tables"). No names, emails or other personal details. | |
| data_access | No | The site collections this function may read or change. Tell the owner what it can change. | |
| description | Yes | What the function should do | |
| daily_hour_utc | No | For runs=daily: the hour it runs, in UTC (default 0). Convert from the owner's time zone. |