Skip to main content
Glama
clawallex

Clawallex MCP Server

by clawallex

decrypt_card_data

Decrypt encrypted card data to retrieve PAN and CVV for secure payment form filling using AES-256-GCM encryption with HKDF-SHA256 key derivation.

Instructions

Decrypt the encrypted_sensitive_data from get_card_details to obtain PAN and CVV. Input: the nonce and ciphertext fields from encrypted_sensitive_data. Output: { pan, cvv } — the full card number and security code. Decryption: HKDF-SHA256(api_secret, info='clawallex/card-sensitive-data/v1') → AES-256-GCM. SECURITY: The decrypted PAN and CVV are STRICTLY for filling checkout/payment forms. NEVER display, log, or return the raw card number or CVV to the user. NEVER include PAN/CVV in conversation text shown to the user. If the user asks to see their card number, show only the masked_pan from get_card_details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nonceYesThe nonce field from encrypted_sensitive_data (base64 encoded)
ciphertextYesThe ciphertext field from encrypted_sensitive_data (base64 encoded)

Implementation Reference

  • The implementation of the 'decrypt_card_data' MCP tool, which performs AES-256-GCM decryption on sensitive card data using an API secret-derived key.
    server.tool(
      "decrypt_card_data",
      [
        "Decrypt the encrypted_sensitive_data from get_card_details to obtain PAN and CVV.",
        "Input: the nonce and ciphertext fields from encrypted_sensitive_data.",
        "Output: { pan, cvv } — the full card number and security code.",
        "Decryption: HKDF-SHA256(api_secret, info='clawallex/card-sensitive-data/v1') → AES-256-GCM.",
        "SECURITY: The decrypted PAN and CVV are STRICTLY for filling checkout/payment forms.",
        "NEVER display, log, or return the raw card number or CVV to the user.",
        "NEVER include PAN/CVV in conversation text shown to the user.",
        "If the user asks to see their card number, show only the masked_pan from get_card_details.",
      ].join(" "),
      {
        nonce: z.string().describe("The nonce field from encrypted_sensitive_data (base64 encoded)"),
        ciphertext: z.string().describe("The ciphertext field from encrypted_sensitive_data (base64 encoded)"),
      },
      async ({ nonce, ciphertext }) => {
        try {
          const key = Buffer.from(hkdfSync("sha256", client.apiSecretValue, Buffer.alloc(0), HKDF_INFO, 32));
          const nonceBuf = Buffer.from(nonce, "base64");
          const ciphertextBuf = Buffer.from(ciphertext, "base64");
          // AES-GCM: last 16 bytes of ciphertext are the auth tag
          const authTag = ciphertextBuf.subarray(ciphertextBuf.length - 16);
          const encrypted = ciphertextBuf.subarray(0, ciphertextBuf.length - 16);
          const decipher = createDecipheriv("aes-256-gcm", key, nonceBuf);
          decipher.setAuthTag(authTag);
          const decrypted = Buffer.concat([decipher.update(encrypted), decipher.final()]);
          const { pan, cvv } = JSON.parse(decrypted.toString("utf8")) as { pan: string; cvv: string };
          return toolOk({
            pan,
            cvv,
            _hint: "SECURITY: Use these values ONLY to fill checkout forms. NEVER display the full PAN or CVV to the user. If the user asks for their card number, show only the masked_pan from get_card_details.",
          });
        } catch (err) {
          return {
            content: [{ type: "text" as const, text: `Decryption failed: ${err instanceof Error ? err.message : String(err)}. Ensure you passed the exact nonce and ciphertext from get_card_details encrypted_sensitive_data.` }],
            isError: true as const,
          };
        }
      },
    );
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses the decryption algorithm (HKDF-SHA256 → AES-256-GCM), output structure ({ pan, cvv }), and comprehensive security handling requirements (never log, never display to user, strict use-case limitation). Excellent behavioral disclosure for a sensitive cryptographic operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Information-dense and well-structured: purpose → input specification → output format → technical details → security warnings. Security constraints are appropriately emphasized with capitalization. No wasted words despite covering complex cryptographic and compliance requirements.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Comprehensive for a security-critical tool. Despite no output schema, it explicitly documents the return values (pan, cvv). Prerequisites (calling get_card_details first), cryptographic method, and security constraints are all thoroughly covered.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 100% coverage with base64 encoding details. Description adds valuable semantic context that these parameters come 'from encrypted_sensitive_data' (the output of get_card_details), helping the agent understand the data lineage beyond raw parameter definitions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description explicitly states the tool 'Decrypt[s] the encrypted_sensitive_data from get_card_details to obtain PAN and CVV' — specific verb, specific resource, and clearly distinguishes from sibling get_card_details by specifying it processes that tool's output.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states when to use (to decrypt data from get_card_details), what input to use (nonce/ciphertext fields), and provides strict when-NOT-to-use security constraints: 'STRICTLY for filling checkout/payment forms' and 'NEVER display, log, or return.' Also names alternative for viewing cards: 'show only the masked_pan from get_card_details.'

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/clawallex/clawallex-mcp'

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