Test Supabase RLS policies
execute_sql_as_roleVerify RLS policies by executing SQL as a Postgres role with JWT claims, all inside a rollback transaction that guarantees no data mutation.
Instructions
Executes a SQL query as a specific Postgres role with JWT claims set, so you can verify RLS policies. Runs inside a ROLLBACK transaction — never mutates data.
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": {
"connection_string": "<connection_string>",
"sql": "<sql>"
},
"name": "execute_sql_as_role"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | The SQL query to execute | |
| role | No | Postgres role to SET ROLE to, e.g. 'authenticated', 'anon', 'service_role' | authenticated |
| claims | No | Additional JWT claims to set, e.g. { "role": "parent" }. Merged into request.jwt.claims. | |
| user_id | No | UUID to set as request.jwt.claims sub (auth.uid()). Required for RLS policies that check auth.uid(). | |
| timeout_seconds | No | ||
| connection_string | Yes | Postgres connection string, e.g. postgresql://postgres:password@localhost:54322/postgres |