@node2flow/gmail-mcp 1.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/src/tools.ts ADDED
@@ -0,0 +1,474 @@
1
+ /**
2
+ * 28 Gmail MCP Tool Definitions
3
+ */
4
+
5
+ import type { MCPToolDefinition } from './types.js';
6
+
7
+ export const TOOLS: MCPToolDefinition[] = [
8
+ // ========== Messages (10) ==========
9
+ {
10
+ name: 'gmail_list_messages',
11
+ description: 'List messages in the mailbox. Supports Gmail search syntax for filtering (e.g., from:, to:, subject:, is:unread, has:attachment).',
12
+ inputSchema: {
13
+ type: 'object',
14
+ properties: {
15
+ q: { type: 'string', description: 'Gmail search query (e.g., "from:user@example.com is:unread", "subject:meeting has:attachment", "after:2026/01/01")' },
16
+ label_ids: {
17
+ type: 'array',
18
+ description: 'Filter by label IDs (e.g., ["INBOX"], ["UNREAD"]). System labels: INBOX, SENT, DRAFT, SPAM, TRASH, UNREAD, STARRED, IMPORTANT',
19
+ items: { type: 'string' },
20
+ },
21
+ max_results: { type: 'number', description: 'Maximum number of messages to return (default: 100, max: 500)' },
22
+ page_token: { type: 'string', description: 'Token for next page of results (from previous response nextPageToken)' },
23
+ include_spam_trash: { type: 'boolean', description: 'Include messages from SPAM and TRASH (default: false)' },
24
+ },
25
+ },
26
+ annotations: { title: 'List Messages', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
27
+ },
28
+ {
29
+ name: 'gmail_get_message',
30
+ description: 'Get a specific message by ID. Returns headers, body, labels, and metadata. Use format=full for parsed body or format=raw for RFC 2822.',
31
+ inputSchema: {
32
+ type: 'object',
33
+ properties: {
34
+ id: { type: 'string', description: 'The message ID (from gmail_list_messages)' },
35
+ format: {
36
+ type: 'string',
37
+ description: 'Response format: full (parsed body), metadata (headers only), minimal (IDs and labels), raw (RFC 2822 base64url)',
38
+ enum: ['full', 'metadata', 'minimal', 'raw'],
39
+ },
40
+ metadata_headers: {
41
+ type: 'array',
42
+ description: 'Specific headers to include when format=metadata (e.g., ["From", "To", "Subject", "Date"])',
43
+ items: { type: 'string' },
44
+ },
45
+ },
46
+ required: ['id'],
47
+ },
48
+ annotations: { title: 'Get Message', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
49
+ },
50
+ {
51
+ name: 'gmail_send_message',
52
+ description: 'Send an email message. Supports plain text and HTML body, CC, BCC, and replying to threads.',
53
+ inputSchema: {
54
+ type: 'object',
55
+ properties: {
56
+ to: { type: 'string', description: 'Recipient email address(es), comma-separated for multiple' },
57
+ subject: { type: 'string', description: 'Email subject line' },
58
+ body: { type: 'string', description: 'Plain text body of the email' },
59
+ cc: { type: 'string', description: 'CC recipient(s), comma-separated' },
60
+ bcc: { type: 'string', description: 'BCC recipient(s), comma-separated' },
61
+ html: { type: 'string', description: 'HTML body (sent as multipart/alternative with plain text)' },
62
+ in_reply_to: { type: 'string', description: 'Message-ID header of the message being replied to' },
63
+ references: { type: 'string', description: 'References header for threading (space-separated Message-IDs)' },
64
+ thread_id: { type: 'string', description: 'Thread ID to add this message to (for replies)' },
65
+ },
66
+ required: ['to', 'subject', 'body'],
67
+ },
68
+ annotations: { title: 'Send Message', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
69
+ },
70
+ {
71
+ name: 'gmail_delete_message',
72
+ description: 'Permanently delete a message. This action is irreversible — use gmail_trash_message for safe deletion.',
73
+ inputSchema: {
74
+ type: 'object',
75
+ properties: {
76
+ id: { type: 'string', description: 'The message ID to permanently delete' },
77
+ },
78
+ required: ['id'],
79
+ },
80
+ annotations: { title: 'Delete Message', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
81
+ },
82
+ {
83
+ name: 'gmail_trash_message',
84
+ description: 'Move a message to the trash. Can be undone with gmail_untrash_message.',
85
+ inputSchema: {
86
+ type: 'object',
87
+ properties: {
88
+ id: { type: 'string', description: 'The message ID to move to trash' },
89
+ },
90
+ required: ['id'],
91
+ },
92
+ annotations: { title: 'Trash Message', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
93
+ },
94
+ {
95
+ name: 'gmail_untrash_message',
96
+ description: 'Remove a message from the trash, restoring it to its original location.',
97
+ inputSchema: {
98
+ type: 'object',
99
+ properties: {
100
+ id: { type: 'string', description: 'The message ID to remove from trash' },
101
+ },
102
+ required: ['id'],
103
+ },
104
+ annotations: { title: 'Untrash Message', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
105
+ },
106
+ {
107
+ name: 'gmail_modify_message',
108
+ description: 'Add or remove labels on a message. Use this to mark as read/unread, star/unstar, or apply custom labels.',
109
+ inputSchema: {
110
+ type: 'object',
111
+ properties: {
112
+ id: { type: 'string', description: 'The message ID to modify' },
113
+ add_label_ids: {
114
+ type: 'array',
115
+ description: 'Label IDs to add (e.g., ["STARRED", "IMPORTANT"] or custom label IDs)',
116
+ items: { type: 'string' },
117
+ },
118
+ remove_label_ids: {
119
+ type: 'array',
120
+ description: 'Label IDs to remove (e.g., ["UNREAD"] to mark as read)',
121
+ items: { type: 'string' },
122
+ },
123
+ },
124
+ required: ['id'],
125
+ },
126
+ annotations: { title: 'Modify Message Labels', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
127
+ },
128
+ {
129
+ name: 'gmail_batch_delete',
130
+ description: 'Permanently delete multiple messages at once. Maximum 1000 IDs per request. Irreversible.',
131
+ inputSchema: {
132
+ type: 'object',
133
+ properties: {
134
+ ids: {
135
+ type: 'array',
136
+ description: 'Array of message IDs to permanently delete (max 1000)',
137
+ items: { type: 'string' },
138
+ },
139
+ },
140
+ required: ['ids'],
141
+ },
142
+ annotations: { title: 'Batch Delete Messages', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
143
+ },
144
+ {
145
+ name: 'gmail_batch_modify',
146
+ description: 'Add or remove labels on multiple messages at once. Maximum 1000 IDs per request.',
147
+ inputSchema: {
148
+ type: 'object',
149
+ properties: {
150
+ ids: {
151
+ type: 'array',
152
+ description: 'Array of message IDs to modify (max 1000)',
153
+ items: { type: 'string' },
154
+ },
155
+ add_label_ids: {
156
+ type: 'array',
157
+ description: 'Label IDs to add to all specified messages',
158
+ items: { type: 'string' },
159
+ },
160
+ remove_label_ids: {
161
+ type: 'array',
162
+ description: 'Label IDs to remove from all specified messages',
163
+ items: { type: 'string' },
164
+ },
165
+ },
166
+ required: ['ids'],
167
+ },
168
+ annotations: { title: 'Batch Modify Messages', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
169
+ },
170
+ {
171
+ name: 'gmail_get_attachment',
172
+ description: 'Get attachment data for a message. Returns base64url-encoded data. Find attachment IDs in the message payload parts.',
173
+ inputSchema: {
174
+ type: 'object',
175
+ properties: {
176
+ message_id: { type: 'string', description: 'The message ID containing the attachment' },
177
+ attachment_id: { type: 'string', description: 'The attachment ID (from message payload.parts[].body.attachmentId)' },
178
+ },
179
+ required: ['message_id', 'attachment_id'],
180
+ },
181
+ annotations: { title: 'Get Attachment', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
182
+ },
183
+
184
+ // ========== Drafts (6) ==========
185
+ {
186
+ name: 'gmail_list_drafts',
187
+ description: 'List all drafts in the mailbox.',
188
+ inputSchema: {
189
+ type: 'object',
190
+ properties: {
191
+ max_results: { type: 'number', description: 'Maximum number of drafts to return (default: 100, max: 500)' },
192
+ page_token: { type: 'string', description: 'Token for next page of results' },
193
+ q: { type: 'string', description: 'Gmail search query to filter drafts' },
194
+ },
195
+ },
196
+ annotations: { title: 'List Drafts', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
197
+ },
198
+ {
199
+ name: 'gmail_get_draft',
200
+ description: 'Get a specific draft by ID, including the draft message content.',
201
+ inputSchema: {
202
+ type: 'object',
203
+ properties: {
204
+ id: { type: 'string', description: 'The draft ID (from gmail_list_drafts)' },
205
+ format: {
206
+ type: 'string',
207
+ description: 'Response format for the draft message',
208
+ enum: ['full', 'metadata', 'minimal', 'raw'],
209
+ },
210
+ },
211
+ required: ['id'],
212
+ },
213
+ annotations: { title: 'Get Draft', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
214
+ },
215
+ {
216
+ name: 'gmail_create_draft',
217
+ description: 'Create a new draft email. The draft can be sent later with gmail_send_draft.',
218
+ inputSchema: {
219
+ type: 'object',
220
+ properties: {
221
+ to: { type: 'string', description: 'Recipient email address(es), comma-separated' },
222
+ subject: { type: 'string', description: 'Email subject line' },
223
+ body: { type: 'string', description: 'Plain text body' },
224
+ cc: { type: 'string', description: 'CC recipient(s), comma-separated' },
225
+ bcc: { type: 'string', description: 'BCC recipient(s), comma-separated' },
226
+ html: { type: 'string', description: 'HTML body (sent as multipart/alternative with plain text)' },
227
+ thread_id: { type: 'string', description: 'Thread ID to associate this draft with (for reply drafts)' },
228
+ },
229
+ required: ['to', 'subject', 'body'],
230
+ },
231
+ annotations: { title: 'Create Draft', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
232
+ },
233
+ {
234
+ name: 'gmail_update_draft',
235
+ description: 'Update an existing draft with new content. Replaces the entire draft message.',
236
+ inputSchema: {
237
+ type: 'object',
238
+ properties: {
239
+ id: { type: 'string', description: 'The draft ID to update' },
240
+ to: { type: 'string', description: 'Recipient email address(es), comma-separated' },
241
+ subject: { type: 'string', description: 'Email subject line' },
242
+ body: { type: 'string', description: 'Plain text body' },
243
+ cc: { type: 'string', description: 'CC recipient(s), comma-separated' },
244
+ bcc: { type: 'string', description: 'BCC recipient(s), comma-separated' },
245
+ html: { type: 'string', description: 'HTML body (sent as multipart/alternative with plain text)' },
246
+ thread_id: { type: 'string', description: 'Thread ID to associate this draft with' },
247
+ },
248
+ required: ['id', 'to', 'subject', 'body'],
249
+ },
250
+ annotations: { title: 'Update Draft', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
251
+ },
252
+ {
253
+ name: 'gmail_delete_draft',
254
+ description: 'Delete a draft. This permanently removes the draft.',
255
+ inputSchema: {
256
+ type: 'object',
257
+ properties: {
258
+ id: { type: 'string', description: 'The draft ID to delete' },
259
+ },
260
+ required: ['id'],
261
+ },
262
+ annotations: { title: 'Delete Draft', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
263
+ },
264
+ {
265
+ name: 'gmail_send_draft',
266
+ description: 'Send an existing draft. The draft is removed from the drafts list after sending.',
267
+ inputSchema: {
268
+ type: 'object',
269
+ properties: {
270
+ id: { type: 'string', description: 'The draft ID to send' },
271
+ },
272
+ required: ['id'],
273
+ },
274
+ annotations: { title: 'Send Draft', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
275
+ },
276
+
277
+ // ========== Labels (5) ==========
278
+ {
279
+ name: 'gmail_list_labels',
280
+ description: 'List all labels in the mailbox, including system labels (INBOX, SENT, etc.) and user-created labels.',
281
+ inputSchema: {
282
+ type: 'object',
283
+ properties: {},
284
+ },
285
+ annotations: { title: 'List Labels', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
286
+ },
287
+ {
288
+ name: 'gmail_get_label',
289
+ description: 'Get details for a specific label, including message and thread counts.',
290
+ inputSchema: {
291
+ type: 'object',
292
+ properties: {
293
+ id: { type: 'string', description: 'The label ID (from gmail_list_labels, e.g., "INBOX", "Label_1")' },
294
+ },
295
+ required: ['id'],
296
+ },
297
+ annotations: { title: 'Get Label', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
298
+ },
299
+ {
300
+ name: 'gmail_create_label',
301
+ description: 'Create a new user label for organizing messages.',
302
+ inputSchema: {
303
+ type: 'object',
304
+ properties: {
305
+ name: { type: 'string', description: 'Label name (use "/" for nested labels, e.g., "Projects/Active")' },
306
+ message_list_visibility: {
307
+ type: 'string',
308
+ description: 'Whether messages with this label show in the message list',
309
+ enum: ['show', 'hide'],
310
+ },
311
+ label_list_visibility: {
312
+ type: 'string',
313
+ description: 'Whether this label shows in the label list',
314
+ enum: ['labelShow', 'labelShowIfUnread', 'labelHide'],
315
+ },
316
+ background_color: { type: 'string', description: 'Background color hex (e.g., "#16a765")' },
317
+ text_color: { type: 'string', description: 'Text color hex (e.g., "#ffffff")' },
318
+ },
319
+ required: ['name'],
320
+ },
321
+ annotations: { title: 'Create Label', readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
322
+ },
323
+ {
324
+ name: 'gmail_update_label',
325
+ description: 'Update a label name, visibility, or color.',
326
+ inputSchema: {
327
+ type: 'object',
328
+ properties: {
329
+ id: { type: 'string', description: 'The label ID to update' },
330
+ name: { type: 'string', description: 'New label name' },
331
+ message_list_visibility: {
332
+ type: 'string',
333
+ description: 'Whether messages with this label show in the message list',
334
+ enum: ['show', 'hide'],
335
+ },
336
+ label_list_visibility: {
337
+ type: 'string',
338
+ description: 'Whether this label shows in the label list',
339
+ enum: ['labelShow', 'labelShowIfUnread', 'labelHide'],
340
+ },
341
+ background_color: { type: 'string', description: 'Background color hex (e.g., "#16a765")' },
342
+ text_color: { type: 'string', description: 'Text color hex (e.g., "#ffffff")' },
343
+ },
344
+ required: ['id'],
345
+ },
346
+ annotations: { title: 'Update Label', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
347
+ },
348
+ {
349
+ name: 'gmail_delete_label',
350
+ description: 'Delete a user-created label. System labels cannot be deleted. Messages with this label are not deleted.',
351
+ inputSchema: {
352
+ type: 'object',
353
+ properties: {
354
+ id: { type: 'string', description: 'The label ID to delete (must be a user-created label)' },
355
+ },
356
+ required: ['id'],
357
+ },
358
+ annotations: { title: 'Delete Label', readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
359
+ },
360
+
361
+ // ========== Threads (5) ==========
362
+ {
363
+ name: 'gmail_list_threads',
364
+ description: 'List email threads (conversations). Supports the same search syntax as gmail_list_messages.',
365
+ inputSchema: {
366
+ type: 'object',
367
+ properties: {
368
+ q: { type: 'string', description: 'Gmail search query (e.g., "from:user@example.com", "subject:meeting is:unread")' },
369
+ label_ids: {
370
+ type: 'array',
371
+ description: 'Filter by label IDs (e.g., ["INBOX"])',
372
+ items: { type: 'string' },
373
+ },
374
+ max_results: { type: 'number', description: 'Maximum number of threads to return (default: 100, max: 500)' },
375
+ page_token: { type: 'string', description: 'Token for next page of results' },
376
+ include_spam_trash: { type: 'boolean', description: 'Include threads from SPAM and TRASH (default: false)' },
377
+ },
378
+ },
379
+ annotations: { title: 'List Threads', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
380
+ },
381
+ {
382
+ name: 'gmail_get_thread',
383
+ description: 'Get all messages in a thread (conversation). Returns the complete email chain.',
384
+ inputSchema: {
385
+ type: 'object',
386
+ properties: {
387
+ id: { type: 'string', description: 'The thread ID (from gmail_list_threads or message.threadId)' },
388
+ format: {
389
+ type: 'string',
390
+ description: 'Response format for thread messages',
391
+ enum: ['full', 'metadata', 'minimal'],
392
+ },
393
+ },
394
+ required: ['id'],
395
+ },
396
+ annotations: { title: 'Get Thread', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
397
+ },
398
+ {
399
+ name: 'gmail_modify_thread',
400
+ description: 'Add or remove labels on all messages in a thread.',
401
+ inputSchema: {
402
+ type: 'object',
403
+ properties: {
404
+ id: { type: 'string', description: 'The thread ID to modify' },
405
+ add_label_ids: {
406
+ type: 'array',
407
+ description: 'Label IDs to add to all messages in the thread',
408
+ items: { type: 'string' },
409
+ },
410
+ remove_label_ids: {
411
+ type: 'array',
412
+ description: 'Label IDs to remove from all messages in the thread',
413
+ items: { type: 'string' },
414
+ },
415
+ },
416
+ required: ['id'],
417
+ },
418
+ annotations: { title: 'Modify Thread Labels', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
419
+ },
420
+ {
421
+ name: 'gmail_trash_thread',
422
+ description: 'Move all messages in a thread to the trash.',
423
+ inputSchema: {
424
+ type: 'object',
425
+ properties: {
426
+ id: { type: 'string', description: 'The thread ID to move to trash' },
427
+ },
428
+ required: ['id'],
429
+ },
430
+ annotations: { title: 'Trash Thread', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
431
+ },
432
+ {
433
+ name: 'gmail_untrash_thread',
434
+ description: 'Remove all messages in a thread from the trash.',
435
+ inputSchema: {
436
+ type: 'object',
437
+ properties: {
438
+ id: { type: 'string', description: 'The thread ID to remove from trash' },
439
+ },
440
+ required: ['id'],
441
+ },
442
+ annotations: { title: 'Untrash Thread', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
443
+ },
444
+
445
+ // ========== Settings (2) ==========
446
+ {
447
+ name: 'gmail_get_profile',
448
+ description: 'Get the authenticated user\'s Gmail profile — email address, total message count, total thread count, and history ID.',
449
+ inputSchema: {
450
+ type: 'object',
451
+ properties: {},
452
+ },
453
+ annotations: { title: 'Get Profile', readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
454
+ },
455
+ {
456
+ name: 'gmail_update_vacation',
457
+ description: 'Enable or disable vacation auto-reply (out of office) with custom response message.',
458
+ inputSchema: {
459
+ type: 'object',
460
+ properties: {
461
+ enable_auto_reply: { type: 'boolean', description: 'Whether to enable the vacation auto-reply' },
462
+ response_subject: { type: 'string', description: 'Subject line for the auto-reply (optional, uses original subject if omitted)' },
463
+ response_body_plain_text: { type: 'string', description: 'Plain text body for the auto-reply' },
464
+ response_body_html: { type: 'string', description: 'HTML body for the auto-reply' },
465
+ restrict_to_contacts: { type: 'boolean', description: 'Only send auto-reply to people in contacts (default: false)' },
466
+ restrict_to_domain: { type: 'boolean', description: 'Only send auto-reply to same domain (default: false)' },
467
+ start_time: { type: 'string', description: 'Start time in epoch milliseconds (e.g., "1704067200000"). Omit for immediate start' },
468
+ end_time: { type: 'string', description: 'End time in epoch milliseconds. Omit for no end date' },
469
+ },
470
+ required: ['enable_auto_reply'],
471
+ },
472
+ annotations: { title: 'Update Vacation Settings', readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
473
+ },
474
+ ];