Search inside source code
pg_search_sourceSearch PostgreSQL function, procedure, view, materialized view, and trigger source code for text or regex patterns and return matching lines with line numbers to trace table/column usage.
Instructions
Find functions, procedures, views, materialized views and triggers whose source code contains a text, and return the matching lines with their line numbers.
Use it to answer "who uses this table or column?" in code that lives inside the
database, or "where is this function called?". pattern is plain text (case
insensitive); with regex=true it is a PostgreSQL regular expression. Line numbers
count from the first line of a function body or view definition. Code that belongs to
extensions is skipped. limit is the maximum number of objects.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"pattern": "<pattern>"
},
"name": "pg_search_source"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kinds | No | ||
| limit | No | ||
| regex | No | ||
| schema | No | ||
| pattern | Yes | ||
| connection | No |