Create PostgreSQL Connection
create_postgresql_connectionValidate and save a new PostgreSQL Browser-panel connection using QGIS Authentication Manager credentials, pg_service.conf, or both, with connection modes defining required parameters.
Instructions
Validate and save a new PostgreSQL Browser-panel connection. Passwords are never accepted: credentials come from a QGIS Authentication Manager configuration, from the libpq service file (pg_service.conf), or both. connection_mode selects which parameters are required; when the user's intent is unclear, ask which mode applies before calling. endpoint_using_auth_manager: host, port, database, auth_config_id (port must be the actual database port supplied by the caller or user, this tool never assumes 5432). service_using_auth_manager: service (the name defined in pg_service.conf) and auth_config_id; database optionally overrides the service file's dbname. service_only: service; database optionally overrides dbname; do not pass auth_config_id. Parameters a mode does not use are rejected. Fails if name already exists or the database cannot be reached. ssl_mode is one of prefer (default), disable, allow, require, verify-ca, or verify-full.
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": {
"name": "<name>",
"connection_mode": "<connection_mode>"
},
"name": "create_postgresql_connection"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| host | No | ||
| name | Yes | ||
| port | No | ||
| service | No | ||
| database | No | ||
| ssl_mode | No | prefer | |
| auth_config_id | No | ||
| connection_mode | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||