searchFunctions

Search functions and procedures by name, source, language, trigger name, or description.

read-onlyany connectionsweeps instancesweeps group

Synopsis

searchFunctions(web_search, [include_system], [schema])

Description

Search functions and procedures by name, source, language, trigger name, or description. PostgreSQL's own functions in pg_catalog and information_schema are left out unless include_system is true or one of those schemas is named: they were 97-99% of a typical answer, and enough of them to bury the database's own functions.

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 function names split into words at underscores and capitals, their source code and descriptions, and the names of triggers that call them -- plus the language name as a literal substring, so plpgsql is found by sql. To match part of a function name, use listFunctions with pattern
include_system optionalboolean
also search pg_catalog and information_schema. Defaults to false
schema optionalstring
only functions in this schema

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

Output

Keyed by schema-qualified function signature; each value is that routine's signature and properties. 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": "searchFunctions",
    "arguments": {
      "web_search": "total"
    }
  }
}

Result

{
  "shop.order_total(bigint)": {
    "description": "Sum of the order's line items.",
    "kind": "function",
    "language": "sql",
    "return_type": "numeric"
  }
}

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

searchTables, searchEnums