| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- /**
- * Type Definitions for Apple Mail MCP Server
- *
- * This module contains all TypeScript interfaces and types used throughout
- * the Apple Mail MCP server. These types model:
- *
- * - Apple Mail data structures (messages, mailboxes, accounts)
- * - AppleScript execution results
- * - MCP tool parameters
- *
- * @module types
- */
- /**
- * Represents an email message in Apple Mail.
- */
- export interface Message {
- /** Unique identifier for the message */
- id: string;
- /** Subject line of the email */
- subject: string;
- /** Sender email address */
- sender: string;
- /** Sender display name (if available) */
- senderName?: string;
- /** Recipients (To field) */
- recipients: string[];
- /** CC recipients */
- ccRecipients?: string[];
- /** BCC recipients (only available for sent mail) */
- bccRecipients?: string[];
- /** Date the message was received */
- dateReceived: Date;
- /** Date the message was sent */
- dateSent?: Date;
- /** Whether the message has been read */
- isRead: boolean;
- /** Whether the message is flagged */
- isFlagged: boolean;
- /** Whether the message is marked as junk */
- isJunk: boolean;
- /** Whether the message has been deleted */
- isDeleted: boolean;
- /** Name of the mailbox containing the message */
- mailbox: string;
- /** Name of the account containing the message */
- account: string;
- /** Whether the message has attachments */
- hasAttachments: boolean;
- }
- /**
- * Represents the content of an email message.
- */
- export interface MessageContent {
- /** Message identifier */
- id: string;
- /** Subject line */
- subject: string;
- /** Plain text content */
- plainText: string;
- /** HTML content (if available) */
- htmlContent?: string;
- }
- /**
- * Represents a mailbox (folder) in Apple Mail.
- */
- export interface Mailbox {
- /** Display name of the mailbox */
- name: string;
- /** Account containing the mailbox */
- account: string;
- /** Number of unread messages */
- unreadCount: number;
- /** Total number of messages */
- messageCount: number;
- }
- /**
- * Represents an email account in Apple Mail.
- */
- export interface Account {
- /** Display name of the account */
- name: string;
- /** Primary email address for the account */
- email: string;
- /** Account type (e.g., "iCloud", "Gmail", "Exchange") */
- accountType?: string;
- /** Whether the account is enabled */
- enabled: boolean;
- }
- /**
- * Represents an email attachment.
- */
- export interface Attachment {
- /** Attachment identifier */
- id: string;
- /** Filename of the attachment */
- name: string;
- /** MIME type of the attachment */
- mimeType: string;
- /** Size in bytes */
- size: number;
- }
- /**
- * Options for AppleScript execution.
- */
- export interface AppleScriptOptions {
- /** Maximum execution time in milliseconds */
- timeoutMs?: number;
- /** Maximum number of retry attempts */
- maxRetries?: number;
- /** Initial delay between retries in milliseconds */
- retryDelayMs?: number;
- }
- /**
- * Result from executing an AppleScript command.
- */
- export interface AppleScriptResult {
- /** Whether the script executed successfully */
- success: boolean;
- /** Output from the script (stdout) */
- output: string;
- /** Error message if execution failed */
- error?: string;
- }
- /**
- * Parameters for searching messages.
- */
- export interface SearchMessagesParams {
- /** Text to search for (searches subject, sender, content) */
- query?: string;
- /** Filter by sender email address */
- from?: string;
- /** Filter by recipient email address */
- to?: string;
- /** Filter by subject line */
- subject?: string;
- /** Mailbox to search in */
- mailbox?: string;
- /** Account to search in */
- account?: string;
- /** Filter by read status */
- isRead?: boolean;
- /** Filter by flagged status */
- isFlagged?: boolean;
- /** Start date for search range */
- dateFrom?: Date;
- /** End date for search range */
- dateTo?: Date;
- /** Maximum number of results to return */
- limit?: number;
- }
- /**
- * Parameters for sending an email.
- */
- export interface SendEmailParams {
- /** Recipient email addresses (To field) */
- to: string[];
- /** CC recipients */
- cc?: string[];
- /** BCC recipients */
- bcc?: string[];
- /** Email subject line */
- subject: string;
- /** Email body content */
- body: string;
- /** Whether the body is HTML formatted */
- isHtml?: boolean;
- /** Account to send from */
- account?: string;
- }
- /**
- * Parameters for getting a message by ID.
- */
- export interface GetMessageParams {
- /** Message identifier */
- id: string;
- }
- /**
- * Parameters for listing messages.
- */
- export interface ListMessagesParams {
- /** Mailbox to list messages from */
- mailbox?: string;
- /** Account to list messages from */
- account?: string;
- /** Maximum number of messages to return */
- limit?: number;
- /** Filter to unread messages only */
- unreadOnly?: boolean;
- }
- /**
- * Parameters for mailbox operations.
- */
- export interface MailboxParams {
- /** Mailbox name */
- name: string;
- /** Account containing the mailbox */
- account?: string;
- }
- /**
- * Parameters for moving a message.
- */
- export interface MoveMessageParams {
- /** Message identifier */
- id: string;
- /** Destination mailbox name */
- mailbox: string;
- /** Account containing the destination mailbox */
- account?: string;
- }
- /**
- * A single recipient in a serial email (mail merge) operation.
- */
- export interface SerialEmailRecipient {
- /** Recipient email address */
- email: string;
- /** Variable values for placeholder replacement (e.g., { Name: "Alice", Company: "Acme" }) */
- variables: Record<string, string>;
- }
- /**
- * Result of sending a serial email to a single recipient.
- */
- export interface SerialEmailResult {
- /** Recipient email address */
- email: string;
- /** Whether the email was sent successfully */
- success: boolean;
- /** Error message if sending failed */
- error?: string;
- }
- /**
- * Individual check result in a health check.
- */
- export interface HealthCheckItem {
- /** Name of the check */
- name: string;
- /** Whether the check passed */
- passed: boolean;
- /** Details about the check result */
- message: string;
- }
- /**
- * Result of a health check operation.
- */
- export interface HealthCheckResult {
- /** Whether all checks passed */
- healthy: boolean;
- /** Individual check results */
- checks: HealthCheckItem[];
- }
- /**
- * Statistics for a mailbox.
- */
- export interface MailboxStats {
- /** Mailbox name */
- name: string;
- /** Total message count */
- messageCount: number;
- /** Unread message count */
- unreadCount: number;
- }
- /**
- * Statistics for an account.
- */
- export interface AccountStats {
- /** Account name */
- name: string;
- /** Total messages in account */
- totalMessages: number;
- /** Total unread messages */
- unreadMessages: number;
- /** Number of mailboxes */
- mailboxCount: number;
- /** Per-mailbox statistics */
- mailboxes: MailboxStats[];
- }
- /**
- * Recently received message counts.
- */
- export interface RecentlyReceivedStats {
- /** Messages received in last 24 hours */
- last24h: number;
- /** Messages received in last 7 days */
- last7d: number;
- /** Messages received in last 30 days */
- last30d: number;
- }
- /**
- * Overall mail statistics.
- */
- export interface MailStats {
- /** Total messages across all accounts */
- totalMessages: number;
- /** Total unread messages */
- totalUnread: number;
- /** Per-account statistics */
- accounts: AccountStats[];
- /** Recently received message counts */
- recentlyReceived?: RecentlyReceivedStats;
- }
- /**
- * Result of a batch operation on a single item.
- */
- export interface BatchOperationResult {
- /** Item identifier */
- id: string;
- /** Whether the operation succeeded */
- success: boolean;
- /** Error message if operation failed */
- error?: string;
- }
- /**
- * Represents a mail rule in Apple Mail.
- */
- export interface MailRule {
- /** Rule name */
- name: string;
- /** Whether the rule is enabled */
- enabled: boolean;
- }
- /**
- * Represents a contact from Contacts.app.
- */
- export interface Contact {
- /** Full name */
- name: string;
- /** Email addresses */
- emails: string[];
- /** Phone numbers */
- phones: string[];
- }
- /**
- * Represents a stored email template.
- */
- export interface EmailTemplate {
- /** Template identifier */
- id: string;
- /** Template name */
- name: string;
- /** Default subject line */
- subject: string;
- /** Template body */
- body: string;
- /** Default recipients */
- to?: string[];
- /** Default CC recipients */
- cc?: string[];
- }
- /**
- * Status of Mail.app sync activity.
- */
- export interface SyncStatus {
- /** Whether sync activity was detected */
- syncDetected: boolean;
- /** Number of items pending upload */
- pendingUpload: number;
- /** Whether there was recent database activity */
- recentActivity: boolean;
- /** Seconds since last database change */
- secondsSinceLastChange: number;
- /** Error message if status check failed */
- error?: string;
- }
- //# sourceMappingURL=types.d.ts.map
|