# fill_totp

Source: https://botpassword.com/docs/intents/fill_totp

Built. fill_totp computes the current one-time code from a granted TOTP seed inside BotPassword and fills it into the code field at the granted site.

**Status: Built.** Built over CDP and through the paired extension, with the same origin checks as `sign_in`. Disclosing; a sealed fill is planned, not built yet.

## At a glance

| Property | Value |
|---|---|
| MCP tool | `fill_totp` ("Fill a one-time code") |
| CLI | `bpw agent fill_totp` |
| Default friction | None inside a grant for that site that allows disclosure. |
| Delivery | Disclosing, as for `sign_in`: the page, and over CDP the agent, can read the filled code. |
| MCP hints | `readOnlyHint`: false, `destructiveHint`: false, `idempotentHint`: false, `openWorldHint`: true |

## Parameters

Required: `credential`, `site`. Unknown arguments are refused. The descriptions are the tool's own, as `bpw mcp` serves them.

| Name | Type | Required? | Description |
|---|---|---|---|
| `credential` | string | required | A credential reference (item ID), as list_credentials returns it. Not a secret value. Not empty. |
| `site` | string | required | A site origin or host, for example https://dash.example.com. 1 to 2048 bytes. |
| `cdp` | string | optional | The Chrome DevTools endpoint of the browser you drive, on this machine: http://127.0.0.1:PORT (or [::1]) or ws://127.0.0.1:PORT/devtools/browser/ID. BotPassword connects to it itself. 1 to 256 bytes. |
| `target` | string | optional | With cdp: the tab to fill, by its DevTools target ID. Without it, the one tab whose page is at the site. 1 to 64 bytes. Matches `^[A-Za-z0-9-]+$`. |
| `tab` | integer | optional | Without cdp: the tab to fill in the person's browser, by the extension's tab ID. Without it, the one tab whose page is at the site. 0 to 2147483647. |
| `submit` | boolean | optional | Submit the form after filling it (default false). |

## Example

A `tools/call` request, with placeholder references (use the `id` that `list_credentials` returns):

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "fill_totp",
    "arguments": {
      "credential": "ITEM-EXAMPLE-03",
      "site": "https://dash.example.com",
      "cdp": "http://127.0.0.1:9222",
      "submit": true
    }
  }
}
```

The result. The same JSON is also sent as text in `content[0].text`; `isError` is false for `success`.

```json
{
  "structuredContent": {
    "outcome": "success",
    "site": "https://dash.example.com",
    "fields": [
      "one_time_code"
    ],
    "submitted": true,
    "delivery": "disclosing"
  },
  "isError": false
}
```

## From the command line

```sh
bpw agent fill_totp --credential ITEM-EXAMPLE-03 --site https://dash.example.com --cdp http://127.0.0.1:9222 --submit
```

`bpw agent <intent>` sends the same request as the MCP tool, through the same policy. Every intent except `status` needs a live agent session, or the answer is `session_required`. Run the harness with `bpw agent run -- <harness>`. On macOS and Linux, an enrolled harness started normally can also be approved in the desktop app or with `bpw session approve`.

## Result fields

Every result is one JSON object. Only `outcome` is always present.

| Field | Type | Meaning |
|---|---|---|
| `outcome` | string | The [typed outcome](/docs/outcomes) code. Always present. |
| `detail` | string | The request ID, rotation step, revision or reason, for the outcomes that carry one. |
| `intent` | string | With `not_implemented`: the intent this build cannot carry out. |
| `reason` | string | With `rejected`: why the call was refused. |
| `message` | string | With `rejected` or `daemon_unavailable`: what was wrong. Never quotes an argument value. |
| `next_step` | string | On a result that is not a plain success: one sentence on what to do now. Fixed text chosen by the outcome code; it never asks for a password or secret and never says to get around a refusal. |
| `site` | string | The canonical origin the result is about. |
| `fields` | array | The fields filled. Never their values. |
| `submitted` | boolean | Whether the form was submitted. Not whether the site accepted it. |
| `delivery` | string | `sealed` or `disclosing`: whether code the agent controls could read the value. One of `disclosing`, `sealed`. |

## Outcomes it can return

- [`success`](/docs/outcomes/success): The request ran.
- [`needs_human`](/docs/outcomes/needs_human): Something only a person can do stands in the way.
- [`scope_denied`](/docs/outcomes/scope_denied): The most common refusal.
- [`disclosure_not_granted`](/docs/outcomes/disclosure_not_granted): The request would let code the agent controls read the value (`run_with` with `env` or `files`, `cli_login`, `sign_in`, `fill_totp`), and the grant does not allow disclosure.
- [`grant_expired`](/docs/outcomes/grant_expired): A grant names this credential for this client, but its lifetime is over.
- [`unknown_outcome`](/docs/outcomes/unknown_outcome): A step ended in a way that does not show whether it took effect: a request timed out after it was sent, a connection dropped, or the extension had the value and did not report back.
- [`session_required`](/docs/outcomes/session_required): The call did not come from inside a live agent session: none was presented, it expired, or it is malformed.
- [`vault_locked`](/docs/outcomes/vault_locked): BotPassword on this device is locked, so no credential can be used.
- [`rejected`](/docs/outcomes/rejected): The request was malformed before policy saw it.
- [`daemon_unavailable`](/docs/outcomes/daemon_unavailable): `bpw mcp` or `bpw agent` could not reach `botpasswordd`, the desktop daemon that holds the keys.

See the [outcome reference](/docs/outcomes) for what each one means and what to do next.

## Limits

- Granting both a password and its TOTP seed with disclosure gives the agent full account access; the approval sheet labels it that way.
- The same browser limits as `sign_in` apply.

## Tool description

What the MCP tool tells the agent, verbatim from `bpw mcp`:

> Computes the current one-time code from a granted seed inside BotPassword and fills it into the code field at site, in the browser you drive over the Chrome DevTools Protocol (give cdp) or, without cdp, in the person's own browser through the paired BotPassword extension, with the same origin checks as sign_in. The fill is disclosing: the grant must allow disclosure. The result names the field filled, never the code. This tool never accepts or returns secret values. The result is a typed outcome such as success, vault_locked or scope_denied.

## Related

- [`sign_in`](/docs/intents/sign_in): fills a granted login's username and password into the sign-in form at a site, only in a frame whose origin, and every frame above it, is exactly the granted site.
- [Intent catalog](/docs/intents), [MCP server](/docs/mcp-server), [Grants and approvals](/docs/grants-and-approvals)
