Skip to main content
Glama
MCPg - Production-grade PostgreSQL MCP Server

MCPg - Production-grade PostgreSQL MCP Server

Audit database

audit_database
Read-only

Run a DBA-level audit of a PostgreSQL schema to detect performance, lock, temp-spill, dead-tuple, and logging issues, returning health scores, top issues, and prioritized recommendations.

Instructions

Run a deep, comprehensive DBA-level database performance, logs, and health audit over the specified schema. Scans memory, checkpoints, temp file spills, contention locks, dead tuple cleanliness, and optionally scans custom logging tables. Set fresh=true to bypass the cache and re-read live (e.g. after a schema change). Returns an object with timestamp, database, version, overall_health ('GOOD' / 'WARNING' / 'CRITICAL'), health_score (int), categories (per-area results), top_issues, recommendations, and raw_stats_snapshot.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "schema": "<schema>"
    },
    "name": "audit_database"
  }
}

Input Schema

NameRequiredDescriptionDefault
freshNo
schemaYes
databaseNoOptional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected.
log_tableNo

Output Schema

NameRequiredDescriptionDefault
versionYes
databaseYes
timestampYes
categoriesYes
top_issuesYes
health_scoreYes
overall_healthYes
recommendationsYes
raw_stats_snapshotYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.4
    • changedInput schema / properties / database / description
      Previous value: -"Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids."New value: +"Optional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected."
  2. Changed1 schema field changed
    • addedInput schema / properties / fresh
      Added value: +{
      +  "default": false,
      +  "title": "Fresh",
      +  "type": "boolean"
      +}
  3. First observedv0.6.8

TDQS

A3.9/5.0
Behavior4/5

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

The annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered. The description adds useful behavior beyond that: it discloses the caching behavior and how `fresh=true` forces live re-reading, and it describes the broad set of areas scanned. It does not discuss runtime cost or permissions, but it adds meaningful context beyond the annotations.

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 front-loaded with the core purpose and scan domains, and the `fresh` guidance is placed usefully after that. The final enumeration of returned fields is somewhat redundant because an output schema exists, but overall the description remains readable and mostly earns its length.

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 complex audit tool, the description covers purpose, scan scope, cache behavior, and output shape. Rich structured data is present (output schema and annotations), and the schema documents the `database` targeting parameter, but the `log_table` parameter remains underspecified in both description and schema, leaving a small gap.

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

Parameters3/5

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

Schema description coverage is only 25%, with only the `database` parameter documented in the schema. The description compensates somewhat by explaining `fresh` behavior and implying optional log-table scanning, but it does not explain the `log_table` parameter format or give details on the required `schema` scope beyond 'over the specified schema.' This is adequate but leaves clear gaps.

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 states a specific verb and resource: 'Run a deep, comprehensive DBA-level database performance, logs, and health audit over the specified schema.' It also enumerates the scan areas (memory, checkpoints, temp file spills, contention locks, dead tuple cleanliness, custom logging tables), which clearly distinguishes it from narrower sibling tools such as check_database_health or audit_settings.

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 gives useful runtime guidance for the `fresh` flag, telling the agent to set it true after a schema change to bypass the cache. However, it does not explicitly say when to choose this tool over similar siblings like check_database_health, run_advisors, or analyze_workload, so the tool-selection guidance is implied rather than explicit.

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

Deploy Server

Other Tools