Overview
PostgreSQL tool allows you to query and manage PostgreSQL databases directly from your AI agents.Installation
Environment Variables
Quick Start
Usage with Agent
Available Methods
query(sql)
Execute a SQL query.execute(sql)
Execute a SQL statement (INSERT, UPDATE, DELETE).list_tables()
List all tables in the database.describe_table(table_name)
Get table schema.Configuration Options
Function-Based Usage
Docker Setup
Error Handling
Common Errors
| Error | Cause | Solution |
|---|---|---|
psycopg2 not installed | Missing dependency | Run pip install psycopg2-binary |
Connection refused | Database not running | Start PostgreSQL server |
Authentication failed | Wrong credentials | Check username/password |

