Skip to main content
Glama
clawallex

Clawallex MCP Server

by clawallex

clawallex_refill

Add funds to a subscription card balance using wallet deduction or x402 payment methods. Check current balance first for accurate refills.

Instructions

Top up the balance of a subscription (stream) card. Only stream cards (card_type=200) can be refilled. Refill mode follows the card's creation mode.

Mode A: deducts from wallet balance. client_request_id is the idempotency key (auto-generated if omitted). Mode B: x402 settle (no 402 challenge stage) — agent must first call get_x402_payee_address to get payee_address, then construct payment_requirements.payTo from it. Requires x402_reference_id, x402_version, payment_payload, payment_requirements. Mode B idempotency key is x402_reference_id (not client_request_id).

Tip: use get_card_balance first to check current balance. Example: clawallex_refill({ card_id: 'c_123', amount: 50 })

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
card_idYesStream card ID to refill
amountYesRefill amount in USD
client_request_idNoMode A idempotency key (auto-generated if omitted)
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

  • Handler implementation for clawallex_refill tool.
      async (params) => {
        try {
          const body: Record<string, unknown> = {
            amount: params.amount.toFixed(4),
            client_request_id: params.client_request_id ?? randomUUID(),
          };
          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.payer_address !== undefined) body.payer_address = params.payer_address;
          const result = await client.post<unknown>(
            `/payment/cards/${params.card_id}/refill`,
            body,
          );
          return toolOk(result);
        } catch (err) {
          return toolError(err);
        }
      },
    );
  • Registration of the clawallex_refill tool, including its description and input schema.
    server.tool(
      "clawallex_refill",
      [
        "Top up the balance of a subscription (stream) card.",
        "Only stream cards (card_type=200) can be refilled. Refill mode follows the card's creation mode.",
        "",
        "Mode A: deducts from wallet balance. client_request_id is the idempotency key (auto-generated if omitted).",
        "Mode B: x402 settle (no 402 challenge stage) — agent must first call get_x402_payee_address to get payee_address,",
        "  then construct payment_requirements.payTo from it. Requires x402_reference_id, x402_version, payment_payload, payment_requirements.",
        "  Mode B idempotency key is x402_reference_id (not client_request_id).",
        "",
        "Tip: use get_card_balance first to check current balance.",
        "Example: clawallex_refill({ card_id: 'c_123', amount: 50 })",
      ].join("\n"),
      {
        card_id: z.string().describe("Stream card ID to refill"),
        amount: z.number().describe("Refill amount in USD"),
        client_request_id: z.string().max(64).describe("Mode A idempotency key (auto-generated if omitted)").optional(),
        ...x402Fields,
      },
Behavior5/5

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

With zero annotations provided, the description carries full behavioral disclosure burden excellently. Explains Mode A deducts from wallet, Mode B uses x402 settle without 402 challenge, differing idempotency key behaviors per mode, and auto-generation rules. No contradictions.

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: core purpose → restriction → Mode A logic → Mode B logic → prerequisite tip → concrete example. Every sentence serves a distinct purpose; complex dual-mode logic is explained without redundancy.

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?

Given high complexity (8 params, 2 distinct payment modes, nested objects) and lack of annotations/output schema, the description comprehensively covers invocation logic and behavioral traits. Minor gap: does not describe return values or success indicators, though this is partially mitigated by the explicit example showing expected input format.

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?

Despite 100% schema coverage (baseline 3), adds significant workflow context: explains Mode B requires constructing payment_requirements.payTo from the payee_address, clarifies that x402_reference_id serves as the idempotency key in Mode B (distinct from client_request_id), and maps parameters to their respective modes.

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?

Opens with specific verb+resource ('Top up the balance of a subscription (stream) card') and immediately distinguishes from sibling tool 'refill_card' via the restriction 'Only stream cards (card_type=200) can be refilled', clearly scoping the tool's domain.

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

Usage Guidelines4/5

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

Explicitly names prerequisite tools ('use get_card_balance first', 'must first call get_x402_payee_address') and describes Mode A vs Mode B selection criteria. Deducts one point for not explicitly contrasting with sibling 'refill_card' for non-stream cards, though the card_type restriction implies this scope.

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