Tools
Connector tool reference
Every tool the connector offers, grouped by the part of Rezin Core it belongs to. A connection is shown only the tools in the parts its owner switched on. This page is written from the connector's own list, so it matches what the server does.
- Needs says what the connection must have been given beyond the part itself.
- Returns project data marks tools whose answer holds what your project's users stored. That answer is always wrapped in a notice telling the assistant to treat it as data, not instructions. See safety.
- On a project marked as production, tools that change things do not run: a statement, a migration or function code waits for an owner, and the rest are refused.
Always there
whoami
What this connection or token may do: the parts it was given, whether it may change things, whether it may deploy functions, whether it reaches production projects, and when it expires.
- Needs: look only.
No arguments.
list_projects
Lists the Rezin Core projects this connection can reach: each project's ID, its database schema, the role its application runs as, which environment of which application it is (development, preview, production ...) and whether it is marked as production.
- Needs: look only.
No arguments.
list_pending_changes
On a production project: the changes waiting for a person to approve, and how recent ones ended (approved, refused, failed).
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
Your account and companies
list_companies
The companies the account belongs to, its role in each, and how many projects each has.
- Needs: look only.
No arguments.
Database
list_tables
Lists a project's tables with their columns, whether row-level security is on, and how many rules each has.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
get_table
One table in full: columns with types and defaults, keys, links to other tables, indexes, an estimate of its size, and its access rules.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
table | string | yes |
list_access_rules
For every table: whether row-level security is on, what the application's role may do, and each rule with its condition.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
explain_access
Explains why a request to one of a project's tables would be allowed or refused by its access rules: whether row-level security is on, what the application may do, and each rule that applies, checked for one row and one caller down to the part that decided it. Changes nothing. "as" is { "kind": "user", "userId": ... }, { "kind": "organization", "organizationId": ... } (a server with the secret key, nobody signed in) or { "kind": "visitor" }. "row" names an existing row by its key columns; "values" is the new row for insert, or the values being set for update.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
table | string | yes | |
action | select, insert, update, delete | yes | |
as | object | yes | |
row | object | no | |
values | object | no |
get_advisors
The advisor's findings for a project: tables with row-level security off, rules that let every row through, rules written for every database role, and tables closed to the application.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
run_sql
Runs SQL inside one project, as that project's own confined database role. Read-only unless "write" is true, which needs a read-write connection. At most 200 rows come back, and values that look private (emails, phone numbers, keys, password hashes) are hidden unless the connection's owner allowed them. On a production project a write is not run: it waits for a person to approve it. A table created this way starts closed to the application until a row-level security rule is added.
- Needs: look only (look and change when
writeis true). - Returns project data: yes, marked as untrusted.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
sql | string | yes | |
write | boolean | no | Allow the statement to change data or structure. Default false. |
list_migrations
Lists the migrations already applied to a project, by name.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
apply_migration
Applies one migration (SQL) to a project in a single transaction and records its name so it is never applied twice. Needs a read-write connection. On a production project it is not applied: it waits for a person to approve it.
- Needs: look and change.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
name | string | yes | For example 0003_add_orders.sql |
sql | string | yes |
generate_types
TypeScript types for a project's tables, for use with the Rezin Core client library: a Row, an Insert and an Update shape per table.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
list_exports
Lists the exports made of a project (a complete copy in ordinary formats: a PostgreSQL dump, CSV, JSON and the files) and whether each is ready. Needs a connection given both the database and the files, held by an owner.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
request_export
Starts a complete export of a project. It is built in the background; list_exports shows when it is ready, and the file is downloaded in the console or with "rezin export". Needs a read-write connection given both the database and the files, held by an owner. An optional passphrase (12 characters or more) encrypts the archive and is not kept.
- Needs: look and change.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
passphrase | string | no |
Functions
list_functions
Lists a project's functions (its own server-side code that Rezin Core runs): name, whether each is on, its version, timetable, and how its last day of runs went.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
get_function
Returns one function's current code and settings.
- Needs: look only.
- Returns project data: yes, marked as untrusted.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
name | string | yes |
deploy_function
Stores new code for a function as its next version and makes it live (creating the function if new). Needs a read-write connection that was also given the deploy permission. On a production project it is not deployed: it waits for a person to approve it. The code is one JavaScript module that does "export default async (request, context) => new Response(...)"; it runs confined, with fetch as its only way out, context.secrets holding the secrets assigned to it and context.apiUrl the address of the project's API.
- Needs: look and change, and "May deploy functions".
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
name | string | yes | Lowercase letters, digits and dashes, like send-welcome |
code | string | yes |
update_function
Changes a function's settings: enabled, requireUser (only signed-in accounts may call it), timeoutSeconds (1 to 60), everyMinutes (a timetable; null for none), secrets (names of the project's secrets it is given), version (roll back to a stored version). Needs a read-write connection with the deploy permission.
- Needs: look and change, and "May deploy functions".
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
name | string | yes | |
enabled | boolean | no | |
requireUser | boolean | no | |
timeoutSeconds | integer | no | |
everyMinutes | integer or null | no | |
secrets | array | no | |
version | integer | no |
delete_function
Removes a function and all its versions and logs. Needs a read-write connection with the deploy permission.
- Needs: look and change, and "May deploy functions".
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
name | string | yes |
get_function_logs
How a function's recent runs ended and what it printed.
- Needs: look only.
- Returns project data: yes, marked as untrusted.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
name | string | yes |
invoke_function
Runs a function once as a test, with the given JSON text as the request body, and returns its answer. Needs a read-write connection.
- Needs: look and change.
- Returns project data: yes, marked as untrusted.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
name | string | yes | |
body | string | no | |
method | GET, POST, PUT, PATCH, DELETE | no |
Files
list_files
Lists the files in one of a project's storage buckets (names and sizes, not contents).
- Needs: look only.
- Returns project data: yes, marked as untrusted.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
bucket | string | yes | |
prefix | string | no | |
organization | string | no | Organization ID; the project's first if left out. |
create_signed_link
Makes a link to one stored file that works without a key for a short time (30 seconds to one hour; five minutes if not said). Anyone holding the link can read the file until it ends, so give it only to the person you are working for.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
bucket | string | yes | |
path | string | yes | |
seconds | integer | no | |
organization | string | no |
Secrets (names, and setting values)
list_secret_names
Lists the names of a project's secrets. Values are never returned.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
set_secret
Stores or replaces one of a project's secrets. Needs a read-write connection. The value cannot be read back through this connector.
- Needs: look and change.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
name | string | yes | Capitals, digits and underscores, like PAYMENT_KEY |
value | string | yes | |
description | string | no |
Record of activity
get_logs
The newest entries of a project's audit trail: what happened, when and to what kind of thing. No statements or values.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
limit | integer | no |
get_recent_errors
What went wrong lately in a project: refused and failed entries on the record, function runs that did not end well, and requests the access rules refused (each with the ID to explain it).
- Needs: look only.
- Returns project data: yes, marked as untrusted.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
limit | integer | no |
get_usage
How much a project holds and how busy it has been over 30 days: database and file sizes, accounts, API requests, function runs. Numbers only.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
project | string | yes | The project's ID: twenty lowercase letters, as list_projects gives it. |
Documentation
search_docs
Searches the Rezin Core documentation and returns the best matching sections with their addresses. Use it before writing code against Rezin Core.
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
query | string | yes | A few words, for example "row-level security rule owner" |
read_doc
Returns one documentation page as Markdown, by its path as search_docs gives it (for example database/row-level-security).
- Needs: look only.
| Argument | Type | Required | |
|---|---|---|---|
path | string | yes |