Skip to main content
Glama
MCP PostgreSQL Operations

MCP PostgreSQL Operations

by call518

get_per_backend_io_stats

Analyzes PostgreSQL 18+ per-backend I/O and WAL statistics to identify processes generating the most I/O and diagnose process-level hotspots.

Instructions

[Tool Purpose]: Analyze per-backend I/O and WAL statistics (PostgreSQL 18+)

Note: Uses pg_stat_get_backend_io() and pg_stat_get_backend_wal() which are new in PG 18.

[Exact Functionality]:

  • Show I/O statistics broken down by individual backend process

  • Display per-backend WAL generation statistics

  • Identify backends with highest I/O activity

  • Falls back to version notice on PG < 18

[Required Use Cases]:

  • When user requests "per-backend I/O", "backend I/O stats", "which backend is doing most I/O"

  • When diagnosing I/O hotspots at the process level

  • When analyzing per-connection I/O patterns

[Strictly Prohibited Use Cases]:

  • Requests for backend termination

  • Requests for I/O configuration changes

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_per_backend_io_stats"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum results (1-100, default 20)
database_nameNoDatabase name (uses default if omitted)

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 (uses default if omitted)"
    • addedInput schema / properties / limit / description
      Added value: +"Maximum results (1-100, default 20)"
  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 full burden and does well: it discloses the PG 18 dependency, the underlying pg_stat_get_backend_io()/pg_stat_get_backend_wal() functions, and that it degrades to a version notice on older servers. It never explicitly states read-only/non-mutating, but 'Analyze... statistics' plus the prohibited-mutation note makes it clear.

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

Conciseness3/5

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

Purpose is front-loaded and the bracketed section headers aid scanning, but the bracketed labels, stray quotes, and repeated note about the underlying functions add bulk. The quoted example phrases are useful for matching; the duplication of the PG 18 note is not.

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 values need not be described, and the version gate plus parameter defaults are covered. What an agent needs to call this correctly is present; only the explicit read-only nature and any result-ordering (e.g., does limit return the top I/O backends?) are implicit.

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 description coverage is 100%, with limit (range and default) and database_name fully documented in the schema. The description adds no meaning beyond that, so the baseline 3 applies.

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: 'Analyze per-backend I/O and WAL statistics', and names the exact PG 18 functions used. The per-backend scope distinguishes it clearly from siblings like get_io_stats, get_table_io_stats and get_index_io_stats that aggregate at other levels.

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 (per-backend I/O hotspots, per-connection patterns) and explicit exclusions (backend termination, I/O config changes). The PG 18+ constraint is stated up front with fallback behavior. It stops short of naming sibling tools to redirect to, which keeps it from a 5.

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