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

MCPg - Production-grade PostgreSQL MCP Server

Read PG WAL stats

read_pg_wal_stats
Read-only

Reads Write-Ahead Log (WAL) record statistics for a specified LSN range, grouped by resource manager or record type; requires pg_walinspect and reports when unavailable.

Instructions

Read Write-Ahead Log (WAL) record statistics over a specified LSN range, grouped by resource manager or record type. Requires the pg_walinspect extension. If not installed, returns available=false.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "start_lsn": "<start_lsn>"
    },
    "name": "read_pg_wal_stats"
  }
}

Input Schema

NameRequiredDescriptionDefault
end_lsnNo
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.
start_lsnYes
per_recordNo

Output Schema

NameRequiredDescriptionDefault
statsYes
availableYes

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

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety and locality are covered. The description adds real value beyond them by disclosing the extension dependency and the 'available=false' degraded response, which an agent needs for error handling. It stops short of describing volume, cost, or what happens with a missing/invalid LSN.

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?

Three short sentences, each carrying distinct information: what is returned, the required extension, and the failure mode. Front-loaded with the purpose and free of filler.

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 return-value explanation is not needed, and annotations cover the safety profile. What remains missing is modest but real: LSN format guidance and default/omitted end_lsn semantics for a tool whose whole input revolves around an LSN range.

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

Parameters2/5

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

Schema description coverage is only 25% — only 'database' is documented in the schema — so the description needed to carry the parameter burden. It mentions an 'LSN range' and the grouping mode but never explains the LSN string format, what omitting end_lsn means (presumably up to current LSN), or how per_record maps to the stated grouping choices.

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 ('Read Write-Ahead Log (WAL) record statistics') plus the aggregation dimension (resource manager or record type). This implicitly separates it from the nearby read_pg_wal_records, though it never names that sibling explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides a prerequisite (pg_walinspect must be installed) and a fallback behavior, which effectively tells the agent when the tool will be useless. It does not state when to prefer this over read_pg_wal_records or get_wal_archive_status, nor any conditions that should exclude its use.

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