Execute SQL queries on PostgreSQL databases. Supports SELECT queries, DML operations, schema inspection, table and column listing, index analysis and EXPLAIN plans.
postgrespostgresqlsqldatabasequery
Input Parameters
Parameter
Type
Description
connectionrequired
object
Database connection parameters.
operationrequired
string
'query': run SELECT (sql, limit); 'execute': INSERT/UPDATE/DELETE/DDL (sql); 'databases': list all databases on server; 'schemas': list schemas in current database; 'tables': list tables in schema; 'schema': describe columns of a table (table); 'indexes': list indexes of a table (table); 'explain': query execution plan (sql, analyze); 'info': server version and stats. One of: query, execute, databases, schemas, tables, schema, indexes, explain, info.
sqloptional
string
SQL statement (required for query, execute, explain).
Discovery hint: Install with ppm install mcp-postgres or invoke remotely via POST /v1/invoke/mcp-postgres on the MCP Service.
PascalAI Usage
uses toolslib;
var Conn := JsonObj(['host','localhost','database','mydb','user','admin','password','secret']);
var Tool := LoadTool('mcp-postgres');
var R := Tool.Call(JsonObj(['connection',Conn,'operation','query','sql','SELECT COUNT(*) FROM orders']));
Writeln(R['rows'][0]['count']);