Skip to main content
Glama

Send a transactional or alert email on behalf of the agent

agent_send_email

Send real transactional email from autonomous workflows to notify humans or suppliers, compiling Markdown into responsive HTML and returning the provider message ID.

Instructions

Sends a real email from the suite's transactional sender: the Markdown body is compiled to responsive HTML (or raw html is sent as-is), with optional plain-text fallback and Reply-To, and the provider message id is returned. Use it when an autonomous workflow must notify a human or a supplier, for example a supplierAlert from br_nfe_xml_auditor or a risk alert. Do not use it for marketing or bulk mail, for messages that need attachments, or to test rendering (every successful call delivers a real message). Side effects: NOT read-only and NOT idempotent; each call sends a new email, so retry only when the previous call returned an error. Nothing is deleted or overwritten. Invalid recipients or a missing subject return success:false with error and message. Billing: 0.005 USDC per call. With X402_PRIVATE_KEY set, the server pays with x402 v2 on Base mainnet (eip155:8453) and refuses locally, before any request, when the price exceeds X402_MAX_USDC_PER_CALL (default 0.05). With BRAZIL_AI_API_KEY set, the call is debited from a prepaid B2B quota instead. With no credentials nothing is charged: the tool returns isError with error "payment_required_x402" plus the decoded paymentRequirements, so call brazil_ai_suite_status first to see the active payment mode. Errors never throw: a spend-cap block ("x402_spend_cap_exceeded"), a non-2xx API answer ({ status, endpoint, body }) or a network failure ("mcp_tool_execution_failed") comes back as an isError result with JSON text, so the agent loop keeps running.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "to": "<to>",
      "subject": "<subject>"
    },
    "name": "agent_send_email"
  }
}

Input Schema

NameRequiredDescriptionDefault
toYesRecipient address, or several separated by commas. Required.
htmlNoOptional raw HTML body; overrides the HTML compiled from markdown.
textNoOptional plain-text body, used as the text/plain part and as the body when no markdown or html is given.
replyToNoOptional Reply-To address so replies go to a human instead of the sender.
subjectYesSubject line, plain text. Required.
markdownNoBody in Markdown, compiled into responsive HTML. Provide markdown, text or html.

Output Schema

NameRequiredDescriptionDefault
textNoRaw response body, present only when the API answered with non-JSON content (for example format=markdown).
errorNoStable machine-readable failure code, present only on failure.
statusNoDelivery status reported by the provider, e.g. sent or queued.
messageNoHuman-readable explanation of the failure, present only on failure.
subjectNoSubject actually sent.
successNotrue when the provider accepted the message.
providerNoEmail provider that handled the send.
messageIdNoProvider message id, for tracking.
recipientsNoNormalized recipient addresses.
recipientCountNoNumber of recipients.
_x402SettlementNox402 settlement receipt decoded from the PAYMENT-RESPONSE header (success flag, transaction hash, network, payer). Present only when the call was paid with an x402 wallet.
processingTimeMsNoServer-side processing time in milliseconds.
renderedHtmlBytesNoSize of the HTML body sent, in bytes.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.7.1

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false, idempotentHint=false and destructiveHint=false, yet the description still adds real operational context: retry only after an error because each call sends a new message, nothing is deleted or overwritten, invalid recipients/missing subject return success:false, and errors never throw. Docked one point because the billing/credential block is dense with server-configuration detail that partly belongs to suite setup rather than this tool's behavior.

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

Conciseness3/5

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

Purpose, when-to-use and when-not-to-use are properly front-loaded, which is good. However, the single dense paragraph chains side effects, billing, x402/Base mainnet configuration, spend caps, prepaid quota, and error shapes with semicolons, making it harder to scan than a short bulleted structure would be.

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?

An output schema exists, but the description still notes the provider message id is returned, and it fully covers the failure modes an agent loop needs: payment_required_x402, x402_spend_cap_exceeded, non-2xx {status, endpoint, body}, and mcp_tool_execution_failed, all as non-throwing isError results. Nothing required to invoke this tool correctly is missing.

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 the schema already documents all six parameters including that html overrides compiled markdown and that no credentials means isError with payment_required_x402. The description mostly restates the markdown/html precedence and Reply-To purpose that the schema already states, adding little new parameter meaning beyond the baseline.

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 a specific verb+resource: 'Sends a real email from the suite's transactional sender', and immediately scopes the content model (Markdown compiled to responsive HTML, or raw HTML as-is). No sibling tool overlaps with email delivery, and the transactional-vs-marketing distinction makes the boundary explicit.

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?

Gives concrete positive triggers ('autonomous workflow must notify a human or a supplier', supplierAlert from br_nfe_xml_auditor) and explicit exclusions (marketing/bulk, attachments, render testing because every call delivers a real message). It also routes the agent to brazil_ai_suite_status to discover the active payment mode before calling.

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