Test RLS for role
test_rls_for_roleVerify what a PostgreSQL role can read from a table under row-level security: check RLS and policies, count visible rows, and inspect sample rows in a read-only transaction.
Instructions
Test what an RLS-bound role can read from a table. Reports whether RLS is enabled on the table, lists the policies that apply to the given role, counts the rows the role can read, and returns up to sample_size rows so the agent can inspect them. Runs as the target role inside a READ ONLY transaction — no writes can leak. Pure read.
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": {
"schema": "<schema>",
"table": "<table>",
"role": "<role>"
},
"name": "test_rls_for_role"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role | Yes | ||
| table | Yes | ||
| schema | Yes | ||
| database | No | Optional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected. | |
| sample_size | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role | Yes | ||
| table | Yes | ||
| sample | Yes | ||
| schema | Yes | ||
| columns | Yes | ||
| rls_enabled | Yes | ||
| rows_visible | Yes | ||
| active_policies | Yes |