Skip to main content
Glama
YawLabs

@yawlabs/postgres-mcp

by YawLabs

pg_table_privileges

Read-onlyIdempotent

Show which roles have SELECT, INSERT, UPDATE, DELETE, etc. privileges on a table or all tables in a schema. Use it to audit who can write or modify tables before a migration.

Instructions

Show which roles have which privileges (SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER) on a table or on every table in a schema. If table is omitted, the result spans every table in schema, ordered by table then grantee. Use this to answer 'who can write to this table?' or to audit schema-wide access before a migration. Visibility caveat: backed by information_schema.table_privileges, which postgres filters by what the calling role can see. A least-privileged role may not see grants involving unrelated third-party roles. For a complete picture, run as a superuser or a member of pg_read_all_data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tableNoTable name. Omit to list privileges for all tables in the schema.
schemaNoSchema name (defaults to 'public').public
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds significant behavioral context beyond the annotations: it specifies the data source (information_schema.table_privileges), ordering (by table then grantee), and a critical visibility caveat (filtering based on calling role, suggesting superuser for complete view). Annotations declare readOnlyHint and openWorldHint, which match the non-destructive nature. No contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three sentences long, each serving a distinct purpose: stating capabilities, providing usage guidance, and explaining a caveat. It is front-loaded with the essential purpose and avoids any redundant or filler content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 optional params, no output schema, well-covered by annotations and schema), the description covers all needed aspects: purpose, usage guidance, behavioral nuance, and parameter semantics. A user can confidently invoke this tool after reading it.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema descriptions already cover both parameters (table: 'Table name. Omit to list privileges for all tables in the schema.'; schema: 'Schema name (defaults to public)'). The description reinforces the schema behavior and adds the ordering and privilege list, but since schema coverage is 100%, the baseline is 3. The added context about ordering and privileges justifies a slight upgrade.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the verb 'Show' and the resource 'table privileges', listing specific privilege types and explaining the behavior of omitting table parameter. It clearly differentiates from sibling tools like pg_list_tables or pg_describe_table by focusing on privilege mapping for roles.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides concrete use cases: 'who can write to this table?' and 'audit schema-wide access before a migration'. While it does not explicitly name alternative tools to avoid, the context signals and sibling list make the appropriate usage clear. A small deduction for not comparing to other tools like pg_list_roles.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/YawLabs/postgres-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server