Skip to main content
Glama

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
NameRequiredDescriptionDefault
valueYes

Implementation Reference

  • 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() };
    }
  • 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' }],
        };
      },
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/icoretech/warden-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server