/** * Tool: latest_email_otp * * Retrieves the latest OTP (One-Time Password) email from the system. * This tool is specifically designed to extract the most recent OTP code * from received emails, making it easy for automated workflows to access * verification codes. * * 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, OtpExtractionResult } from '../types'; /** * Schema for validating latest_email_otp tool input */ export declare const LatestEmailOtpInputSchema: z.ZodObject<{ reExtract: z.ZodDefault>; minConfidence: z.ZodDefault>; validateOtp: z.ZodDefault>; markAsRead: z.ZodDefault>; maxAgeSeconds: z.ZodDefault>; }, z.core.$strip>; /** * Type for validated input */ export type LatestEmailOtpInput = z.infer; /** * Response type for the latest_email_otp tool */ export interface LatestEmailOtpResponse { success: boolean; otp: OtpExtractionResult | null; email: { id: number; emailId: string; relayAddressId: number; sender: string; recipient: string; subject: string; receivedAt: string; bodyPreview: string | null; isOtp: boolean; otpCode: string | null; } | null; requestId: string; timestamp: string; error?: string; ageSeconds?: number; isExpired?: boolean; } /** * Custom error for no OTP emails found */ export declare class NoOtpEmailsFoundError extends Error { constructor(message?: string); } /** * Custom error for OTP extraction failures */ export declare class OtpExtractionError extends Error { readonly code: string; readonly details?: Record | undefined; constructor(message: string, code?: string, details?: Record | undefined); } /** * Custom error for invalid OTP codes */ export declare class InvalidOtpError extends Error { readonly otpCode: string; readonly reason: string; constructor(message: string, otpCode: string, reason: string); } /** * Custom error for expired OTP */ export declare class ExpiredOtpError extends Error { readonly ageSeconds: number; readonly maxAgeSeconds: number; constructor(message: string, ageSeconds: number, maxAgeSeconds: number); } /** * Retrieves the latest OTP email from the system. * * This function: * 1. Validates input using Zod v4 * 2. Retrieves the latest OTP email from the database * 3. Optionally re-extracts OTP codes from email body * 4. Validates extracted OTP codes * 5. Checks OTP age and expiration * 6. Performs security analysis * 7. Logs all operations to audit trail * * @param input - Validated input parameters * @param context - MCP tool execution context * @returns Tool result with the latest OTP information */ export declare function latestEmailOtpHandler(input: unknown, context?: Record): Promise; /** * MCP Tool definition for latest_email_otp */ export declare const latestEmailOtpTool: MCPTool; export default latestEmailOtpTool; //# sourceMappingURL=latest_email_otp.d.ts.map