Create a database
CreateDatabaseA database project, Postgres, MariaDB (for an app that asks for MySQL or MariaDB) or Valkey: the machine writes its compose.yaml and /.env and deploys it, with no address. Make it before the app that uses it: the app reaches it at the host <project_id> once linked (the app's CreateProject link_databases, which may follow at once, as its deploy waits for this one; link or LinkDatabase for an app that exists, as the apps' user and writing nothing into its /.env), and Project.database says how to sign in. Or a copy of a database's snapshot, with passwords of its own and none of its links. Answers as CreateProject does. INVALID_ARGUMENT = an engine or a size Machine.database_engines does not offer, or a project_id with "_", that is a number or that every container's /etc/hosts names (it is the host name apps use). NOT_FOUND = no such snapshot or app. FAILED_PRECONDITION = the snapshot is of no database of that engine; + DatabaseLinkRefusal = an app of link cannot be linked, and nothing was created.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "CreateDatabase"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| link | No | App project_ids, linked before its operation ends. | |
| engine | No | DATABASE_ENGINE_MARIADB: MySQL's protocol: for an app that asks for MySQL or MariaDB. | |
| metadata | No | What people see, e.g. {name: "Postgres for Recipes"}. Absent = the machine's (the id). | |
| workspace | No | The workspace: its id or name (ListWorkspaces). Omit when the account has one. | |
| project_id | No | As CreateProject's, without "_", not a number and no name of /etc/hosts: it is the host name apps use. | |
| operation_id | No | As DeployProject's operation_id. | |
| wait_seconds | No | As DeployProject's wait_seconds. | |
| from_snapshot_id | No | A snapshot of a database of `engine` (Project.snapshots, GetMachine.deleted_projects): the new one starts with its data. Empty = an empty database. | |
| memory_limit_bytes | No | One of the engine's DatabaseEngineOffer.sizes. 0 = its default_memory_limit_bytes; a copy keeps its snapshot's. |