Skip to main content
Report operational health metrics for a database source: connection pool state and buffer cache hit ratio.

Features

  • Connection pool state: Total/active/idle session counts, idle-in-transaction sessions, the configured connection ceiling, and how long the longest-running query or idle-in-transaction session has been open
  • Buffer cache hit ratio: Percentage of reads served from cache vs disk, useful for spotting an undersized cache before it becomes a production incident
  • Per-engine support: Implemented for PostgreSQL, MySQL, MariaDB, and SQL Server. SQLite has no connection pool or cache-hit concept to report, so health_check returns an UNSUPPORTED error there
  • Graceful degradation: On MySQL/MariaDB/SQL Server, some metrics require an elevated privilege the connected user may not have. Rather than failing outright, health_check returns whatever it can and adds a notes entry explaining what’s missing
  • Opt-in only: Not part of the default tool pair — must be explicitly enabled per source
health_check is opt-in. Unlike execute_sql and search_objects, it is not enabled automatically when a source has no [[tools]] entries — add it explicitly (see Enabling health_check below).

Usage

Call the tool with no arguments — metrics are always for the source the tool instance is bound to.
Example output (PostgreSQL)
idle_in_transaction_aborted is Postgres-specific (a failed statement inside a transaction leaves it open-but-aborted until ROLLBACK) and is omitted on engines with no equivalent concept.

Reduced-privilege output

On MySQL, MariaDB, and SQL Server, some metrics need a privilege the connected user might not have — the tool still returns what it can and explains the gap instead of erroring:
Example output (MySQL, without PROCESS privilege)

Enabling health_check

Add a [[tools]] entry with name = "health_check". It takes no other options — no readonly or max_rows — since it’s always read-only:
See Tool Configuration for how [[tools]] entries work across multiple sources.