Skip to main content
Glama
foxter-io

PostgreSQL MCP Server

by foxter-io

List PostgreSQL Roles and Users

pg_list_roles
Read-onlyIdempotent

List all PostgreSQL roles with attributes, superuser status, replication, login capability, and membership graph to audit access and review permissions.

Instructions

List all PostgreSQL roles with their attributes, privileges, and group memberships.

Returns both login roles (users) and group roles. Shows superuser status, replication, login capability, connection limits, password expiry, and role membership graph.

Args:

  • login_only: Only show roles that can log in (actual users, not groups) (default: false)

  • response_format: Output format

Returns: JSON: { roles: RoleInfo[], count: number } Markdown: table with all role attributes + membership info

Useful for access audits, permission reviews, and understanding role hierarchy.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
login_onlyNoOnly show login roles (users), not group roles
response_formatNoOutput format: 'markdown' for human-readable, 'json' for machine-readablemarkdown
Behavior4/5

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

Annotations already declare readOnlyHint, destructiveHint, and idempotentHint. The description adds specific behavioral details: it returns both login and group roles, shows attributes like superuser status, replication, and output formats (JSON/Markdown). No contradiction; adds context beyond annotations.

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 concise with front-loaded purpose, a clear list of args, and no redundant information. Every sentence adds value, and the structure is easy to parse.

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 simplicity (2 optional params, no output schema), the description covers the purpose, behavior, output structure, and use cases completely. No gaps remain for an agent to effectively use the tool.

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

Parameters3/5

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

Schema coverage is 100%, so baseline is 3. The description restates parameters with minor clarifications (e.g., 'actual users, not groups' for login_only) and describes return formats, but adds limited new meaning beyond the schema descriptions.

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 clearly states it lists all PostgreSQL roles with attributes and group memberships, distinguishing it from sibling like pg_list_grants or pg_list_tables. It specifies the exact resource (roles) and action (list), and contrasts with other list tools.

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 mentions 'Useful for access audits, permission reviews, and understanding role hierarchy,' providing clear context for when to use the tool. It doesn't explicitly state when not to use it, but the sibling list makes alternatives obvious, scoring 4.

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/foxter-io/mcp-postgresql'

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