/** * Tool: send_anon_email * * Sends an anonymous email through a Firefox Relay address. * This tool allows sending emails from relay addresses while maintaining * privacy and anonymity through the Firefox Relay service. * * Note: Firefox Relay doesn't currently support sending emails via API. * This implementation provides a simulation and database logging for the purpose * of the MCP server, with the understanding that actual sending would be handled * by the user's email client or through alternative means. * * Follows golden-standard programming practices: * - Zod v4 validation for input parameters * - Comprehensive error handling with custom error classes * - Database persistence with PQC encryption at rest * - Audit logging for security and traceability */ import { z } from 'zod/v4'; import { MCPTool, ToolResult } from '../types'; /** * Schema for validating send_anon_email tool input */ export declare const SendAnonEmailInputSchema: z.ZodObject<{ relayAddressId: z.ZodOptional; relayAddress: z.ZodOptional; to: z.ZodString; subject: z.ZodString; body: z.ZodString; html: z.ZodOptional; headers: z.ZodDefault>>; isOtp: z.ZodDefault>; otpCode: z.ZodOptional; simulate: z.ZodDefault>; }, z.core.$strip>; /** * Type for validated input */ export type SendAnonEmailInput = z.infer; /** * Response type for the send_anon_email tool */ export interface SendAnonEmailResponse { success: boolean; email: { id: number; emailId: string; relayAddressId: number; fullRelayAddress: string; to: string; subject: string; bodyPreview: string | null; sentAt: string; status: 'sent' | 'queued' | 'failed' | 'simulated'; messageId: string | null; } | null; requestId: string; timestamp: string; error?: string; warnings?: string[]; } /** * Custom error for send operation failures */ export declare class EmailSendError extends Error { readonly code: string; readonly details?: Record | undefined; constructor(message: string, code?: string, details?: Record | undefined); } /** * Custom error for invalid relay address */ export declare class InvalidRelayAddressError extends Error { readonly address: string; constructor(message: string, address: string); } /** * Custom error for invalid recipient */ export declare class InvalidRecipientError extends Error { readonly recipient: string; constructor(message: string, recipient: string); } /** * Custom error for rate limiting */ export declare class RateLimitExceededError extends Error { readonly retryAfter: number; constructor(message: string, retryAfter: number); } /** * Custom error for authentication issues */ export declare class AuthenticationError extends Error { constructor(message?: string); } /** * Sends an anonymous email through a Firefox Relay address. * * This function: * 1. Validates input using Zod v4 * 2. Resolves relay address ID from either ID or full address * 3. Validates recipient and content * 4. Processes email content for database storage * 5. Logs the email to the database (simulated send) * 6. Logs all operations to audit trail * * Note: Actual email sending is simulated as Firefox Relay doesn't * currently support sending via API. This implementation provides * the infrastructure for when API support is available. * * @param input - Validated input parameters * @param context - MCP tool execution context * @returns Tool result with send operation details */ export declare function sendAnonEmailHandler(input: unknown, context?: Record): Promise; /** * MCP Tool definition for send_anon_email */ export declare const sendAnonEmailTool: MCPTool; export default sendAnonEmailTool; //# sourceMappingURL=send_anon_email.d.ts.map