add_app_database
Provision a managed Postgres database for an app + publish
DATABASE_URL into the app's env automatically.
M1 behavior:
Verify caller owns the app
POST to libvirt :8001 /api/app-infra/databases to allocate the DB (stub mode by default — no real Postgres VM needed for M1)
PUT DATABASE_URL into the app's env via the producer API (the password never crosses MCP back to the caller)
Append db_id to App.db_refs
Return {db_id, status, env_keys, env_published}
When OPENFACTORY_DB_PRODUCER_TOKEN is unset, step 3 is skipped and
the connection URL is returned in the response — the caller must
publish it manually via set_app_env(app_id, set={'DATABASE_URL': ...}).
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": {
"app_id": "<app_id>"
},
"name": "add_app_database"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_id | Yes | App ID (UUID from create_app). | |
| engine | No | DB engine. M1 supports 'postgres' only; MySQL+Redis are M3. | postgres |
| api_key | No | MCP API key | |
| session_token | No | Session token |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||