mcp-twake-mail 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -30
- package/build/jmap/client.js +1 -1
- package/build/jmap/client.js.map +1 -1
- package/build/mcp/tools/batch-operations.d.ts +10 -0
- package/build/mcp/tools/batch-operations.js +609 -0
- package/build/mcp/tools/batch-operations.js.map +1 -0
- package/build/mcp/tools/batch-operations.test.d.ts +1 -0
- package/build/mcp/tools/batch-operations.test.js +875 -0
- package/build/mcp/tools/batch-operations.test.js.map +1 -0
- package/build/mcp/tools/email-operations.js +355 -1
- package/build/mcp/tools/email-operations.js.map +1 -1
- package/build/mcp/tools/email-operations.test.js +5 -3
- package/build/mcp/tools/email-operations.test.js.map +1 -1
- package/build/mcp/tools/email-sending.js +423 -1
- package/build/mcp/tools/email-sending.js.map +1 -1
- package/build/mcp/tools/index.js +3 -0
- package/build/mcp/tools/index.js.map +1 -1
- package/build/mcp/tools/mailbox.js +433 -1
- package/build/mcp/tools/mailbox.js.map +1 -1
- package/build/mcp/tools/mailbox.test.js +5 -2
- package/build/mcp/tools/mailbox.test.js.map +1 -1
- package/build/types/jmap.d.ts +23 -0
- package/package.json +1 -1
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Batch email operation MCP tools for managing multiple emails via JMAP.
|
|
3
|
+
* Tools: batch_mark_read, batch_mark_unread, batch_move, batch_delete, batch_add_label, batch_remove_label.
|
|
4
|
+
* These tools enable AI assistants to perform bulk email operations efficiently.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
/**
|
|
8
|
+
* Common annotations for non-destructive batch write operations.
|
|
9
|
+
*/
|
|
10
|
+
const BATCH_WRITE_ANNOTATIONS = {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: false,
|
|
13
|
+
idempotentHint: true,
|
|
14
|
+
openWorldHint: true,
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Annotations for destructive batch operations (delete).
|
|
18
|
+
*/
|
|
19
|
+
const BATCH_DESTRUCTIVE_ANNOTATIONS = {
|
|
20
|
+
readOnlyHint: false,
|
|
21
|
+
destructiveHint: true,
|
|
22
|
+
idempotentHint: false, // NOT idempotent - permanent delete cannot be undone
|
|
23
|
+
openWorldHint: true,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Build a BatchOperationResult from JMAP Email/set response.
|
|
27
|
+
* @param emailIds Original array of email IDs in the request
|
|
28
|
+
* @param updated Record of successfully updated email IDs
|
|
29
|
+
* @param notUpdated Record of failed email IDs with error details
|
|
30
|
+
*/
|
|
31
|
+
function buildBatchResult(emailIds, updated, notUpdated) {
|
|
32
|
+
const succeededIds = Object.keys(updated || {});
|
|
33
|
+
const failedEntries = [];
|
|
34
|
+
for (const [emailId, error] of Object.entries(notUpdated || {})) {
|
|
35
|
+
failedEntries.push({
|
|
36
|
+
emailId,
|
|
37
|
+
error: `${error.type}${error.description ? `: ${error.description}` : ''}`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
success: failedEntries.length === 0,
|
|
42
|
+
total: emailIds.length,
|
|
43
|
+
succeeded: succeededIds.length,
|
|
44
|
+
failed: failedEntries.length,
|
|
45
|
+
results: {
|
|
46
|
+
succeeded: succeededIds,
|
|
47
|
+
failed: failedEntries,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build a BatchOperationResult from JMAP Email/set destroy response.
|
|
53
|
+
* @param emailIds Original array of email IDs in the request
|
|
54
|
+
* @param destroyed Array of successfully destroyed email IDs
|
|
55
|
+
* @param notDestroyed Record of failed email IDs with error details
|
|
56
|
+
*/
|
|
57
|
+
function buildBatchDestroyResult(emailIds, destroyed, notDestroyed) {
|
|
58
|
+
const succeededIds = destroyed || [];
|
|
59
|
+
const failedEntries = [];
|
|
60
|
+
for (const [emailId, error] of Object.entries(notDestroyed || {})) {
|
|
61
|
+
failedEntries.push({
|
|
62
|
+
emailId,
|
|
63
|
+
error: `${error.type}${error.description ? `: ${error.description}` : ''}`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
success: failedEntries.length === 0,
|
|
68
|
+
total: emailIds.length,
|
|
69
|
+
succeeded: succeededIds.length,
|
|
70
|
+
failed: failedEntries.length,
|
|
71
|
+
results: {
|
|
72
|
+
succeeded: succeededIds,
|
|
73
|
+
failed: failedEntries,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Register batch email operation MCP tools with the server.
|
|
79
|
+
* @param server MCP server instance
|
|
80
|
+
* @param jmapClient JMAP client for API calls
|
|
81
|
+
* @param logger Pino logger
|
|
82
|
+
*/
|
|
83
|
+
export function registerBatchOperationTools(server, jmapClient, logger) {
|
|
84
|
+
// batch_mark_read - set $seen keyword on multiple emails
|
|
85
|
+
server.registerTool('batch_mark_read', {
|
|
86
|
+
title: 'Batch Mark Emails as Read',
|
|
87
|
+
description: 'Mark multiple emails as read in a single operation.',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
emailIds: z
|
|
90
|
+
.array(z.string())
|
|
91
|
+
.min(1, 'At least one email ID required')
|
|
92
|
+
.max(50, 'Maximum 50 emails per batch operation')
|
|
93
|
+
.describe('Array of email IDs to mark as read (max 50)'),
|
|
94
|
+
},
|
|
95
|
+
annotations: BATCH_WRITE_ANNOTATIONS,
|
|
96
|
+
}, async ({ emailIds }) => {
|
|
97
|
+
logger.debug({ emailIds, count: emailIds.length }, 'batch_mark_read called');
|
|
98
|
+
try {
|
|
99
|
+
const session = jmapClient.getSession();
|
|
100
|
+
// Build update map for all emails
|
|
101
|
+
const updateMap = {};
|
|
102
|
+
for (const emailId of emailIds) {
|
|
103
|
+
updateMap[emailId] = { 'keywords/$seen': true };
|
|
104
|
+
}
|
|
105
|
+
const response = await jmapClient.request([
|
|
106
|
+
[
|
|
107
|
+
'Email/set',
|
|
108
|
+
{
|
|
109
|
+
accountId: session.accountId,
|
|
110
|
+
update: updateMap,
|
|
111
|
+
},
|
|
112
|
+
'batchMarkRead',
|
|
113
|
+
],
|
|
114
|
+
]);
|
|
115
|
+
const result = jmapClient.parseMethodResponse(response.methodResponses[0]);
|
|
116
|
+
if (!result.success) {
|
|
117
|
+
logger.error({ error: result.error, emailIds }, 'JMAP error in batch_mark_read');
|
|
118
|
+
return {
|
|
119
|
+
isError: true,
|
|
120
|
+
content: [
|
|
121
|
+
{
|
|
122
|
+
type: 'text',
|
|
123
|
+
text: `Failed to batch mark emails as read: ${result.error?.description || result.error?.type || 'Unknown error'}`,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const setResponse = result.data;
|
|
129
|
+
const batchResult = buildBatchResult(emailIds, setResponse.updated, setResponse.notUpdated);
|
|
130
|
+
logger.debug({ succeeded: batchResult.succeeded, failed: batchResult.failed }, 'batch_mark_read complete');
|
|
131
|
+
return {
|
|
132
|
+
content: [
|
|
133
|
+
{
|
|
134
|
+
type: 'text',
|
|
135
|
+
text: JSON.stringify(batchResult),
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
logger.error({ error, emailIds }, 'Exception in batch_mark_read');
|
|
142
|
+
return {
|
|
143
|
+
isError: true,
|
|
144
|
+
content: [
|
|
145
|
+
{
|
|
146
|
+
type: 'text',
|
|
147
|
+
text: `Error batch marking emails as read: ${error instanceof Error ? error.message : String(error)}`,
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
// batch_mark_unread - remove $seen keyword from multiple emails
|
|
154
|
+
server.registerTool('batch_mark_unread', {
|
|
155
|
+
title: 'Batch Mark Emails as Unread',
|
|
156
|
+
description: 'Mark multiple emails as unread in a single operation.',
|
|
157
|
+
inputSchema: {
|
|
158
|
+
emailIds: z
|
|
159
|
+
.array(z.string())
|
|
160
|
+
.min(1, 'At least one email ID required')
|
|
161
|
+
.max(50, 'Maximum 50 emails per batch operation')
|
|
162
|
+
.describe('Array of email IDs to mark as unread (max 50)'),
|
|
163
|
+
},
|
|
164
|
+
annotations: BATCH_WRITE_ANNOTATIONS,
|
|
165
|
+
}, async ({ emailIds }) => {
|
|
166
|
+
logger.debug({ emailIds, count: emailIds.length }, 'batch_mark_unread called');
|
|
167
|
+
try {
|
|
168
|
+
const session = jmapClient.getSession();
|
|
169
|
+
// Build update map for all emails
|
|
170
|
+
const updateMap = {};
|
|
171
|
+
for (const emailId of emailIds) {
|
|
172
|
+
updateMap[emailId] = { 'keywords/$seen': null };
|
|
173
|
+
}
|
|
174
|
+
const response = await jmapClient.request([
|
|
175
|
+
[
|
|
176
|
+
'Email/set',
|
|
177
|
+
{
|
|
178
|
+
accountId: session.accountId,
|
|
179
|
+
update: updateMap,
|
|
180
|
+
},
|
|
181
|
+
'batchMarkUnread',
|
|
182
|
+
],
|
|
183
|
+
]);
|
|
184
|
+
const result = jmapClient.parseMethodResponse(response.methodResponses[0]);
|
|
185
|
+
if (!result.success) {
|
|
186
|
+
logger.error({ error: result.error, emailIds }, 'JMAP error in batch_mark_unread');
|
|
187
|
+
return {
|
|
188
|
+
isError: true,
|
|
189
|
+
content: [
|
|
190
|
+
{
|
|
191
|
+
type: 'text',
|
|
192
|
+
text: `Failed to batch mark emails as unread: ${result.error?.description || result.error?.type || 'Unknown error'}`,
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
const setResponse = result.data;
|
|
198
|
+
const batchResult = buildBatchResult(emailIds, setResponse.updated, setResponse.notUpdated);
|
|
199
|
+
logger.debug({ succeeded: batchResult.succeeded, failed: batchResult.failed }, 'batch_mark_unread complete');
|
|
200
|
+
return {
|
|
201
|
+
content: [
|
|
202
|
+
{
|
|
203
|
+
type: 'text',
|
|
204
|
+
text: JSON.stringify(batchResult),
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
logger.error({ error, emailIds }, 'Exception in batch_mark_unread');
|
|
211
|
+
return {
|
|
212
|
+
isError: true,
|
|
213
|
+
content: [
|
|
214
|
+
{
|
|
215
|
+
type: 'text',
|
|
216
|
+
text: `Error batch marking emails as unread: ${error instanceof Error ? error.message : String(error)}`,
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
// batch_move - move multiple emails to a different mailbox
|
|
223
|
+
server.registerTool('batch_move', {
|
|
224
|
+
title: 'Batch Move Emails',
|
|
225
|
+
description: 'Move multiple emails to a different mailbox in a single operation. This replaces all current mailbox associations for each email.',
|
|
226
|
+
inputSchema: {
|
|
227
|
+
emailIds: z
|
|
228
|
+
.array(z.string())
|
|
229
|
+
.min(1, 'At least one email ID required')
|
|
230
|
+
.max(50, 'Maximum 50 emails per batch operation')
|
|
231
|
+
.describe('Array of email IDs to move (max 50)'),
|
|
232
|
+
targetMailboxId: z.string().describe('The ID of the mailbox to move the emails to'),
|
|
233
|
+
},
|
|
234
|
+
annotations: BATCH_WRITE_ANNOTATIONS,
|
|
235
|
+
}, async ({ emailIds, targetMailboxId }) => {
|
|
236
|
+
logger.debug({ emailIds, count: emailIds.length, targetMailboxId }, 'batch_move called');
|
|
237
|
+
try {
|
|
238
|
+
const session = jmapClient.getSession();
|
|
239
|
+
// Build update map for all emails
|
|
240
|
+
const updateMap = {};
|
|
241
|
+
for (const emailId of emailIds) {
|
|
242
|
+
updateMap[emailId] = { mailboxIds: { [targetMailboxId]: true } };
|
|
243
|
+
}
|
|
244
|
+
const response = await jmapClient.request([
|
|
245
|
+
[
|
|
246
|
+
'Email/set',
|
|
247
|
+
{
|
|
248
|
+
accountId: session.accountId,
|
|
249
|
+
update: updateMap,
|
|
250
|
+
},
|
|
251
|
+
'batchMove',
|
|
252
|
+
],
|
|
253
|
+
]);
|
|
254
|
+
const result = jmapClient.parseMethodResponse(response.methodResponses[0]);
|
|
255
|
+
if (!result.success) {
|
|
256
|
+
logger.error({ error: result.error, emailIds }, 'JMAP error in batch_move');
|
|
257
|
+
return {
|
|
258
|
+
isError: true,
|
|
259
|
+
content: [
|
|
260
|
+
{
|
|
261
|
+
type: 'text',
|
|
262
|
+
text: `Failed to batch move emails: ${result.error?.description || result.error?.type || 'Unknown error'}`,
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
const setResponse = result.data;
|
|
268
|
+
const batchResult = buildBatchResult(emailIds, setResponse.updated, setResponse.notUpdated);
|
|
269
|
+
logger.debug({ succeeded: batchResult.succeeded, failed: batchResult.failed, targetMailboxId }, 'batch_move complete');
|
|
270
|
+
return {
|
|
271
|
+
content: [
|
|
272
|
+
{
|
|
273
|
+
type: 'text',
|
|
274
|
+
text: JSON.stringify({ ...batchResult, targetMailboxId }),
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
logger.error({ error, emailIds }, 'Exception in batch_move');
|
|
281
|
+
return {
|
|
282
|
+
isError: true,
|
|
283
|
+
content: [
|
|
284
|
+
{
|
|
285
|
+
type: 'text',
|
|
286
|
+
text: `Error batch moving emails: ${error instanceof Error ? error.message : String(error)}`,
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
// batch_delete - permanently destroy or move to Trash multiple emails
|
|
293
|
+
server.registerTool('batch_delete', {
|
|
294
|
+
title: 'Batch Delete Emails',
|
|
295
|
+
description: 'Delete multiple emails in a single operation. By default moves to Trash. Use permanent=true to permanently destroy.',
|
|
296
|
+
inputSchema: {
|
|
297
|
+
emailIds: z
|
|
298
|
+
.array(z.string())
|
|
299
|
+
.min(1, 'At least one email ID required')
|
|
300
|
+
.max(50, 'Maximum 50 emails per batch operation')
|
|
301
|
+
.describe('Array of email IDs to delete (max 50)'),
|
|
302
|
+
permanent: z
|
|
303
|
+
.boolean()
|
|
304
|
+
.default(false)
|
|
305
|
+
.describe('If true, permanently destroy the emails. Default: false (move to Trash)'),
|
|
306
|
+
},
|
|
307
|
+
annotations: BATCH_DESTRUCTIVE_ANNOTATIONS,
|
|
308
|
+
}, async ({ emailIds, permanent }) => {
|
|
309
|
+
logger.debug({ emailIds, count: emailIds.length, permanent }, 'batch_delete called');
|
|
310
|
+
try {
|
|
311
|
+
const session = jmapClient.getSession();
|
|
312
|
+
if (permanent) {
|
|
313
|
+
// Permanent delete using destroy
|
|
314
|
+
const response = await jmapClient.request([
|
|
315
|
+
[
|
|
316
|
+
'Email/set',
|
|
317
|
+
{
|
|
318
|
+
accountId: session.accountId,
|
|
319
|
+
destroy: emailIds,
|
|
320
|
+
},
|
|
321
|
+
'batchDestroy',
|
|
322
|
+
],
|
|
323
|
+
]);
|
|
324
|
+
const result = jmapClient.parseMethodResponse(response.methodResponses[0]);
|
|
325
|
+
if (!result.success) {
|
|
326
|
+
logger.error({ error: result.error, emailIds }, 'JMAP error in batch_delete (permanent)');
|
|
327
|
+
return {
|
|
328
|
+
isError: true,
|
|
329
|
+
content: [
|
|
330
|
+
{
|
|
331
|
+
type: 'text',
|
|
332
|
+
text: `Failed to batch delete emails: ${result.error?.description || result.error?.type || 'Unknown error'}`,
|
|
333
|
+
},
|
|
334
|
+
],
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
const setResponse = result.data;
|
|
338
|
+
const batchResult = buildBatchDestroyResult(emailIds, setResponse.destroyed, setResponse.notDestroyed);
|
|
339
|
+
logger.debug({ succeeded: batchResult.succeeded, failed: batchResult.failed }, 'batch_delete (permanent) complete');
|
|
340
|
+
return {
|
|
341
|
+
content: [
|
|
342
|
+
{
|
|
343
|
+
type: 'text',
|
|
344
|
+
text: JSON.stringify({ ...batchResult, action: 'permanently_deleted' }),
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
// Move to Trash - query Trash mailbox ONCE
|
|
351
|
+
const mailboxResponse = await jmapClient.request([
|
|
352
|
+
[
|
|
353
|
+
'Mailbox/query',
|
|
354
|
+
{
|
|
355
|
+
accountId: session.accountId,
|
|
356
|
+
filter: { role: 'trash' },
|
|
357
|
+
},
|
|
358
|
+
'findTrash',
|
|
359
|
+
],
|
|
360
|
+
]);
|
|
361
|
+
const queryResult = jmapClient.parseMethodResponse(mailboxResponse.methodResponses[0]);
|
|
362
|
+
if (!queryResult.success) {
|
|
363
|
+
logger.error({ error: queryResult.error }, 'JMAP error finding Trash mailbox');
|
|
364
|
+
return {
|
|
365
|
+
isError: true,
|
|
366
|
+
content: [
|
|
367
|
+
{
|
|
368
|
+
type: 'text',
|
|
369
|
+
text: 'Failed to find Trash mailbox',
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
const trashIds = queryResult.data.ids;
|
|
375
|
+
if (!trashIds || trashIds.length === 0) {
|
|
376
|
+
// No Trash mailbox found - fall back to permanent delete
|
|
377
|
+
logger.warn({ emailIds }, 'No Trash mailbox found, performing permanent delete');
|
|
378
|
+
const destroyResponse = await jmapClient.request([
|
|
379
|
+
[
|
|
380
|
+
'Email/set',
|
|
381
|
+
{
|
|
382
|
+
accountId: session.accountId,
|
|
383
|
+
destroy: emailIds,
|
|
384
|
+
},
|
|
385
|
+
'batchDestroyFallback',
|
|
386
|
+
],
|
|
387
|
+
]);
|
|
388
|
+
const destroyResult = jmapClient.parseMethodResponse(destroyResponse.methodResponses[0]);
|
|
389
|
+
if (!destroyResult.success) {
|
|
390
|
+
logger.error({ error: destroyResult.error, emailIds }, 'JMAP error in batch_delete (fallback)');
|
|
391
|
+
return {
|
|
392
|
+
isError: true,
|
|
393
|
+
content: [
|
|
394
|
+
{
|
|
395
|
+
type: 'text',
|
|
396
|
+
text: `Failed to batch delete emails: ${destroyResult.error?.description || destroyResult.error?.type || 'Unknown error'}`,
|
|
397
|
+
},
|
|
398
|
+
],
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
const destroySetResponse = destroyResult.data;
|
|
402
|
+
const batchResult = buildBatchDestroyResult(emailIds, destroySetResponse.destroyed, destroySetResponse.notDestroyed);
|
|
403
|
+
return {
|
|
404
|
+
content: [
|
|
405
|
+
{
|
|
406
|
+
type: 'text',
|
|
407
|
+
text: JSON.stringify({ ...batchResult, action: 'permanently_deleted' }),
|
|
408
|
+
},
|
|
409
|
+
],
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
const trashMailboxId = trashIds[0];
|
|
413
|
+
// Build update map to move all emails to Trash
|
|
414
|
+
const updateMap = {};
|
|
415
|
+
for (const emailId of emailIds) {
|
|
416
|
+
updateMap[emailId] = { mailboxIds: { [trashMailboxId]: true } };
|
|
417
|
+
}
|
|
418
|
+
const moveResponse = await jmapClient.request([
|
|
419
|
+
[
|
|
420
|
+
'Email/set',
|
|
421
|
+
{
|
|
422
|
+
accountId: session.accountId,
|
|
423
|
+
update: updateMap,
|
|
424
|
+
},
|
|
425
|
+
'batchMoveToTrash',
|
|
426
|
+
],
|
|
427
|
+
]);
|
|
428
|
+
const moveResult = jmapClient.parseMethodResponse(moveResponse.methodResponses[0]);
|
|
429
|
+
if (!moveResult.success) {
|
|
430
|
+
logger.error({ error: moveResult.error, emailIds }, 'JMAP error in batch_delete (move)');
|
|
431
|
+
return {
|
|
432
|
+
isError: true,
|
|
433
|
+
content: [
|
|
434
|
+
{
|
|
435
|
+
type: 'text',
|
|
436
|
+
text: `Failed to batch move emails to Trash: ${moveResult.error?.description || moveResult.error?.type || 'Unknown error'}`,
|
|
437
|
+
},
|
|
438
|
+
],
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
const setResponse = moveResult.data;
|
|
442
|
+
const batchResult = buildBatchResult(emailIds, setResponse.updated, setResponse.notUpdated);
|
|
443
|
+
logger.debug({ succeeded: batchResult.succeeded, failed: batchResult.failed, trashMailboxId }, 'batch_delete (move to Trash) complete');
|
|
444
|
+
return {
|
|
445
|
+
content: [
|
|
446
|
+
{
|
|
447
|
+
type: 'text',
|
|
448
|
+
text: JSON.stringify({ ...batchResult, action: 'moved_to_trash' }),
|
|
449
|
+
},
|
|
450
|
+
],
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
catch (error) {
|
|
455
|
+
logger.error({ error, emailIds }, 'Exception in batch_delete');
|
|
456
|
+
return {
|
|
457
|
+
isError: true,
|
|
458
|
+
content: [
|
|
459
|
+
{
|
|
460
|
+
type: 'text',
|
|
461
|
+
text: `Error batch deleting emails: ${error instanceof Error ? error.message : String(error)}`,
|
|
462
|
+
},
|
|
463
|
+
],
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
// batch_add_label - add a mailbox to multiple emails without removing existing ones
|
|
468
|
+
server.registerTool('batch_add_label', {
|
|
469
|
+
title: 'Batch Add Label to Emails',
|
|
470
|
+
description: 'Add a label (mailbox) to multiple emails without removing existing labels.',
|
|
471
|
+
inputSchema: {
|
|
472
|
+
emailIds: z
|
|
473
|
+
.array(z.string())
|
|
474
|
+
.min(1, 'At least one email ID required')
|
|
475
|
+
.max(50, 'Maximum 50 emails per batch operation')
|
|
476
|
+
.describe('Array of email IDs to add the label to (max 50)'),
|
|
477
|
+
mailboxId: z.string().describe('The ID of the mailbox (label) to add'),
|
|
478
|
+
},
|
|
479
|
+
annotations: BATCH_WRITE_ANNOTATIONS,
|
|
480
|
+
}, async ({ emailIds, mailboxId }) => {
|
|
481
|
+
logger.debug({ emailIds, count: emailIds.length, mailboxId }, 'batch_add_label called');
|
|
482
|
+
try {
|
|
483
|
+
const session = jmapClient.getSession();
|
|
484
|
+
// Build update map using path syntax to add label without removing others
|
|
485
|
+
const updateMap = {};
|
|
486
|
+
for (const emailId of emailIds) {
|
|
487
|
+
updateMap[emailId] = { [`mailboxIds/${mailboxId}`]: true };
|
|
488
|
+
}
|
|
489
|
+
const response = await jmapClient.request([
|
|
490
|
+
[
|
|
491
|
+
'Email/set',
|
|
492
|
+
{
|
|
493
|
+
accountId: session.accountId,
|
|
494
|
+
update: updateMap,
|
|
495
|
+
},
|
|
496
|
+
'batchAddLabel',
|
|
497
|
+
],
|
|
498
|
+
]);
|
|
499
|
+
const result = jmapClient.parseMethodResponse(response.methodResponses[0]);
|
|
500
|
+
if (!result.success) {
|
|
501
|
+
logger.error({ error: result.error, emailIds }, 'JMAP error in batch_add_label');
|
|
502
|
+
return {
|
|
503
|
+
isError: true,
|
|
504
|
+
content: [
|
|
505
|
+
{
|
|
506
|
+
type: 'text',
|
|
507
|
+
text: `Failed to batch add label: ${result.error?.description || result.error?.type || 'Unknown error'}`,
|
|
508
|
+
},
|
|
509
|
+
],
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
const setResponse = result.data;
|
|
513
|
+
const batchResult = buildBatchResult(emailIds, setResponse.updated, setResponse.notUpdated);
|
|
514
|
+
logger.debug({ succeeded: batchResult.succeeded, failed: batchResult.failed, mailboxId }, 'batch_add_label complete');
|
|
515
|
+
return {
|
|
516
|
+
content: [
|
|
517
|
+
{
|
|
518
|
+
type: 'text',
|
|
519
|
+
text: JSON.stringify({ ...batchResult, mailboxId }),
|
|
520
|
+
},
|
|
521
|
+
],
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
catch (error) {
|
|
525
|
+
logger.error({ error, emailIds }, 'Exception in batch_add_label');
|
|
526
|
+
return {
|
|
527
|
+
isError: true,
|
|
528
|
+
content: [
|
|
529
|
+
{
|
|
530
|
+
type: 'text',
|
|
531
|
+
text: `Error batch adding label: ${error instanceof Error ? error.message : String(error)}`,
|
|
532
|
+
},
|
|
533
|
+
],
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
// batch_remove_label - remove a mailbox from multiple emails
|
|
538
|
+
server.registerTool('batch_remove_label', {
|
|
539
|
+
title: 'Batch Remove Label from Emails',
|
|
540
|
+
description: 'Remove a label (mailbox) from multiple emails. Emails must belong to at least one mailbox.',
|
|
541
|
+
inputSchema: {
|
|
542
|
+
emailIds: z
|
|
543
|
+
.array(z.string())
|
|
544
|
+
.min(1, 'At least one email ID required')
|
|
545
|
+
.max(50, 'Maximum 50 emails per batch operation')
|
|
546
|
+
.describe('Array of email IDs to remove the label from (max 50)'),
|
|
547
|
+
mailboxId: z.string().describe('The ID of the mailbox (label) to remove'),
|
|
548
|
+
},
|
|
549
|
+
annotations: BATCH_WRITE_ANNOTATIONS,
|
|
550
|
+
}, async ({ emailIds, mailboxId }) => {
|
|
551
|
+
logger.debug({ emailIds, count: emailIds.length, mailboxId }, 'batch_remove_label called');
|
|
552
|
+
try {
|
|
553
|
+
const session = jmapClient.getSession();
|
|
554
|
+
// Build update map using path syntax to remove label
|
|
555
|
+
const updateMap = {};
|
|
556
|
+
for (const emailId of emailIds) {
|
|
557
|
+
updateMap[emailId] = { [`mailboxIds/${mailboxId}`]: null };
|
|
558
|
+
}
|
|
559
|
+
const response = await jmapClient.request([
|
|
560
|
+
[
|
|
561
|
+
'Email/set',
|
|
562
|
+
{
|
|
563
|
+
accountId: session.accountId,
|
|
564
|
+
update: updateMap,
|
|
565
|
+
},
|
|
566
|
+
'batchRemoveLabel',
|
|
567
|
+
],
|
|
568
|
+
]);
|
|
569
|
+
const result = jmapClient.parseMethodResponse(response.methodResponses[0]);
|
|
570
|
+
if (!result.success) {
|
|
571
|
+
logger.error({ error: result.error, emailIds }, 'JMAP error in batch_remove_label');
|
|
572
|
+
return {
|
|
573
|
+
isError: true,
|
|
574
|
+
content: [
|
|
575
|
+
{
|
|
576
|
+
type: 'text',
|
|
577
|
+
text: `Failed to batch remove label: ${result.error?.description || result.error?.type || 'Unknown error'}`,
|
|
578
|
+
},
|
|
579
|
+
],
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
const setResponse = result.data;
|
|
583
|
+
const batchResult = buildBatchResult(emailIds, setResponse.updated, setResponse.notUpdated);
|
|
584
|
+
logger.debug({ succeeded: batchResult.succeeded, failed: batchResult.failed, mailboxId }, 'batch_remove_label complete');
|
|
585
|
+
return {
|
|
586
|
+
content: [
|
|
587
|
+
{
|
|
588
|
+
type: 'text',
|
|
589
|
+
text: JSON.stringify({ ...batchResult, mailboxId }),
|
|
590
|
+
},
|
|
591
|
+
],
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
catch (error) {
|
|
595
|
+
logger.error({ error, emailIds }, 'Exception in batch_remove_label');
|
|
596
|
+
return {
|
|
597
|
+
isError: true,
|
|
598
|
+
content: [
|
|
599
|
+
{
|
|
600
|
+
type: 'text',
|
|
601
|
+
text: `Error batch removing label: ${error instanceof Error ? error.message : String(error)}`,
|
|
602
|
+
},
|
|
603
|
+
],
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
});
|
|
607
|
+
logger.debug('Batch operation tools registered: batch_mark_read, batch_mark_unread, batch_move, batch_delete, batch_add_label, batch_remove_label');
|
|
608
|
+
}
|
|
609
|
+
//# sourceMappingURL=batch-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-operations.js","sourceRoot":"","sources":["../../../src/mcp/tools/batch-operations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB;;GAEG;AACH,MAAM,uBAAuB,GAAoB;IAC/C,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,KAAK;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,6BAA6B,GAAoB;IACrD,YAAY,EAAE,KAAK;IACnB,eAAe,EAAE,IAAI;IACrB,cAAc,EAAE,KAAK,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