Skip to main content
Glama
postgres-mcp-server

postgres-mcp-server

set_role

Switch the active PostgreSQL role or user for the current session, or reset to the default, so queries run with the intended permissions.

Instructions

Set active PostgreSQL role/user for the session (SET ROLE) or reset to default (RESET ROLE)

Input Schema

NameRequiredDescriptionDefault
roleYesRole or username to set (e.g. 'analyst', 'app_user', or 'NONE' / 'RESET' to restore default)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.4

TDQS

A4/5.0
Behavior3/5

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

The readOnlyHint=false annotation already signals a state-changing operation, and the description usefully adds that the change is session-scoped and reversible via RESET ROLE. It omits the operationally important consequences: that the new role governs subsequent run_query/run_write_query calls in the same session, and that membership in the role is required. Those gaps keep it at a 3 for a state-mutating tool.

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?

One sentence, front-loaded with the primary action and immediately covering the inverse operation. Nothing is wasted and nothing material is buried.

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

Completeness4/5

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

With a single fully documented parameter, no nested objects, and no output schema expected for a session-setting command, the definition is nearly self-sufficient. The main omission is the downstream effect on later query calls and the membership prerequisite, which would help an agent sequence its calls correctly.

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% and the schema's own property description already documents 'NONE'/'RESET' for restoring the default, so the description's mention of RESET ROLE largely restates structured information. It adds no format, case-sensitivity, or validation guidance beyond the schema, making the baseline 3 correct.

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 pairs a specific verb and resource ('Set active PostgreSQL role/user') with an explicit scope ('for the session') and names the underlying SQL semantics (SET ROLE / RESET ROLE). That is enough to distinguish it from the sibling list_roles, which enumerates roles rather than activating one.

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?

It makes the two usage modes explicit — setting a role versus restoring the default — so an agent knows both branches without consulting the schema. It stops short of stating prerequisites (e.g., the caller must already be a member of the target role) or when this tool should be preferred over simply qualifying objects in run_query.

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