searchTables

Find tables across every non-system schema by full-text search over table names, comments, column names and comments, enum labels and grantee names, and return their structure.

read-onlyany connectionsweeps instancesweeps group

Synopsis

searchTables(web_search)

Description

Find tables across every non-system schema by full-text search over table names, comments, column names and comments, enum labels and grantee names, and return their structure. Structure only -- there is no statistics counterpart, because a text search is how you find a table, not how you read a counter: name a match to tableStats or tableSize for those.

Parameters

web_search requiredstring
full-text search, not a substring: websearch_to_tsquery syntax in English, so words are stemmed (users finds user), "a phrase" in double quotes must match in order, or between words means either, and -word excludes. A fragment of a word does not match. Matched against table and schema names split into words at underscores and capitals, the table's comment, its columns' names and comments, the grantee roles, and the names, comments and values of enum types its columns use. To match part of a table name, use listTables with pattern

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

Output

Keyed by schema-qualified table name; each value is that table's structure. An absent extension or a missing grant is reported as {error, hint} in place of the map.

Scope

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": "searchTables",
    "arguments": {
      "web_search": "invoice"
    }
  }
}

Result

{
  "shop.orders": {
    "kind": "table",
    "description": "Customer purchase orders; invoice number in invoice_no.",
    "columns": {
      "invoice_no": {
        "description": "Printed invoice number."
      }
    }
  }
}

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

searchFunctions, searchEnums