/** * Tool: latest_email * * Retrieves the latest email for a specific Firefox Relay address. * This is a specialized tool for quickly accessing the most recent email * without needing to fetch all emails. * * 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 * - OTP extraction and security analysis * - Audit logging for security and traceability */ import { z } from 'zod/v4'; import { MCPTool, ToolResult } from '../types'; import { RetrievedEmail } from './read_emails'; /** * Schema for validating latest_email tool input */ export declare const LatestEmailInputSchema: z.ZodObject<{ relayAddressId: z.ZodOptional; relayAddress: z.ZodOptional; extractOtp: z.ZodDefault>; includeSecurityAnalysis: z.ZodDefault>; }, z.core.$strip>; /** * Type for validated input */ export type LatestEmailInput = z.infer; /** * Response type for the latest_email tool */ export interface LatestEmailResponse { success: boolean; email: RetrievedEmail | null; requestId: string; timestamp: string; error?: string; relayAddressId?: number; fullRelayAddress?: string; } /** * Custom error for no emails found */ export declare class NoEmailsFoundError extends Error { readonly relayAddressId?: number | undefined; readonly fullAddress?: string | undefined; constructor(message?: string, relayAddressId?: number | undefined, fullAddress?: string | undefined); } /** * Custom error for email retrieval failures */ export declare class LatestEmailRetrievalError 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); } /** * Retrieves the latest email for a specific Firefox Relay address * * This function: * 1. Validates input using Zod v4 * 2. Resolves relay address ID from either ID or full address * 3. Retrieves the latest email from the database * 4. Extracts OTP codes if requested * 5. Performs security analysis if requested * 6. Logs all operations to audit trail * * @param input - Validated input parameters * @param context - MCP tool execution context * @returns Tool result with the latest email */ export declare function latestEmailHandler(input: unknown, context?: Record): Promise; /** * MCP Tool definition for latest_email */ export declare const latestEmailTool: MCPTool; export default latestEmailTool; //# sourceMappingURL=latest_email.d.ts.map