Back to home
Connect a client

Create a database token

Issue a token for connecting to the database from outside HCode (psql on a laptop, another host) and return its connection string once. It works only while external access is on (updateDatabaseExternalAccess), which exposes the database on the internet. An app running on HCode does not need a token: use attachDatabase. Save the token ID if you need to revoke it later.

Clients are told this tool can remove, overwrite or interrupt resources, or grant access. Set your client to ask before it runs it.

Arguments

NameTypeRequiredLimits
labelstringNoSee schema
expiresIn"1h" | "24h" | "7d" | "30d" | "never"YesSee schema
projectIdstringYesAt least 1 character(s)
databaseIdstringYesAt least 1 character(s)
Full input schema
{
  "type": "object",
  "properties": {
    "label": {
      "type": "string"
    },
    "expiresIn": {
      "type": "string",
      "enum": [
        "1h",
        "24h",
        "7d",
        "30d",
        "never"
      ]
    },
    "projectId": {
      "type": "string",
      "minLength": 1
    },
    "databaseId": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "projectId",
    "databaseId",
    "expiresIn"
  ],
  "additionalProperties": false
}

Example call

The params of a tools/call request. Replace the placeholder values with your own IDs.

{
  "name": "createDatabaseToken",
  "arguments": {
    "projectId": "REPLACE_WITH_PROJECT_ID",
    "databaseId": "REPLACE_WITH_DATABASE_ID",
    "expiresIn": "1h"
  }
}

Result

The same data as the API operation, wrapped as {"untrusted_data": true, "source": "createDatabaseToken", "note": "...", "data": ...} so the model treats project content as data, not instructions.