---
title: "corestack_external_db_user_password_rotate"
url: https://docs.corefinity.com/mcp/tools/corestack_external_db_user_password_rotate
type: tool
last_updated: 2026-11-13
feature: database
related:
  - https://docs.corefinity.com/api/reference/database/rotate-site-database-user-password.md
  - https://docs.corefinity.com/guides/sites/database/database-users.md
---
# corestack_external_db_user_password_rotate

**Rotate a database user's password.** Give a database user a new password, generated (shown once, in the person's browser) or chosen. The old one stops working as soon as the change applies: update the tool that uses it straight after. Scope: write. Also needs exec when reveal_to_agent is true. Long-running: answers with a task. The secret opens in the person's browser; set reveal_to_agent to true to receive it yourself (needs exec).

- Scope: `write`
- Also needs `exec` when a generated password
- Runs as a task: yes
- Returns a secret only when `reveal_to_agent` is set

## When to use it

Give a database user a new password: when it may have leaked, when a person who knew it leaves, or when a generated password was lost (it is shown only once). The old password stops working as soon as the change applies, so update the tool that uses it straight after; open sessions keep working until they reconnect.

Send your own password (`{"mode": "set", "value": ...}`) or let the Control Panel make one (`{"mode": "generate"}`), shown once in the person's browser, or given to you with exec and `reveal_to_agent: true` when the task completes. `application`, the site's own login, is never rotated here.

## Inputs

- `site_id` (integer, ≥ 1, required)
- `username` (string, required): the user's name from corestack_external_db_get.
- `password` (object, required): `{"mode": "generate"}`, or `{"mode": "set", "value": "..."}` with 12 to 64 printable ASCII characters and no quotes, backticks or backslashes.
- `reveal_to_agent` (boolean, default `false`): Return the secret to you instead of opening it in the person's browser. Needs exec.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "password": {
      "additionalProperties": false,
      "properties": {
        "mode": {
          "description": "generate: 24 characters made for you and shown once in the person's browser; set: your own `value`.",
          "enum": [
            "generate",
            "set"
          ],
          "type": "string"
        },
        "value": {
          "description": "With mode set: 12 to 64 printable ASCII characters, no quotes, backticks or backslashes.",
          "type": "string"
        }
      },
      "required": [
        "mode"
      ],
      "type": "object"
    },
    "reveal_to_agent": {
      "default": false,
      "description": "Return the secret to you instead of opening it in the person's browser. Needs exec.",
      "type": "boolean"
    },
    "site_id": {
      "minimum": 1,
      "type": "integer"
    },
    "username": {
      "maxLength": 128,
      "minLength": 1,
      "type": "string"
    }
  },
  "required": [
    "site_id",
    "username",
    "password"
  ],
  "type": "object"
}
```

## Refusals

- `user_not_found`: no user of that name on this environment that can be changed here.
- `invalid_arguments`: the password breaks its rules; `fields` names it.
- `busy`: another change to this environment is applying.
- `deleted`: the site is deleted (in its grace period).
- `provisioning`: the site is still being created.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_external_db_user_password_rotate",
  "arguments": {
    "site_id": 4211,
    "username": "reporting_ro",
    "password": {
      "mode": "generate"
    }
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_external_db_user_password_rotate with site_id 4211, username reporting_ro, password {"mode":"generate"}. (Rotate a database user's password.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [POST /api/corestack/sites/{site}/database/users/{username}/password](https://docs.corefinity.com/api/reference/database/rotate-site-database-user-password.md)
- Guide: [Database users](https://docs.corefinity.com/guides/sites/database/database-users.md)
