list_tables
List Tables
List all tables in the PostgreSQL database, optionally filtered by schema. Returns table names, schemas, row estimates, and size information. Also supports listing views and materialized views.
list_tables
List all tables in the PostgreSQL database, optionally filtered by schema. Returns table names, schemas, row estimates, and size information. Also supports listing views and materialized views.
delete_rows
Delete rows from a PostgreSQL table based on a WHERE condition. Supports returning the deleted rows and requires explicit confirmation for full-table deletes.
list_schemas
List all schemas in the PostgreSQL database with their table counts and sizes. Useful for exploring the database structure and understanding the organization of tables across schemas.
insert_rows
Insert one or more rows into a PostgreSQL table. Provide the data as an array of objects where keys are column names and values are the data to insert. Supports inserting multiple rows in a single operation and can optionally return the inserted rows.
manage_table
Create, alter, or drop a PostgreSQL table. Supports creating tables with columns, constraints, and foreign keys. For altering tables, supports adding columns, dropping columns, renaming columns, altering column types, and renaming the table.
describe_table
Get detailed schema information for a specific table, including columns, data types, constraints, indexes, and foreign keys. Useful for understanding table structure before building queries or modifying schemas.
manage_roles
Manage PostgreSQL roles and their privileges. Supports creating and dropping roles, as well as granting and revoking privileges on databases, schemas, tables, and other objects.
manage_indexes
Create or drop indexes on PostgreSQL tables. Supports B-tree, Hash, GIN, GiST, and other index types. Can create unique indexes, partial indexes with WHERE conditions, and multi-column indexes.
update_rows
Update rows in a PostgreSQL table based on a WHERE condition. Specify the columns to update and their new values. Supports returning updated rows and allows complex WHERE conditions.
execute_query
Execute an arbitrary SQL query against the PostgreSQL database. Supports all SQL operations including SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, and more. Returns column metadata and result rows for SELECT queries, or affected row counts for DML statements. Supports complex queries with joins, subqueries, CTEs, window functions, and aggregations.
manage_schemas
Create, rename, or drop PostgreSQL schemas. Schemas are namespaces for tables, views, functions, and other database objects.
manage_views
Create and drop PostgreSQL views or materialized views, and refresh materialized views.
select_query
Run a read-only SELECT query against the PostgreSQL database. Use this tool for data retrieval, reporting, analytics, joins, subqueries, read-only CTEs, window functions, and aggregations. Rejects non-SELECT SQL and runs inside a PostgreSQL READ ONLY transaction so data-changing statements are blocked. Use execute_query only when you intentionally need broader SQL operations such as INSERT, UPDATE, DELETE, CREATE, ALTER, or DROP.
Query, insert, update, and delete data in PostgreSQL relational databases. Explore schemas and tables, manage schemas, tables, indexes, views, materialized views, and database roles, and poll tables for row changes using timestamp or incrementing columns.
Common questions about connecting Postgresql to AI agents with Metorial.