b2_create_key
Create a scoped B2 application key with least-privilege capabilities, routing the one-time secret through the configured secret sink for secure credential management.
Instructions
Create a B2 application key and route its one-time secret through the configured secret sink. Use for least-privilege scoped credentials; use b2_list_keys to inspect existing keys and b2_delete_key to revoke retired keys. Requires writeKeys, idempotencyKey, and destructive confirmation by policy. File sink mode returns redacted metadata plus a secretSink pointer; inline mode returns the secret only when explicitly enabled. Policy refuses key-management grants and unscoped write/delete grants unless explicit environment overrides are enabled; when B2_MAX_KEY_DURATION_SECONDS is set, it also refuses non-expiring keys or durations above that limit.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No | Fallback confirmation for this durable credential creation when the effective server destructive policy is 'confirm' and MCP elicitation cannot run. | |
| keyName | Yes | Human-readable key name for audits and b2_list_keys output. | |
| bucketId | No | Deprecated single-bucket restriction. Use bucketIds for new integrations; do not provide both. | |
| bucketIds | No | Optional bucket ID restrictions. Required by default for keys with write*/delete* capabilities; omit only for intentional account-wide access, and do not combine with bucketId. | |
| namePrefix | No | Optional file-name prefix restriction for file capabilities; omit for no prefix restriction. | |
| capabilities | Yes | B2 capabilities to grant. They must be allowed by the creating key; listKeys/writeKeys/deleteKeys are refused unless B2_ALLOW_KEY_MGMT_GRANTS=true. | |
| idempotencyKey | Yes | Caller-generated idempotency key. Reuse the same value only for an identical retry by the same caller; conflicting reuse is rejected. | |
| validDurationInSeconds | No | Optional positive key lifetime in seconds. Omit for no expiration only when B2_MAX_KEY_DURATION_SECONDS is not configured. |