Skip to main content
Glama
r69shabh

pg-bloat-detective

bloat_collect

Captures a read-only Postgres bloat snapshot into timeline history, then returns fresh per-table and per-index verdicts with recommended actions for safe production diagnosis.

Instructions

Take a read-only Postgres snapshot into the timeline, then return fresh verdicts.

Safe on prod: read-only transaction, 5s statement timeout, needs only pg_stat_* views + optional pgstattuple extension. No writes, no agents. Args: dsn: Postgres DSN, e.g. 'dbname=app user=readonly host=db.internal'. Default: BLOAT_DSN env. Never logs the password. Returns: {snapshot: 'saved', db: path, findings: [...with action per table/index]}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dsnNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.6

TDQS

A3.9/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 it well: it discloses the read-only transaction, the 5s statement timeout, the pg_stat_* view requirement plus optional pgstattuple extension, that no agents are spawned, and that the password is never logged. It even reveals the side effect of writing a snapshot file (db: path). It stops short of describing cost/load on prod or what happens on repeated collection into the same timeline.

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 action, followed by a safety paragraph and explicit Args/Returns blocks. Nearly every line earns its place; the only slack is the loosely formatted 'Returns' line rather than any redundant sentence.

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?

There is no output schema, yet the description sketches the return shape ({snapshot, db path, findings with an action per table/index}), covers required extensions and permissions, and documents the single parameter's default. An agent has what it needs to call this correctly; the only missing element is sibling routing.

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 coverage is 0%, so the description must compensate, and it does: it gives an example DSN string with a readonly user, states the BLOAT_DSN environment fallback matching the empty-string default, and notes the password is never logged. That is materially more than the bare 'Dsn' string schema.

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 concrete verb and resource: take a read-only Postgres snapshot into the timeline and return verdicts. That is specific enough to distinguish it from a pure reader like bloat_timeline, but it never names a sibling or explains the boundary, so the differentiator is inferred 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 'Safe on prod' framing implies this is intended as a first collection step against production, but there is no explicit statement of when to choose bloat_collect over bloat_live_diagnose or bloat_check, and no prerequisites or exclusions are given. Usage is implied, not guided.

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