Skip to main content
Glama

Cache and I/O

pg_cache_io
Read-onlyIdempotent

Report PostgreSQL cache effectiveness and I/O by showing buffer cache hit ratios, pg_stat_io summaries, temp file use, and I/O timings to diagnose slow reads.

Instructions

Report cache effectiveness and I/O: the buffer cache hit ratio of the database, of the tables and of the indexes (worst first among the busy ones), a summary of pg_stat_io (PostgreSQL 16+), temporary file use, I/O timings when track_io_timing is on, and, if the pg_buffercache extension is installed, the relations that occupy shared_buffers.

A low hit ratio means reads go to the operating system or the disk; it does not count the OS page cache, so a lower value is not always slow. limit caps each list.

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": "pg_cache_io"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
connectionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, non-destructive and closed-world, so the safety profile is covered. The description adds real behavioral context beyond them: pg_stat_io output requires PostgreSQL 16+, the pg_buffercache section appears only if that extension is installed, and I/O timings appear only when track_io_timing is on — valuable conditional-output disclosure. It stops short of describing result shape or ordering beyond 'worst first among the busy ones', which is why it stays at 3 rather than higher.

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 main capability sentence is front-loaded and dense with specific payloads, and the caveat about the OS page cache is short and earned. The closing '`limit` caps each list' is a useful last line. Slightly run-on enumeration, but no 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?

No output schema exists, and the description compensates by enumerating the sections returned plus the ordering rule and version/extension conditions that change the output. The main remaining gap is the undocumented `connection` parameter; otherwise an agent has enough to call it correctly and interpret the result.

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 0%, so the description must carry the parameter burden. It does clarify the non-obvious semantics of `limit` — it caps each list rather than the total row count — but the `connection` parameter is never mentioned, leaving half the parameters undocumented anywhere. Partial compensation for the coverage gap.

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 opening clause pairs a specific verb ('Report') with a precise resource ('cache effectiveness and I/O') and then enumerates the exact reports produced: buffer cache hit ratio for database/tables/indexes, pg_stat_io summary, temp file use, I/O timings, and shared_buffers occupants. An agent can tell from this alone that it is the cache/I/O diagnostics tool rather than a general stats or index tool.

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?

Usage is implied by the diagnostic framing and the interpretive note that a low hit ratio, while meaning reads fall through to OS/disk, does not count the OS page cache and so is not always slow. There is no explicit statement of when to pick this over sibling report tools such as pg_index_stats or pg_activity, and no stated prerequisites, so guidance is only indirect.

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