Skip to main content
Glama
call518

MCP PostgreSQL Operations

by call518

get_active_connections

Retrieve all active PostgreSQL connections and session details, including user, database, client address, status, and current query, to diagnose server load or connection problems.

Instructions

[Tool Purpose]: Retrieve all active connections and session information on current PostgreSQL server

[Exact Functionality]:

  • Retrieve list of all currently active connected sessions

  • Display user, database, and client address for each connection

  • Include session status and currently executing query information

[Required Use Cases]:

  • When user requests "active connections", "current sessions", "connection status", etc.

  • When server load or performance problem diagnosis is needed

  • When checking connection status of specific users or applications

[Strictly Prohibited Use Cases]:

  • Requests for forceful connection termination or session management

  • Requests for detailed query history of specific sessions

  • Requests for connection security or authentication-related changes

Returns: Information including PID, username, database name, client address, status, and current query

Input Schema

NameRequiredDescriptionDefault

No arguments

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv3.4.2
    • addedInput schema / additionalProperties
      Added value: +false
    • removedOutput schema / properties / result / title
      Removed value: -"Result"
    • removedOutput schema / title
      Removed value: -"_WrappedResult"
  2. Addedv1.0.0

TDQS

A4.1/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full behavioral burden. It clearly implies a read-only retrieval and enumerates the returned fields (PID, username, database, client address, status, current query), but it does not disclose permission requirements, visibility limits for non-superusers querying pg_stat_activity, or whether results are paginated or truncated on busy servers.

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

Conciseness4/5

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

The content is organized into labeled sections with the purpose front-loaded, making it easy to scan. It is slightly longer than necessary: the 'Returns' line largely repeats the display fields already listed under 'Exact Functionality,' which is minor redundancy rather than a structural flaw.

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?

An output schema exists, so the description does not need to explain return values, yet it helpfully names the key fields anyway. For a zero-parameter read-only monitoring tool, the description is nearly complete; the notable gap is the absence of permission or visibility caveats when reading active sessions.

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?

The tool takes zero parameters and the schema has no properties, so there is nothing for the description to disambiguate. Baseline for a parameterless tool is 4; the description adds no misleading parameter information.

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 opens with a specific verb and resource: 'Retrieve all active connections and session information on current PostgreSQL server.' It scopes the tool to the current server and enumerates the returned fields (user, database, client address, status, current query), which clearly separates it from sibling monitoring tools like get_wait_events, get_lock_monitoring, or get_pg_stat_statements_top_queries that cover different diagnostic domains.

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 explicit when-to-use triggers ('active connections', 'current sessions', 'connection status', server load/performance diagnosis, checking specific users or applications) and a 'Strictly Prohibited Use Cases' section excluding termination, query history, and auth changes. However, it does not name the specific sibling tools an agent should invoke instead for those prohibited needs, leaving alternative routing implicit.

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