Skip to main content
Glama
YawLabs

@yawlabs/postgres-mcp

by YawLabs

Replication status

pg_replication_status
Read-onlyIdempotent

Check replication status across PostgreSQL clusters. View configured slots, connected replicas, and WAL position to spot lagging or disconnected replicas, or see upstream status on replicas.

Instructions

Replication overview: configured replication slots, connected replicas (from pg_stat_replication), and current WAL position. Use on primary to spot lagging or disconnected replicas, on replicas to see upstream status. Returns empty arrays on a standalone (non-replicated) database rather than erroring.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
slotsYesEmpty both on a standalone database and when the fetch failed -- check `_warnings`.
replicasYes
_warningsNo
is_replicaYespg_is_in_recovery(). Null means the probe failed, NOT 'primary'.
wal_positionYesLast received LSN on a replica, current LSN on a primary. Null when the probe failed.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed22 schema fields changedv0.12.1
    • removedOutput schema / properties / is_replica / anyOf
      Removed value: -[
      -  {
      -    "type": "boolean"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / is_replica / type
      Added value: +[
      +  "boolean",
      +  "null"
      +]
    • removedOutput schema / properties / replicas / items / properties / client_addr / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / replicas / items / properties / client_addr / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / replicas / items / properties / flush_lag_seconds / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / replicas / items / properties / flush_lag_seconds / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / properties / replicas / items / properties / replay_lag_seconds / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / replicas / items / properties / replay_lag_seconds / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / properties / replicas / items / properties / write_lag_seconds / anyOf
      Removed value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / replicas / items / properties / write_lag_seconds / type
      Added value: +[
      +  "number",
      +  "null"
      +]
    • removedOutput schema / properties / slots / items / properties / confirmed_flush_lsn / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / slots / items / properties / confirmed_flush_lsn / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / slots / items / properties / database / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / slots / items / properties / database / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / slots / items / properties / plugin / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / slots / items / properties / plugin / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / slots / items / properties / restart_lsn / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / slots / items / properties / restart_lsn / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / slots / items / properties / wal_status / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / slots / items / properties / wal_status / type
      Added value: +[
      +  "string",
      +  "null"
      +]
    • removedOutput schema / properties / wal_position / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedOutput schema / properties / wal_position / type
      Added value: +[
      +  "string",
      +  "null"
      +]
  2. Changed2 schema fields changedv0.12.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "https://json-schema.org/draft/2020-12/schema",
      +  "additionalProperties": false,
      +  "properties": {
      +    "_warnings": {
      +      "items": {
      +        "type": "string"
      +      },
      +      "type": "array"
      +    },
      +    "is_replica": {
      +      "anyOf": [
      +        {
      +          "type": "boolean"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "pg_is_in_recovery(). Null means the probe failed, NOT 'primary'."
      +    },
      +    "replicas": {
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "application_name": {
      +            "type": "string"
      +          },
      +          "client_addr": {
      +            "anyOf": [
      +              {
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "Null for a replica connected over a unix socket."
      +          },
      +          "flush_lag_seconds": {
      +            "anyOf": [
      +              {
      +                "type": "number"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ]
      +          },
      +          "replay_lag_seconds": {
      +            "anyOf": [
      +              {
      +                "type": "number"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ]
      +          },
      +          "state": {
      +            "description": "startup | catchup | streaming | backup | stopping.",
      +            "type": "string"
      +          },
      +          "sync_state": {
      +            "description": "async | potential | sync | quorum.",
      +            "type": "string"
      +          },
      +          "write_lag_seconds": {
      +            "anyOf": [
      +              {
      +                "type": "number"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "Null until the primary has measured a round trip."
      +          }
      +        },
      +        "required": [
      +          "application_name",
      +          "client_addr",
      +          "state",
      +          "sync_state",
      +          "write_lag_seconds",
      +          "flush_lag_seconds",
      +          "replay_lag_seconds"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "slots": {
      +      "description": "Empty both on a standalone database and when the fetch failed -- check `_warnings`.",
      +      "items": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "active": {
      +            "description": "False means nothing is consuming the slot -- WAL piles up behind it.",
      +            "type": "boolean"
      +          },
      +          "confirmed_flush_lsn": {
      +            "anyOf": [
      +              {
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "Logical slots only; null on a physical slot."
      +          },
      +          "database": {
      +            "anyOf": [
      +              {
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "Logical slots only; null on a physical slot."
      +          },
      +          "plugin": {
      +            "anyOf": [
      +              {
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "Logical slots only; null on a physical slot."
      +          },
      +          "restart_lsn": {
      +            "anyOf": [
      +              {
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ]
      +          },
      +          "slot_name": {
      +            "type": "string"
      +          },
      +          "slot_type": {
      +            "description": "physical | logical.",
      +            "type": "string"
      +          },
      +          "wal_status": {
      +            "anyOf": [
      +              {
      +                "type": "string"
      +              },
      +              {
      +                "type": "null"
      +              }
      +            ],
      +            "description": "reserved | extended | unreserved | lost."
      +          }
      +        },
      +        "required": [
      +          "slot_name",
      +          "slot_type",
      +          "active",
      +          "restart_lsn",
      +          "confirmed_flush_lsn",
      +          "wal_status",
      +          "database",
      +          "plugin"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "wal_position": {
      +      "anyOf": [
      +        {
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "Last received LSN on a replica, current LSN on a primary. Null when the probe failed."
      +    }
      +  },
      +  "required": [
      +    "is_replica",
      +    "wal_position",
      +    "slots",
      +    "replicas"
      +  ],
      +  "type": "object"
      +}
  3. First observedv0.7.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnly/openWorld/idempotent/non-destructive traits. The description adds meaningful behavioral detail beyond annotations: it returns empty arrays on standalone databases instead of erroring, which is exactly the kind of edge-case disclosure agents need.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences with no filler. The core output is front-loaded, usage guidance follows, and the standalone edge case is stated last. Every sentence earns its place.

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?

The tool is simple, parameterless, read-only, has an output schema, and its edge-case behavior is explicitly documented. The description fully covers what an agent needs to decide when to call it and what to expect.

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 has zero parameters, and the schema confirms an empty properties object, so parameter documentation is not applicable. The baseline of 4 is appropriate because there is nothing missing for the agent to understand.

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 clearly states the tool's resource (replication status) with specific components: configured slots, connected replicas from pg_stat_replication, and current WAL position. It distinguishes itself from sibling inspection tools, which cover different PostgreSQL domains.

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?

The description gives explicit context for when to run the tool on a primary vs. on a replica, which is strong usage guidance. It does not name alternatives, but the tool's specialized scope makes alternatives implicit rather than necessary.

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

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/YawLabs/postgres-mcp'

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