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

MCPg - Production-grade PostgreSQL MCP Server

Check segment health

check_segment_health
Read-only

Inspect MPP segment health by reading gp_segment_configuration to report per-segment status, sync mode, and role drift, plus unhealthy and out-of-sync counts for failover detection.

Instructions

Walk gp_segment_configuration and surface MPP segment posture. Returns per-segment status ('u' = up), mode ('s' = sync / 'n' = not-in-sync / 'c' = changetracking), and role vs preferred_role to detect post-failover state. Top-level unhealthy_count + out_of_sync_count let agents branch without walking the segments array. Read-only. On vanilla PG returns available=false.

Example: check_segment_health()

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "check_segment_health"
  }
}

Input Schema

NameRequiredDescriptionDefault
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.

Output Schema

NameRequiredDescriptionDefault
detailYes
segmentsYes
availableYes
healthy_countYes
total_segmentsYes
unhealthy_countYes
out_of_sync_countYes

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. First observedv0.6.8

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, so restating 'Read-only' adds little; the value comes from disclosing the code semantics ('u' = up, 's'/'n'/'c' modes), the aggregate counters that let an agent branch without walking the array, and the graceful degradation to `available=false` on vanilla Postgres. That is genuine behavioral context beyond the annotations and schema.

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 action and return shape, and each sentence carries information (field codes, aggregate counters, fallback behavior). Minor waste: 'Read-only' duplicates the annotation, and the trailing example `check_segment_health()` is near-redundant for a zero-required-parameter tool.

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?

With an output schema present, the description needn't explain return values, yet it still summarizes the key fields and the vanilla-PG degradation path, which is the most likely source of agent confusion. The only gap is that it doesn't state why one would target a secondary database via the `database` parameter.

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 coverage is 100% and the single optional `database` parameter is fully documented in the schema, including the rejection of non-configured names. The description adds nothing about the parameter, so the baseline 3 applies rather than a higher score.

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 names a specific verb and resource (walk `gp_segment_configuration`, surface MPP segment posture) and enumerates the exact fields returned (status, mode, role vs preferred_role). It is clearly distinguishable from generic siblings such as check_database_health or get_warehousepg_status because it is explicitly scoped to MPP segments and post-failover state.

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?

Usage is implied through the motivation (detect post-failover state, branch on `unhealthy_count`/`out_of_sync_count`) and the exclusion cue that vanilla PG yields `available=false`. However, it never explicitly says when to pick this over `check_database_health`, `get_warehousepg_status`, or `list_replicas`, leaving the agent to infer the boundary.

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