# store_secret

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

Built. store_secret saves a value the agent already holds, such as a key a provider just showed it, as a new BotPassword item marked agent-supplied, and returns…

**Status: Built.** Built for new items. Writing a new revision of an existing item needs a grant and the person's confirmation every time, which is not built yet, so that form answers `scope_denied` or `not_implemented` and writes nothing.

## At a glance

| Property | Value |
|---|---|
| MCP tool | `store_secret` ("Store a secret") |
| CLI | `bpw agent store_secret` |
| Default friction | None for a new item. The new item is usable by no intent until the person adds it to a grant. |
| Delivery | Write-only: the value goes into the vault and the result carries only the item reference. |
| MCP hints | `readOnlyHint`: false, `destructiveHint`: false, `idempotentHint`: false, `openWorldHint`: false |

## Parameters

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

| Name | Type | Required? | Description |
|---|---|---|---|
| `title` | string | optional | Title of the new item. 1 to 256 bytes. |
| `value` | string | required | The secret value to store. It is written to the new item and never returned. 1 to 32768 bytes. |
| `kind` | string | optional | Kind of the new item. One of `api_key`, `login`, `secure_note`, `totp`. Default `api_key`. |
| `username` | string | optional | Username or account name for the new item, if it has one. 1 to 256 bytes. |
| `site` | string | optional | A site origin or host, for example https://dash.example.com. 1 to 2048 bytes. |
| `credential` | string | optional | A credential reference (item ID), as list_credentials returns it. Not a secret value. Not empty. |

## 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": "store_secret",
    "arguments": {
      "title": "Example webhook signing key",
      "kind": "api_key",
      "site": "https://api.example.com",
      "value": "<the value the agent holds>"
    }
  }
}
```

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

```json
{
  "structuredContent": {
    "outcome": "success",
    "item": "ITEM-EXAMPLE-NEW"
  },
  "isError": false
}
```

With the CLI the value comes from stdin, never from an argument.

## From the command line

```sh
bpw agent store_secret --title 'Example webhook signing key' --kind api_key --site https://api.example.com --secret-stdin
```

`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. |
| `item` | string | The new item's reference. The item is usable by no intent until the person grants it. |

## 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.
- [`not_implemented`](/docs/outcomes/not_implemented): Policy allowed the request, and this build has no way to carry it out.
- [`scope_denied`](/docs/outcomes/scope_denied): The most common refusal.
- [`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

- Kinds are `api_key`, `login`, `secure_note` and `totp`; values are at most 32 KiB.
- Agents may store at most 100 items per 10 minutes per daemon, shared by all agents; past that the answer is `needs_human`.
- The agent-supplied mark is written into the item's notes, which the person can edit.

## Tool description

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

> Stores a secret value this agent already holds as a new BotPassword item, marked as agent-supplied; give title (and optionally kind, username, site). With credential instead, it asks to write the value as a new revision of that existing item: that needs a grant naming the item and the person's confirmation in BotPassword every time, which this build does not have yet, so it is refused (scope_denied) or answers not_implemented, and nothing is written. This tool accepts one secret value, stores it as a new item, and returns only the new item's reference. It never returns a secret value, and it changes an existing item only with a grant and the person's confirmation. The result is a typed outcome such as success, vault_locked or scope_denied.

## Related

*Status: `capture_secret` is planned, not built yet.*

- [`capture_secret`](/docs/intents/capture_secret) (planned, not built yet): is planned, not built yet.
- [`list_credentials`](/docs/intents/list_credentials): lists the credentials this agent client holds grants for, with each one's reference, kind, title, site and the intents its grant allows.
- [Intent catalog](/docs/intents), [MCP server](/docs/mcp-server), [Grants and approvals](/docs/grants-and-approvals)
