sb_function
Create, update, remove, test, and inspect server-side TypeScript/JavaScript functions with secrets, collections, fetch, logs, and usage for site backend logic.
Instructions
Backend functions: server-side TS/JS at /wb/fn/ with the site's secrets, collections and fetch ("" slug = importable module). Not sb_code. action: list | get | set (no id creates; id merges) | remove (id, or secret key) | test (method/path/query/headers/cookies/body) | logs | usage | secret (no key lists; key+value sets). Owner/admin only.
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": {
"action": "<action>"
},
"name": "sb_function"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | logs: filters to it | |
| key | No | ||
| body | No | ||
| path | No | ||
| slug | No | ||
| limit | No | ||
| query | No | ||
| value | No | ||
| action | Yes | ||
| method | No | ||
| content | No | ||
| cookies | No | ||
| dry_run | No | ||
| enabled | No | ||
| headers | No | ||
| site_id | No | ||
| language | No |