get_object_definition
Retrieve the exact SQL definition of a database view, function, trigger, sequence, or index by name, with optional schema qualification and all matches returned.
Instructions
Get the faithful SQL definition of a non-table object by name.
For a table's columns and keys use get_table_schema; for the whole schema as a script use get_database_schema(format="sql").
Covers views (and materialized views), functions/procedures, triggers,
sequences, and indexes — produced by the database's own pg_get_*def functions.
name may be schema-qualified ("public.my_view"); all matches are returned
(same name in several schemas, overloaded functions).
Returns meta, object_type, name and matches, each with its schema, name,
kind and definition; no match is an error.
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": {
"database": "<database>",
"object_type": "<object_type>",
"name": "<name>"
},
"name": "get_object_definition"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Object name as stored (case-sensitive, no quotes), optionally schema-qualified: 'my_view' or 'public.my_view'. | |
| database | Yes | Name of a configured database, exactly as list_databases returns it (case-sensitive). Not a DSN, host or server-side database name. An unknown name is an error that lists the configured names. | |
| object_type | Yes | Kind of object. 'view' also covers materialized views, 'function' also covers procedures. |