Skip to main content
Glama
call518

MCP PostgreSQL Operations

by call518

get_wait_events

List PostgreSQL wait event types with descriptions from pg_wait_events and correlate them with active sessions currently waiting, helping diagnose session waits and wait patterns.

Instructions

[Tool Purpose]: List available wait event types and their descriptions (PostgreSQL 17+)

[Exact Functionality]:

  • Show all wait event types with human-readable descriptions from pg_wait_events catalog

  • Correlate with current active sessions waiting on events

  • Filter by specific wait event type

  • Falls back to basic pg_stat_activity wait info on PG < 17

[Required Use Cases]:

  • When user requests "wait events", "wait event descriptions", "what are sessions waiting on"

  • When diagnosing session waits and understanding wait event meanings

  • When analyzing wait patterns across the database

[Strictly Prohibited Use Cases]:

  • Requests for session termination or wait resolution

  • Requests for configuration changes

Input Schema

NameRequiredDescriptionDefault
database_nameNoDatabase name to analyze (uses default if omitted)
wait_event_typeNoFilter by wait event type (e.g., "Lock", "IO", "LWLock")

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv3.4.3
    • addedInput schema / properties / database_name / description
      Added value: +"Database name to analyze (uses default if omitted)"
    • addedInput schema / properties / wait_event_type / description
      Added value: +"Filter by wait event type (e.g., \"Lock\", \"IO\", \"LWLock\")"
  2. Addedv3.4.2

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the burden and discloses meaningful behavior: it queries pg_wait_events catalog, correlates with active sessions, and falls back to basic pg_stat_activity on PostgreSQL versions below 17. It does not state whether the operation is read-only or list performance characteristics, but the 'List'/'Show' language implies safety.

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 description is front-loaded with purpose and uses clear headings, though the bracketed section labels ([Tool Purpose], [Exact Functionality], etc.) add slight verbosity. Every sentence contributes useful information.

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 output schema exists and annotations are absent, the description covers all essential context: data sources, version fallback, use cases, and prohibitions. An agent has enough to invoke the tool 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%, so both parameters (database_name, wait_event_type) are already documented in the input schema. The description mentions filtering by wait event type but adds no syntax or format details beyond what the schema provides.

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

Purpose4/5

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

States a specific verb and resource: 'List available wait event types and their descriptions' and adds correlation with active sessions. It clearly identifies the PG 17+ catalog scope, but does not explicitly distinguish itself from related siblings like get_active_connections or get_lock_monitoring.

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?

Provides explicit required use cases (e.g., user requests 'wait events', diagnosing session waits) and strictly prohibited use cases (session termination, config changes). It does not name alternative tools for overlapping scenarios, so it falls short of a 5.

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