Skip to main content
Glama
clawallex

Clawallex MCP Server

by clawallex

clawallex_subscribe

Create a reloadable virtual card for managing recurring subscription payments, with options for wallet-based or on-chain funding.

Instructions

Set up a reloadable virtual card for recurring/subscription payments. Creates a stream card (card_type=200) that stays active and can be refilled via clawallex_refill.

Mode A (mode_code=100, default): wallet balance → stream card. Immediate settlement. Mode B (mode_code=200): for callers with self-custody wallets — signing is performed by the caller. Same x402 two-stage flow as clawallex_pay. The 402 response is EXPECTED (a quote, not an error). See clawallex_pay for full Stage 1/2 details.

Fee structure: fee_amount = issue_fee_amount + monthly_fee_amount + fx_fee_amount.

Example: clawallex_subscribe({ initial_amount: 100, description: 'AWS monthly billing' })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
initial_amountYesInitial deposit in USD
descriptionYesSubscription purpose
mode_codeNo100=wallet (default), 200=x402 on-chain
tx_limitNoPer-transaction limit in USD (optional, default 100.0000)
allowed_mccNoMCC whitelist, comma-separated (optional, e.g. '5734,5815')
blocked_mccNoMCC blacklist, comma-separated (optional, e.g. '7995')
client_request_idNoUUID idempotency key (<=64 chars). Mode B Stage 2: MUST reuse from Stage 1.
chain_codeNoChain code for Mode B Stage 1 (e.g. 'ETH')
token_codeNoToken code for Mode B Stage 1 (e.g. 'USDC')
extraNoMode B Stage 2 (required): { card_amount, paid_amount }
x402_reference_idNox402 reference ID. Card creation Stage 1: optional (server generates if omitted). Stage 2: use value from 402 response. Refill Mode B: required, serves as idempotency key.
x402_versionNox402 version (Mode B Stage 2, required)
payment_payloadNox402 payment payload (Mode B Stage 2, required)
payment_requirementsNox402 payment requirements (Mode B Stage 2, required)
payer_addressNoPayer wallet address (optional, final value from verify)

Implementation Reference

  • The registration and handler implementation for the 'clawallex_subscribe' tool. It sets up a subscription card (card_type=200) and handles Mode A (wallet) or Mode B (x402) payment workflows.
    server.tool(
      "clawallex_subscribe",
      [
        "Set up a reloadable virtual card for recurring/subscription payments.",
        "Creates a stream card (card_type=200) that stays active and can be refilled via clawallex_refill.",
        "",
        "Mode A (mode_code=100, default): wallet balance → stream card. Immediate settlement.",
        "Mode B (mode_code=200): for callers with self-custody wallets — signing is performed by the caller. Same x402 two-stage flow as clawallex_pay.",
        "  The 402 response is EXPECTED (a quote, not an error). See clawallex_pay for full Stage 1/2 details.",
        "",
        "Fee structure: fee_amount = issue_fee_amount + monthly_fee_amount + fx_fee_amount.",
        "",
        "Example: clawallex_subscribe({ initial_amount: 100, description: 'AWS monthly billing' })",
      ].join("\n"),
      {
        initial_amount: z.number().describe("Initial deposit in USD"),
        description: z.string().describe("Subscription purpose"),
        mode_code: z.number().int().describe("100=wallet (default), 200=x402 on-chain").optional(),
        tx_limit: z.string().describe("Per-transaction limit in USD (optional, default 100.0000)").optional(),
        allowed_mcc: z.string().describe("MCC whitelist, comma-separated (optional, e.g. '5734,5815')").optional(),
        blocked_mcc: z.string().describe("MCC blacklist, comma-separated (optional, e.g. '7995')").optional(),
        client_request_id: z.string().max(64).describe("UUID idempotency key (<=64 chars). Mode B Stage 2: MUST reuse from Stage 1.").optional(),
        chain_code: z.string().describe("Chain code for Mode B Stage 1 (e.g. 'ETH')").optional(),
        token_code: z.string().describe("Token code for Mode B Stage 1 (e.g. 'USDC')").optional(),
        extra: z.record(z.unknown()).describe("Mode B Stage 2 (required): { card_amount, paid_amount }").optional(),
        ...x402Fields,
      },
      async (params) => {
        try {
          const modeCode = params.mode_code ?? 100;
          if (modeCode === 200) {
            const hasX402 = params.x402_version !== undefined || params.payment_payload !== undefined || params.payment_requirements !== undefined;
            if (hasX402) {
              const missing: string[] = [];
              if (params.x402_version === undefined) missing.push("x402_version");
              if (params.payment_payload === undefined) missing.push("payment_payload");
              if (params.payment_requirements === undefined) missing.push("payment_requirements");
              if (params.extra === undefined) missing.push("extra (must include card_amount and paid_amount)");
              if (missing.length > 0) {
                return { content: [{ type: "text" as const, text: `Mode B Stage 2 missing required fields: ${missing.join(", ")}.` }], isError: true as const };
              }
            } else {
              if (!params.chain_code || !params.token_code) {
                return { content: [{ type: "text" as const, text: "Mode B Stage 1 requires chain_code and token_code." }], isError: true as const };
              }
            }
          }
    
          const body: Record<string, unknown> = {
            mode_code: modeCode,
            card_type: 200,
            amount: params.initial_amount.toFixed(4),
            client_request_id: params.client_request_id ?? randomUUID(),
          };
          if (params.tx_limit) body.tx_limit = params.tx_limit;
          if (params.allowed_mcc) body.allowed_mcc = params.allowed_mcc;
          if (params.blocked_mcc) body.blocked_mcc = params.blocked_mcc;
          if (params.chain_code) body.chain_code = params.chain_code;
          if (params.token_code) body.token_code = params.token_code;
          if (params.x402_reference_id !== undefined) body.x402_reference_id = params.x402_reference_id;
          if (params.x402_version !== undefined) body.x402_version = params.x402_version;
          if (params.payment_payload !== undefined) body.payment_payload = params.payment_payload;
          if (params.payment_requirements !== undefined) body.payment_requirements = params.payment_requirements;
          if (params.extra !== undefined) body.extra = params.extra;
          if (params.payer_address !== undefined) body.payer_address = params.payer_address;
    
          const result = await client.post<unknown>("/payment/card-orders", body);
          return toolOk({
            ...(result as Record<string, unknown>),
            _hint: `Stream card created for: ${params.description}. Use clawallex_refill when balance is low.`,
          });
        } catch (err) {
          if (err instanceof ClawallexApiError && err.statusCode === 402 && err.details) {
            return formatX402Quote(err.details as Record<string, unknown>);
          }
          return toolError(err);
        }
      },
    );
Behavior5/5

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

No annotations provided, so description carries full burden. Discloses critical behavioral traits: fee structure formula (issue + monthly + fx), card persistence ('stays active'), and Mode B's expected 402 response ('EXPECTED (a quote, not an error)'). Explains settlement differences between modes (immediate vs two-stage).

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 but well-structured: purpose statement → mode differentiation → fee disclosure → example. No redundant text despite 15-parameter complexity. Front-loaded with core concept before diving into technical modes.

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

Completeness4/5

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

Excellent coverage for complex tool with nested objects and dual-mode operation. Addresses financial transparency (fees) and protocol specifics (x402). Lacks explicit description of return values, though no output schema exists to mandate this. References sibling tools appropriately rather than duplicating x402 documentation.

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 coverage is 100% providing baseline 3. Description adds value by providing concrete example (initial_amount: 100), clarifying Mode B workflow requirements ('client_request_id: MUST reuse from Stage 1'), and explaining x402 reference ID usage across stages. Elevates above baseline but doesn't fully elaborate on all 15 parameters.

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 'Set up a reloadable virtual card for recurring/subscription payments' with specific resource (stream card/card_type=200). Clearly distinguishes from siblings by referencing clawallex_refill for refilling and clawallex_pay for x402 flow details, establishing distinct responsibility.

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 defines when to use ('recurring/subscription payments') versus alternatives. Delineates Mode A (wallet) vs Mode B (self-custody/x402) usage patterns. References clawallex_pay for Stage 1/2 details, providing clear navigation between related tools.

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