Skip to main content
Glama

x402_send_email

Send transactional emails with HTML/plain text, CC/BCC recipients, and file attachments via Resend. Paid mode costs $0.01 USDC per email with daily limits, or use free test mode for fixture data.

Instructions

Send a transactional email via Resend. Price: $0.01 USDC per email (paid mode) | Free test: returns fixture data.

Supports plain text or HTML body, CC/BCC recipients, and file attachments (base64-encoded, max 25MB per file). Per-wallet daily limit: 10 emails. Per-domain daily limit: 5 emails (applies to all recipients including CC/BCC). Without X402_PRIVATE_KEY, only the free test endpoint is available.

Returns: message_id from Resend.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesRecipient email address
subjectYesEmail subject (max 998 chars)
bodyYesEmail body — HTML or plain text (max 100 KB)
reply_toNoOptional reply-to address
ccNoCC recipients — list of email addresses
bccNoBCC recipients — list of email addresses
attachmentsNoFile attachments (base64-encoded, max 25MB pre-encoding per file)

Implementation Reference

  • The handler for the x402_send_email tool, which handles both paid (via Resend) and free (test) email sending logic.
    async (params) => {
      const base = APIS.email.baseUrl;
    
      try {
        const usePaid = !!PRIVATE_KEY;
    
        if (usePaid) {
          const payload: Record<string, unknown> = {
            to: params.to,
            subject: params.subject,
            body: params.body,
          };
          if (params.reply_to) payload.reply_to = params.reply_to;
          if (params.cc) payload.cc = params.cc;
          if (params.bcc) payload.bcc = params.bcc;
          if (params.attachments) payload.attachments = params.attachments;
    
          const data = await apiPost(base, "/send", payload, true);
          return textResult({
            mode: "paid",
            cost: "$0.01",
            ...data,
          });
        } else {
          const data = await apiGet(base, "/send/test");
          return textResult({
            mode: "free_test",
            note: "Free test — no email actually sent. Set X402_PRIVATE_KEY for real email delivery.",
            ...data,
          });
        }
      } catch (err: any) {
        return errorResult(err.message);
  • The Zod schema validation for the input parameters of the x402_send_email tool.
    {
      to: z.string().email().describe("Recipient email address"),
      subject: z
        .string()
        .min(1)
        .max(998)
        .describe("Email subject (max 998 chars)"),
      body: z
        .string()
        .min(1)
        .max(102400)
        .describe("Email body — HTML or plain text (max 100 KB)"),
      reply_to: z
        .string()
        .email()
        .optional()
        .describe("Optional reply-to address"),
      cc: z.array(z.string().email()).optional()
          .describe("CC recipients — list of email addresses"),
      bcc: z.array(z.string().email()).optional()
          .describe("BCC recipients — list of email addresses"),
      attachments: z.array(z.object({
          filename: z.string().describe("Filename including extension (e.g. 'report.pdf')"),
          content: z.string().describe("Base64-encoded file content (max 25MB decoded)"),
          content_type: z.string().optional()
              .describe("MIME type — auto-derived from filename if omitted"),
      })).optional().describe("File attachments (base64-encoded, max 25MB pre-encoding per file)"),
    },
  • src/index.ts:476-476 (registration)
    Registration of the x402_send_email tool in the server instance.
    "x402_send_email",
Behavior5/5

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

No annotations provided, so description carries full burden. It comprehensively discloses pricing, rate limits (per-wallet and per-domain), authentication requirements, test vs. production behavior, and return values ('message_id from Resend').

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 with zero waste. Front-loaded with purpose, followed by pricing, capabilities, limits, auth requirements, and return value. Every sentence delivers critical operational information.

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?

Given complexity (payment integration, rate limiting, attachment handling) and lack of output schema, the description is remarkably complete. It covers costs, authentication, limits, return values, and content formatting requirements sufficient for correct invocation.

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 description coverage is 100%, establishing baseline 3. The description summarizes capabilities ('Supports plain text or HTML body, CC/BCC recipients, and file attachments') but does not add semantic meaning beyond what the schema already documents for each parameter.

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 opens with a specific verb ('Send'), clear resource ('transactional email'), and provider ('Resend'). It clearly distinguishes from siblings (x402_convert_file, x402_crawl_site, etc.) as the only email-related tool.

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 prerequisites ('Without X402_PRIVATE_KEY, only the free test endpoint is available'), cost implications ('$0.01 USDC per email'), and operational constraints (daily limits). Clear distinction between paid mode and free test mode behavior.

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/jameswilliamwisdom/x402-mcp-server'

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