Create a database table
create_tableMakes a new table in the site's connected Supabase project, the same way as Add table in Xodia's Database view (Content, Database): the fields you list plus id and created_at, row rules always on with one of eight rules (see rule) for who can see and change entries, and a migration file in supabase/migrations/ on the branch so the change shows in Site code and git. Changes the user's live database at once, outside Xodia's Versions: say what you are adding before you call it. Pick the rule from what the owner asked; when it is unclear, ask, and use "owner_only" until they say. For what visitors read and only the owner fills (a menu, a price list, opening hours, a team list), use "everyone_reads_owner_writes": no form on the site can add to it, and the owner adds and changes its entries in Xodia's Database view (Content, Database) (no tool adds entries). For entries the owner keeps for one signed-in person each (a client's project and its milestones), use "own_rows_read_owner_writes" with fullAccessRole "owner": each person sees only the entries whose created_by is them and nobody changes them from the site. Refused when a table or field name is taken (pick another), for kinds Xodia doesn't add, and when the site has no database connected. With source "xodia" (or when get_project database.source is "xodia") it works on the site's own Xodia database, whose tables and rules are the file xodia/data-rules.json in the repo: it adds the table to that file with the indexes the site's data blocks already list along (checked; problems come back as invalid_input, each at its path with the place in your table), saves it on the branch and sends it to the test data the preview uses; the live site gets it when the owner goes live. Pass indexes for lists you are about to write. Needs the site's Xodia database turned on (data_not_on otherwise: the owner turns it on in Xodia's Database view (Content, Database)) and a workspace owner or admin. No tool deletes or renames a table or field, deletes entries, or runs SQL: the owner does that in Xodia's Database view (Content, Database).
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": {
"name": "<name>",
"rule": "<rule>",
"projectId": "<projectId>"
},
"name": "create_table"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | The table's name: letters, numbers, spaces and underscores, starting with a letter (it is stored lower case with underscores: "Guest count" becomes guest_count) | |
| rule | Yes | Who can see and change entries: "everyone_reads_signed_in_adds" (Everyone sees, signed-in people add: Anyone can see entries. People who are signed in can add new ones and change their own.); "everyone_reads_owner_writes" (Everyone sees, only you change: Anyone can see entries. Nobody can add or change them from the site. You add and change them in Xodia.); "own_rows_only" (Each person sees only their own: Signed-in people see and change only the entries they added.); "own_rows_read_owner_writes" (Each person sees their own, only the owner changes: Signed-in people see only the entries kept for them. Nobody adds or changes them from the site. You add and change them in Xodia.); "signed_in_reads_own_writes" (Signed-in people see everyone's, each changes only their own: People who are signed in see every entry. Each of them adds and changes only their own.); "signed_in_only" (Signed-in people only: Only people who are signed in can see, add and change entries.); "owner_only" (Only you: Visitors can't see or change entries. You manage them in Xodia.); "visitors_add_owner_reads" (Visitors can add, only the owner sees all: Anyone can add an entry, signed in or not, like an order or a booking. Signed-in people see only their own. Nobody changes them from the site. You see and manage all of them in Xodia.) | |
| branch | No | Optional branch for the migration file; default the branch the workspace has open | |
| fields | No | The table's own fields. Every table also gets id and created_at (and created_by for the rules that track who added an entry): don't list those | |
| source | No | Which database: "xodia" (the site's own Xodia database, kept by Xodia) or "supabase" (the Supabase project the owner connected). Leave out to use the one get_project database.source names | |
| indexes | No | Xodia database only: the indexes the site's lists need, each a list of 1 to 3 field names in order: the equal-to filters first, then the sort or compared field (filter="status:eq:open" sort="starts_at" needs ["status", "starts_at"]). Lists and counts only filter and sort along an index; created_at, and created_by with created_at for own-entry rules, are always there | |
| projectId | Yes | Project id from list_projects | |
| fullAccessRole | No | Optional, beside any rule: people with a role can see and change everything (a role name such as "owner" or "staff", read from the person's app metadata like the data kit's HasRole). Only when the user asks for it |