Databases
Connect a public PostgreSQL or MySQL database in read-only mode. Platica creates 4 tools: list tables, read columns, run SELECT queries, and paginate results. Connect the tools to the agents that need them.
Quick example
# 1. Connect the database (it is born enabled with its 4 tools in tools[])
curl -X POST https://api.platic.ai/v1/tools/databases \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "store",
"engine": "postgres",
"host": "db.example.com",
"database": "store",
"user": "readonly",
"password": "your-db-password",
"hiddenColumns": ["customers.phone"]
}'
# 2. Test the connection
curl -X POST https://api.platic.ai/v1/tools/databases/$DB_ID/test \
-H "Authorization: Bearer $PLATIC_API_KEY" // 1. Connect the database (the password is stored encrypted as a secret)
const db = await platic.tools.databases.create({
name: 'store',
description: 'Orders and customers of the online store.',
connectionString: process.env.STORE_DATABASE_URL!,
hiddenColumns: ['customers.phone']
});
// 2. Test the connection and connect the query tool to your agent
const test = await platic.tools.databases.test(db.id);
if (test.connected) {
const queryTool = db.tools.find((t) => t.tool === 'query')!;
await platic.agents.tools.connect(agentId, queryTool.id);
} What you need to know
- Read-only: it runs one
SELECTper query in a read-only transaction. Use a read-only database user too. - Hidden data:
hiddenTablesandhiddenColumnshide the selected tables and columns. On a table with hidden columns, select the columns instead of usingSELECT *. - Secure password: it goes in
password,connectionString, orpasswordSecretIdand is never returned. If you change the host, port, or SSL, it goes toneeds_authorizationand you must send it again. - Public hosts and Supabase: local and private hosts are rejected. On Supabase use the Session pooler (the direct connection only uses IPv6).
- Limits: 20 connections per workspace, 1 to 200 rows per page (
50by default), 1 to 30 s timeout (5s by default), 500 hidden tables/columns, and 10,000 characters per query. - Permissions: requires Integrations (and write permission with OAuth to create, change, or query).
Warning
Platica does not connect from a fixed IP yet; if your database filters by an IP allowlist, the connection will be rejected.
Endpoints
| Method | Endpoint | What it does |
|---|---|---|
GET / POST | /v1/tools/databases | List, or connect, a database |
GET / PATCH / DELETE | /v1/tools/databases/{databaseId} | Get, update, or delete |
POST | /v1/tools/databases/{databaseId}/test | Test the connection |
GET | /v1/tools/databases/{databaseId}/schema | See tables and columns |
POST | /v1/tools/databases/{databaseId}/query | Run a SELECT or ask for the next page |
POST | /v1/tools/databases/{databaseId}/enable | Enable, or pause, the connection |
Errors are in Errors and AI tools in Databases MCP.