listConnections

Return the configured database connections by name, with the libpq service name or host/port/dbname/user for each, its instance, replication_group and group labels where configured, and which is the default; passwords are never returned and a service file is never expanded.

read-only

Synopsis

listConnections([pattern])

Description

Return the configured database connections by name, with the libpq service name or host/port/dbname/user for each, its instance, replication_group and group labels where configured, and which is the default; passwords are never returned and a service file is never expanded. Pass a name as the 'connection' argument of any other tool to run that tool against that database. See listTopology for the same labels indexed the other way round, by topology name rather than by connection.

Pass 'pattern' to narrow the list: a case-insensitive substring matched against the connection name AND its instance, replication_group and group labels. That is how to find one connection on a registry holding hundreds -- this answer carries every configured connection otherwise, and it has no cursor. A pattern that matches nothing returns an empty list rather than an error

Parameters

pattern optionalstring
case-insensitive substring of the connection name or of its instance, replication_group or group label

Output

The configured connection registry. An absent extension or a missing grant is reported as {error, hint} instead.

FieldType
connectionsarray | null

Example mocked data

Request

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

Result

{
  "connections": [
    {
      "name": "shop_prod",
      "default": true,
      "service": "shop_prod_ro",
      "instance": "pg-shop-01",
      "replication_group": "shop-ha",
      "group": [
        "fleet"
      ]
    },
    {
      "name": "shop_replica_1",
      "default": false,
      "host": "10.0.2.21",
      "port": "5432",
      "dbname": "shop",
      "user": "mcp_readonly",
      "replication_group": "shop-ha",
      "group": [
        "fleet"
      ]
    },
    {
      "name": "reports_prod",
      "default": false,
      "service": "reports_ro",
      "instance": "pg-shop-01",
      "group": [
        "fleet"
      ]
    }
  ]
}

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.