keychain_encode
Base64-encode strings for secure storage in Bitwarden vaults, enabling AI agents to manage encrypted data through the Warden MCP Server.
Instructions
Base64-encode a string (bw encode).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value | Yes |
Implementation Reference
- src/sdk/keychainSdk.ts:419-428 (handler)Implementation of the encode logic, which wraps `bw encode` to base64-encode input.
async encode(input: { value: string }): Promise<{ encoded: string }> { // `bw encode` base64-encodes stdin. const { stdout } = await this.bw.withSession(async (session) => { return this.bw.runForSession(session, ['encode'], { stdin: `${input.value}\n`, timeoutMs: 30_000, }); }); return { encoded: stdout.trim() }; } - src/tools/registerTools.ts:146-165 (registration)Registration of the keychain_encode tool (aliased as keychain.encode).
registerTool( `${deps.toolPrefix}.encode`, { title: 'Encode', description: 'Base64-encode a string (bw encode).', annotations: { readOnlyHint: true }, inputSchema: { value: z.string(), }, _meta: toolMeta, }, async (input, extra) => { const sdk = await deps.getSdk(extra.authInfo); const encoded = await sdk.encode(input); return { structuredContent: encoded, content: [{ type: 'text', text: 'OK' }], }; }, );