Build a Supabase RLS policy
build_rls_policyWrite Supabase row level security SQL for one table: owner-only, public read with owner writes, team/workspace members, or server-only. Returns the migration, a check query, test scripts and a fix prompt. Every pattern is tested on Postgres; review before running.
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": {
"table": "<table>",
"pattern": "<pattern>"
},
"name": "build_rls_policy"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | Table name in the public schema: lower-case letters, digits and _, starting with a letter, at most 40 characters. | |
| writes | No | Which writes users may do from the browser. Reading is part of the pattern. | |
| pattern | Yes | owner: each user sees only their rows. public-read: everyone reads, owners write. team: members of the row's team. server-only: no browser access. | |
| team_column | No | Column with the team id, on the table and on the membership table (team): lower-case letters, digits and _, starting with a letter, at most 40 characters. | team_id |
| owner_column | No | Column with the owner's auth.users id (owner and public-read): lower-case letters, digits and _, starting with a letter, at most 40 characters. | user_id |
| members_table | No | Membership table with user_id and the team column (team): lower-case letters, digits and _, starting with a letter, at most 40 characters. | team_members |
| owner_default | No | Fill the owner column with auth.uid() when an insert leaves it out. |