Skip to main content
Glama
r69shabh

pg-bloat-detective

bloat_blockers

Identify Postgres VACUUM blockers from a read-only timeline: get blocker PID, query, xmin age, and replication slot, prioritized by cause, then end the session and vacuum the table.

Instructions

Who is pinning VACUUM: blocker pid + query + xmin age + slot.

Read-only on the local timeline file. Priority: prepared-xact > stale-slot

idle-in-transaction. Fix: end the named session, then VACUUM the table. Args: db: Path to the SQLite timeline file (default: BLOAT_DB env). Returns: {blockers: [{ts, kind, pid, age, query, slot}] — newest first, max 20. Use pid with SELECT pg_terminate_backend(pid) after verification.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dbNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.6

TDQS

A3.8/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 so well: it declares the operation read-only against a local file, discloses the result ordering ('newest first') and cap ('max 20'), and adds a caution ('after verification') before suggesting pg_terminate_backend. It does not discuss permissions or failure modes, but for a local read-only file query those are largely irrelevant.

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 diagnostic question, then reads naturally into scope, priority, fix, args, and returns. The Args/Returns blocking is easy to scan and no sentence is wasted, though the remediation instruction adds some length beyond strict tool description.

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?

There is no output schema, but the description inlines the return shape ({blockers: [{ts, kind, pid, age, query, slot}]}), ordering, and count limit, so an agent knows what it will get. Combined with the arg documentation and remediation steps, the definition is complete for a one-parameter diagnostic tool.

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

Parameters4/5

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

Schema description coverage is 0% for the single parameter, so the description must compensate, and it does: 'db: Path to the SQLite timeline file (default: BLOAT_DB env)'. This explains both the meaning and the environment-based default that the bare schema ('default: ""') does not convey.

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 resource and the exact diagnostic payload ('Who is pinning VACUUM: blocker pid + query + xmin age + slot'), which is far more informative than a name restatement. It implicitly contrasts with the live-diagnosis sibling by noting it is 'Read-only on the local timeline file', but it never names bloat_live_diagnose or the other siblings explicitly, so differentiation is inferential rather than stated.

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?

The description supplies a priority ordering (prepared-xact > stale-slot > idle-in-transaction) and a remediation path ('end the named session, then VACUUM the table'), which implies the diagnostic scenario. However, it never states when to call this versus bloat_live_diagnose or the other bloat_* siblings, leaving tool selection to inference.

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