Skip to main content
Glama

send_payment

Send USDC payments to any Ethereum address. A 2% service fee is deducted from your wallet. Confirm amount and recipient before calling.

Instructions

Send a USDC payment to any Ethereum address. A 2% service fee is deducted automatically from your wallet. Confirm amount and recipient with the user before calling.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesRecipient Ethereum address (0x-prefixed, 42 chars)
amountYesUSDC amount as string, e.g. "2.50"
memoNoOptional note for the payment
idempotencyKeyNoOptional key to prevent duplicate payments on retry

Implementation Reference

  • src/index.ts:134-156 (registration)
    Registration of the send_payment tool on the MCP server with description and schema
    // Tool 3: Send Payment
    server.tool(
      "send_payment",
      "Send a USDC payment to any Ethereum address. A 2% service fee is deducted automatically from your wallet. Confirm amount and recipient with the user before calling.",
      {
        to: z.string().describe("Recipient Ethereum address (0x-prefixed, 42 chars)"),
        amount: z.string().describe('USDC amount as string, e.g. "2.50"'),
        memo: z.string().optional().describe("Optional note for the payment"),
        idempotencyKey: z.string().optional().describe("Optional key to prevent duplicate payments on retry"),
      },
      async ({ to, amount, memo, idempotencyKey }) => {
        try {
          const body: Record<string, unknown> = { to, amount, currency: "USDC" };
          if (memo) body.memo = memo;
          if (idempotencyKey) body.idempotencyKey = idempotencyKey;
          const res = await callApi("POST", "/payments", body);
          if (!res.ok) return errorResponse("Payment failed", res);
          return successResponse(res.json);
        } catch (e) {
          return { content: [{ type: "text" as const, text: `Payment error: ${e}` }], isError: true };
        }
      },
    );
  • Handler function that sends a USDC payment to an Ethereum address via POST /payments API endpoint
    async ({ to, amount, memo, idempotencyKey }) => {
      try {
        const body: Record<string, unknown> = { to, amount, currency: "USDC" };
        if (memo) body.memo = memo;
        if (idempotencyKey) body.idempotencyKey = idempotencyKey;
        const res = await callApi("POST", "/payments", body);
        if (!res.ok) return errorResponse("Payment failed", res);
        return successResponse(res.json);
      } catch (e) {
        return { content: [{ type: "text" as const, text: `Payment error: ${e}` }], isError: true };
      }
    },
  • Zod schema defining input parameters: to (Ethereum address), amount (USDC string), memo (optional), idempotencyKey (optional)
    {
      to: z.string().describe("Recipient Ethereum address (0x-prefixed, 42 chars)"),
      amount: z.string().describe('USDC amount as string, e.g. "2.50"'),
      memo: z.string().optional().describe("Optional note for the payment"),
      idempotencyKey: z.string().optional().describe("Optional key to prevent duplicate payments on retry"),
    },
  • Helper function used by send_payment handler to make the HTTP POST request to /payments endpoint
    async function callApi(
      method: "GET" | "POST",
      path: string,
      body?: Record<string, unknown>,
      auth = true,
    ): Promise<ApiResult> {
      if (auth && !API_KEY) {
        return {
          ok: false,
          status: 401,
          json: {
            error: "config_missing",
            message: "CARDZERO_API_KEY is not set. Get one at https://cardzero.ai",
          },
        };
      }
    
      const headers: Record<string, string> = {};
      if (auth) headers["Authorization"] = `Bearer ${API_KEY}`;
      if (body) headers["Content-Type"] = "application/json";
    
      const res = await fetch(`${API_URL}${path}`, {
        method,
        headers,
        body: body ? JSON.stringify(body) : undefined,
      });
    
      const json = await res.json() as Record<string, unknown>;
      return { ok: res.ok, status: res.status, json };
    }
Behavior3/5

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

With no annotations, the description must disclose behavior. It mentions the automatic 2% service fee deduction, but does not cover return types, gas costs, or reversibility. Some transparency, but incomplete.

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?

Two concise sentences. First states purpose, second adds fee and confirmation instructions. No unnecessary words; each sentence adds value.

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

Completeness2/5

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

Given no output schema and no annotations, the description should explain return values or side effects. It does not mention what the tool returns (e.g., transaction hash) or any network-related details, leaving important gaps.

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

Parameters3/5

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

Schema coverage is 100%, so baseline is 3. The description adds the confirmation guidance but does not add meaning beyond the schema's parameter descriptions.

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?

The description clearly states it sends a USDC payment to any Ethereum address. The verb 'Send' and resource 'USDC payment' are specific, and it distinguishes from siblings like 'pay_x402' and read-only tools like 'get_payment'.

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?

The description instructs to confirm amount and recipient with the user before calling, providing clear usage guidance. However, it does not explicitly differentiate when to use this tool versus the sibling 'pay_x402'.

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/mrocker/cardzero-mcp'

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