Skip to main content
Glama
MCPg - Production-grade PostgreSQL MCP Server

MCPg - Production-grade PostgreSQL MCP Server

Get PG 19 stats status

get_pg19_stats_status
Read-only

Check whether PostgreSQL 19’s pg_stat_lock and pg_stat_recovery views are usable on the target database, returning availability, version details, and fallback guidance.

Instructions

Report whether PG 19's pg_stat_lock and pg_stat_recovery views are usable on this server. Never raises — driver-level errors surface as available=false. On PG < 19 returns available=false with a diagnostic pointing the agent at find_blocking_chains / pg_stat_replication. Returns an object with available (bool), server_version_num (int), server_version, has_pg_stat_lock (bool), has_pg_stat_recovery (bool), and detail (guidance string).

Example: get_pg19_stats_status()

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "get_pg19_stats_status"
  }
}

Input Schema

NameRequiredDescriptionDefault
databaseNoOptional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected.

Output Schema

NameRequiredDescriptionDefault
detailYes
availableYes
server_versionYes
has_pg_stat_lockYes
server_version_numYes
has_pg_stat_recoveryYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.4
    • changedInput schema / properties / database / description
      Previous value: -"Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids."New value: +"Optional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected."
  2. First observedv0.6.8

TDQS

A4.2/5.0
Behavior4/5

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

Annotations only declare readOnlyHint/openWorldHint=false; the description adds genuine behavior beyond that: the call never raises, driver errors are swallowed into available=false, and results are version-gated. It does not discuss cost, permissions, or latency, but those are minor for a capability probe.

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?

Front-loaded with the core question, then the failure mode, then the fallback, then the shape — a logical order with no filler. The trailing zero-argument example and the field enumeration are marginal value since an output schema already exists.

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?

For a single-optional-param status probe, everything an agent needs is present: what is checked, what happens on old versions, that it never throws, and which siblings to use instead. The field list is redundant with the output schema but does no harm.

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?

One optional parameter at 100% schema description coverage, so the schema already explains the 'database id from list_databases / secondary read-only target' semantics fully. The description adds nothing about the database parameter, which is acceptable given the coverage baseline of 3.

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?

States a specific verb and resource ('Report whether PG 19's `pg_stat_lock` and `pg_stat_recovery` views are usable'), which distinguishes it from the actual data-reading siblings read_pg_stat_lock and read_pg_stat_recovery. An agent can tell this is a capability/preflight probe rather than a data read without opening any schema.

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?

Gives explicit fallback routing: on PG < 19 it 'points the agent at find_blocking_chains / pg_stat_replication', naming concrete alternatives. What's missing is the forward directive — it never says 'call this before read_pg_stat_lock' — so the agent must infer the preflight role.

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

Deploy Server

Other Tools