Skip to main content
Glama

Database Health

db_health
Read-onlyIdempotent

Checks database connectivity, pool stats, uptime, and PostgreSQL system health to verify responsiveness and diagnose performance issues.

Instructions

Checks database connectivity, connection pool statistics, server uptime, and total request count. In multi-database mode, omit the database parameter to see health status for all configured databases simultaneously. Also runs PostgreSQL system checks: vacuum health (TXID wraparound risk), replication lag, index usage, sequence exhaustion, buffer cache hit rate, and invalid constraints.

When to use:

  • At the start of a session to verify the database is responsive.

  • When the user asks about connection health or pool utilization.

  • When troubleshooting slow responses or connection errors.

  • Periodically during long sessions to check pool exhaustion.

  • To check vacuum/replication/sequence health in production.

Behavioral notes:

  • In single-database mode, returns stats for the one connected database.

  • In multi-database mode, returns an array of health entries for all databases.

  • 'idle' connections are available; 'active' connections are in use.

  • If pool utilization is high (>80%), consider increasing PGPOOL_MAX.

  • Vacuum checks query pg_stat_user_tables — no extensions required.

  • Replication checks query pg_stat_replication — returns empty on standalone instances.

  • Buffer cache checks pg_stat_database for hit rate below 90%.

  • Constraint checks pg_constraint for invalid (unvalidated) constraints.

Returns: JSON with connected (boolean), pool stats (total, idle, active), uptime seconds, total requests served, database connection summary, and health checks (vacuum, replication, indexes, sequences, bufferCache, constraints).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNoName of the database to query (from pgautopilot.json). Omit to use the current default database.
Install Server

TDQS

A4.6/5.0
Behavior5/5

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

The description discloses single- versus multi-database behavior, empty replication results on standalone instances, idle/active connection semantics, the >80% pool-utilization guidance, and which system tables are queried. These details go far beyond the annotations' readOnly/idempotent hints and give the agent accurate expectations.

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 description is organized into clear sections, front-loads the primary purpose, and uses bullets for usage guidance. It is longer than average, but every section carries distinct operational information for a complex diagnostic tool, so the length is earned.

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?

Even without an output schema, the description enumerates the exact returned fields (connected, pool stats, uptime, total requests, database summary, and each health check) and covers edge cases such as standalone instances and mode differences. An agent has enough context to invoke the tool correctly and interpret its result.

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 100% and the schema already explains the database parameter and its default. The description adds multi-database mode behavior ('omit the database parameter to see health status for all configured databases simultaneously') and clarifies the parameter's source, which is meaningful context beyond the schema.

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 description opens with a specific verb and resource: 'Checks database connectivity, connection pool statistics, server uptime, and total request count' and then targets specific PostgreSQL system checks. This clearly distinguishes db_health from siblings like db_overview or mcp_status by naming concrete metrics rather than a generic health phrase.

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

Usage Guidelines4/5

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

A dedicated 'When to use' section lists clear trigger scenarios: session startup, connection-health queries, slow-response troubleshooting, periodic pool checks, and production vacuum/replication checks. It does not explicitly name sibling tools to exclude, so it stops short of a 5, but the context is unambiguous.

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

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyberreinxy/pgautopilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server