Connect database
connect_databaseOpen a SQLite file or PostgreSQL database for a new or replacement connection, then discover its schema; reusing an alias replaces that connection.
Instructions
Open a SQLite file or PostgreSQL database, then discover its schema. Use only for a new or replacement connection. An existing alias is replaced. SQLite paths are resolved on the server host. For PostgreSQL use a dedicated read-only role and pass the password's environment variable name, never its value. Non-local hosts require operator opt-in. Returns connection details, database version, whether a test write was refused, schema and generated-tool counts. The write probe is a diagnostic. Use list_connections to find existing aliases.
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>"
},
"name": "connect_database"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | No | PostgreSQL hostname. Defaults to localhost. | |
| port | No | PostgreSQL port. Defaults to 5432. | |
| alias | No | Connection name. Reusing it replaces that connection. | main |
| backend | No | 'sqlite' or 'postgresql' | sqlite |
| sslmode | No | PostgreSQL TLS mode, e.g. verify-full. Optional. | |
| database | Yes | SQLite file on the server host, or PostgreSQL database name. | |
| username | No | PostgreSQL role name. Use a dedicated read-only role. | |
| password_env | No | Server environment variable name holding the PostgreSQL password. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||