Answer whether one role holds privileges on one table, view, sequence, function or procedure -- as PostgreSQL evaluates it, via has_table_privilege and its relatives, so role inheritance, grants to PUBLIC, ownership and superuser are all folded in the way the server folds them…
read-onlyany connectionsweeps instancesweeps group
checkRoleAccess(grantee, object, schema)
Answer whether one role holds privileges on one table, view, sequence, function or procedure -- as PostgreSQL evaluates it, via has_table_privilege and its relatives, so role inheritance, grants to PUBLIC, ownership and superuser are all folded in the way the server folds them rather than reconstructed from ACLs. Needs no grant of its own: these functions and the catalog are world-readable, so any role that can connect may ask about any other.
Returns schema USAGE and database CONNECT beside the object privileges, because a grant on the table is inert without them and the resulting error names the table. Where a table-level privilege is absent but individual columns carry it, the columns are listed. IMPORTANT: has_table_privilege does not consider row-level security, so a true here can still return no rows -- row_level_security carries whether RLS is on, whether this role is subject to it (the owner is exempt unless FORCE ROW LEVEL SECURITY), and every policy with whether it applies to this role.
RLS enabled with no applicable permissive policy denies everything. Not to be confused with checkPrivileges, which reports which of THIS SERVER's operations the CONNECTING role can run.
Also accepts connection, instance, group, described once under arguments every tool takes.
Whether one role holds privileges on one object, as PostgreSQL itself evaluates it. An absent extension or a missing grant is reported as {error, hint} instead.
| Field | Type |
|---|---|
| columns | object | null |
| database_access | object | null |
| note | string | null |
| object | object | null |
| overloads | array | null |
| privileges | object | null |
| role | object | null |
| row_level_security | object | null |
| schema_access | object | null |
A physical replica is byte-identical here, so asking each member of a replication group adds nothing.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "checkRoleAccess",
"arguments": {
"grantee": "reporting",
"schema": "shop",
"object": "orders"
}
}
}
{
"role": {
"name": "reporting",
"exists": true,
"can_login": true,
"superuser": false,
"inherits": true,
"bypass_rls": false,
"member_of": []
},
"object": {
"schema": "shop",
"name": "orders",
"kind": "table",
"owner": "migrator",
"is_owner": false
},
"database_access": {
"connect": true
},
"schema_access": {
"usage": true,
"create": false
},
"privileges": {
"SELECT": true,
"INSERT": false,
"UPDATE": false,
"DELETE": false
},
"columns": {},
"row_level_security": {
"enabled": false,
"forced": false,
"applies_to_role": false,
"policies": []
},
"overloads": null,
"note": "SELECT is granted directly, and row-level security is not enabled, so every row is readable."
}
Invented values on a fictional shop database, shaped by and checked against this tool's output schema. Real output is returned as structuredContent to clients that negotiate MCP 2025-06-18 or later.