listTablespaces

Return cluster-wide tablespaces with owner, filesystem location, options, and description.

read-onlyany connectionsweeps group

Synopsis

listTablespaces()

Description

Return cluster-wide tablespaces with owner, filesystem location, options, and description. The description comes from pg_shdescription: a tablespace is a shared object, so COMMENT ON TABLESPACE does not land in pg_description and obj_description() cannot see it.

Parameters

None of its own.

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

Output

Keyed by tablespace name; each value is its location, owner and options. 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. A physical replica is byte-identical here, so asking each member of a replication group adds nothing.

Example mocked data

Request

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

Result

{
  "pg_default": {
    "owner": "postgres",
    "location": "(default)",
    "options": null,
    "description": ""
  },
  "fast_nvme": {
    "owner": "postgres",
    "location": "/mnt/nvme/pg",
    "options": [
      "random_page_cost=1.1"
    ],
    "description": "Hot partitions."
  }
}

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

listRoles, listEventTriggers, listLanguages, listAccessMethods, listCasts, listExtensions