functionDetails

Return detailed function or procedure info including source and trigger usage.

read-onlyany connectionsweeps instancesweeps groupcan return data values

Synopsis

functionDetails(function, schema)

Description

Return detailed function or procedure info including source and trigger usage.

This operation can return values that came from your data. It never changes anything and never returns rows, but read what reaches the caller before connecting it to a database whose contents are sensitive.

Parameters

function requiredstring
schema requiredstring

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

Output

Keyed by function signature; each value is that routine's source, definition and grants. 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": "functionDetails",
    "arguments": {
      "schema": "shop",
      "function": "order_total"
    }
  }
}

Result

{
  "order_total(bigint)": {
    "language": "sql",
    "return_type": "numeric",
    "source": "SELECT sum(quantity * unit_price) FROM shop.order_items WHERE order_id = p_order_id",
    "definition": "CREATE OR REPLACE FUNCTION shop.order_total(p_order_id bigint) RETURNS numeric LANGUAGE sql STABLE STRICT AS $function$ ... $function$",
    "roles": {
      "app_rw": [
        "EXECUTE"
      ]
    }
  }
}

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

listSchemas, listTables, tableDetails, tableStats, largeObjects, listPartitions, partitionDetails, listTableStats, tableSize, listTableSizes, listFunctions, listEnums, enumDetails, listTypes, typeDetails, columnHistogram, listExtendedStatistics, listSequences