Skip to content

Commit ef7aed6

Browse files
napoleondclaude
andcommitted
feat(email): add mark-read command for explicit read status
The email service no longer auto-marks messages as read on retrieval. This adds `npx atxp email mark-read <messageId>` to explicitly mark messages as read using the new email_mark_as_read tool. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d188df7 commit ef7aed6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

packages/atxp/src/commands/email.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ function showEmailHelp(): void {
7373
console.log(' ' + chalk.cyan('npx atxp email send') + ' ' + chalk.yellow('<options>') + ' ' + 'Send an email');
7474
console.log(' ' + chalk.cyan('npx atxp email reply') + ' ' + chalk.yellow('<messageId>') + ' ' + chalk.yellow('<options>') + ' ' + 'Reply to a message');
7575
console.log(' ' + chalk.cyan('npx atxp email search') + ' ' + chalk.yellow('<query>') + ' ' + 'Search emails');
76+
console.log(' ' + chalk.cyan('npx atxp email mark-read') + ' ' + chalk.yellow('<messageId>') + ' ' + 'Mark a message as read');
7677
console.log(' ' + chalk.cyan('npx atxp email delete') + ' ' + chalk.yellow('<messageId>') + ' ' + 'Delete a message');
7778
console.log(' ' + chalk.cyan('npx atxp email get-attachment') + ' ' + chalk.yellow('<options>') + ' ' + 'Download an attachment');
7879
console.log(' ' + chalk.cyan('npx atxp email claim-username') + ' ' + chalk.yellow('<name>') + ' ' + 'Claim a username ($1.00)');
@@ -101,6 +102,7 @@ function showEmailHelp(): void {
101102
console.log(' npx atxp email reply msg_abc123 --body "Thanks for your message!"');
102103
console.log(' npx atxp email reply msg_abc123 --body "Updated version attached." --attach report-v2.pdf');
103104
console.log(' npx atxp email search "invoice"');
105+
console.log(' npx atxp email mark-read msg_abc123');
104106
console.log(' npx atxp email delete msg_abc123');
105107
console.log(' npx atxp email get-attachment --message msg_abc123 --index 0');
106108
console.log(' npx atxp email claim-username myname');
@@ -110,6 +112,7 @@ function showEmailHelp(): void {
110112
console.log(' Inbox check: ' + chalk.green('FREE'));
111113
console.log(' Read message: ' + chalk.green('FREE'));
112114
console.log(' Search: ' + chalk.green('FREE'));
115+
console.log(' Mark as read: ' + chalk.green('FREE'));
113116
console.log(' Delete: ' + chalk.green('FREE'));
114117
console.log(' Get attachment: ' + chalk.green('FREE'));
115118
console.log(' Send email: ' + chalk.yellow('$0.01 per email'));
@@ -149,6 +152,10 @@ export async function emailCommand(subCommand: string, options: EmailOptions, me
149152
await searchEmails(messageId, options.unreadOnly);
150153
break;
151154

155+
case 'mark-read':
156+
await markAsRead(messageId);
157+
break;
158+
152159
case 'delete':
153160
await deleteEmail(messageId);
154161
break;
@@ -431,6 +438,28 @@ async function searchEmails(query?: string, unreadOnly?: boolean): Promise<void>
431438
}
432439
}
433440

441+
async function markAsRead(messageId?: string): Promise<void> {
442+
if (!messageId) {
443+
console.error(chalk.red('Error: messageId is required'));
444+
console.log(`Usage: ${chalk.cyan('npx atxp email mark-read <messageId>')}`);
445+
process.exit(1);
446+
}
447+
448+
const result = await callTool(SERVER, 'email_mark_as_read', { messageId });
449+
450+
try {
451+
const parsed = JSON.parse(result);
452+
if (parsed.status === 'error') {
453+
console.error(chalk.red('Error: ' + parsed.errorMessage));
454+
process.exit(1);
455+
}
456+
457+
console.log(chalk.green('Message marked as read.'));
458+
} catch {
459+
console.log(result);
460+
}
461+
}
462+
434463
async function deleteEmail(messageId?: string): Promise<void> {
435464
if (!messageId) {
436465
console.error(chalk.red('Error: messageId is required'));

0 commit comments

Comments
 (0)