Skip to main content
Glama
call518

MCP PostgreSQL Operations

by call518

get_bgwriter_stats

Analyze PostgreSQL background writer and checkpoint performance statistics, including buffer writes and checkpoint timing, with automatic version compatibility for troubleshooting I/O issues.

Instructions

[Tool Purpose]: Analyze background writer and checkpoint performance statistics with version compatibility

[Exact Functionality]:

  • Show checkpoint execution statistics (timed vs requested)

  • Display checkpoint timing information (write and sync times)

  • Provide buffer writing statistics by different processes

  • Analyze background writer performance and efficiency

  • Automatically adapts to PostgreSQL version (17+ uses separate checkpointer view)

[Required Use Cases]:

  • When user requests "checkpoint stats", "bgwriter performance", "buffer stats", etc.

  • When analyzing I/O performance and checkpoint impact

  • When investigating background writer efficiency

  • When troubleshooting checkpoint-related performance issues

[Strictly Prohibited Use Cases]:

  • Requests for checkpoint execution or configuration changes

  • Requests for background writer parameter modifications

  • Requests for statistics reset

Returns: Background writer and checkpoint performance statistics with version-appropriate data

Input Schema

NameRequiredDescriptionDefault

No arguments

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv3.4.2
    • addedInput schema / additionalProperties
      Added value: +false
    • removedOutput schema / properties / result / title
      Removed value: -"Result"
    • removedOutput schema / title
      Removed value: -"_WrappedResult"
  2. Addedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

With no annotations, the description carries the burden and mostly succeeds: the prohibited-use list makes clear this is a read-only observation tool, and it discloses real behavior beyond the name — automatic version adaptation, with PostgreSQL 17+ reading a separate checkpointer view. It stops short of stating required privileges or whether the stats are cumulative since reset.

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?

Section headers front-load purpose, functionality, and use cases, so an agent can scan it quickly. It is somewhat longer than needed — the bracketed section headers and the closing 'Returns' sentence largely restate points already made and duplicate the existing output schema.

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?

For a no-param, read-only stats tool with an output schema present, the description supplies what the schema cannot: what the numbers mean, version-dependent behavior, and negative scope. Return-value detail is correctly left to the output schema, so no meaningful gap remains.

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?

The tool takes zero parameters, so there is no parameter semantics to explain; the baseline for a no-arg tool applies. Nothing in the description misrepresents the empty 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?

The description names a concrete verb+resource pair (analyze background writer and checkpoint statistics) and enumerates the exact statistics exposed (checkpoint timed vs requested, write/sync timing, per-process buffer writes). This clearly separates it from siblings like get_io_stats or get_database_stats, though it never names those alternatives directly.

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

Usage Guidelines5/5

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

It gives explicit trigger phrases ("checkpoint stats", "bgwriter performance", "buffer stats"), three concrete diagnostic scenarios, and a dedicated 'Strictly Prohibited Use Cases' block excluding checkpoint execution, parameter changes, and stats resets. This is the full when/when-not/alternative pattern.

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