replicationSlots

Return replication slots with retained WAL bytes; a lagging or unused slot holds back WAL indefinitely and is a common cause of disk bloat incidents.

read-onlyany connectionsweeps replication groupsweeps group

Synopsis

replicationSlots()

Description

Return replication slots with retained WAL bytes; a lagging or unused slot holds back WAL indefinitely and is a common cause of disk bloat incidents. A logical slot's consumer is a subscriber on another server: call subscriptionStats there to see whether it is stuck, and note that retained_wal_bytes here is the byte lag that a subscriber cannot measure for itself.

Parameters

None of its own.

Also accepts connection, replication_group, group, role, described once under arguments every tool takes.

Output

Keyed by slot name; each value is its type, activity and retained WAL. An absent extension or a missing grant is reported as {error, hint} in place of the map.

Scope

This reading is instance-wide -- every database on the same postmaster returns it identically, so asking each of them in turn repeats one answer. The counters here are each server's own, so members of a replication group legitimately disagree and the answer is their sum, not the primary's copy.

Example mocked data

Request

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

Result

{
  "from_erp_slot": {
    "slot_type": "logical",
    "plugin": "pgoutput",
    "database": "shop",
    "temporary": false,
    "active": false,
    "active_pid": null,
    "inactive_since": "2026-09-14T02:10:00Z",
    "wal_status": "extended",
    "retained_wal_bytes": 9123840512,
    "safe_wal_size": 1024000000,
    "conflicting": false,
    "invalidation_reason": null
  }
}

Invented values on a fictional shop database, shaped by and checked against this tool's output schema. Real output is returned as structuredContent to clients that negotiate MCP 2025-06-18 or later.

See also

replicationStats, listForeignTables, listForeignServers, listPublications, listSubscriptions, subscriptionStats