google-tools-mcp 1.2.7 → 1.2.8

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.
@@ -373,16 +373,26 @@ export function register(server) {
373
373
 
374
374
  server.addTool({
375
375
  name: 'trash_message',
376
- description: 'Move a message to the trash or restore it. Use action="trash" to move to trash, action="untrash" to restore.',
376
+ description: 'Move one or more messages to the trash or restore them. Pass a single id or an array of ids.',
377
377
  parameters: z.object({
378
- id: z.string().describe("The ID of the message"),
378
+ ids: z.union([z.string(), z.array(z.string())]).describe("Message ID or array of message IDs"),
379
379
  action: z.enum(['trash', 'untrash']).describe("'trash' to move to trash, 'untrash' to restore"),
380
380
  }),
381
381
  execute: async (params) => {
382
382
  const gmail = await getGmailClient();
383
+ const ids = Array.isArray(params.ids) ? params.ids : [params.ids];
383
384
  const fn = params.action === 'untrash' ? 'untrash' : 'trash';
384
- const { data } = await gmail.users.messages[fn]({ userId: 'me', id: params.id });
385
- return JSON.stringify(data);
385
+ const results = await Promise.all(
386
+ ids.map(async (id) => {
387
+ try {
388
+ const { data } = await gmail.users.messages[fn]({ userId: 'me', id });
389
+ return data;
390
+ } catch (e) {
391
+ return { id, error: e.message || `Failed to ${fn} message` };
392
+ }
393
+ })
394
+ );
395
+ return JSON.stringify(ids.length === 1 ? results[0] : results);
386
396
  },
387
397
  });
388
398
 
@@ -139,16 +139,26 @@ export function register(server) {
139
139
 
140
140
  server.addTool({
141
141
  name: 'trash_thread',
142
- description: 'Move a thread to the trash or restore it. Use action="trash" to move to trash, action="untrash" to restore.',
142
+ description: 'Move one or more threads to the trash or restore them. Pass a single id or an array of ids.',
143
143
  parameters: z.object({
144
- id: z.string().describe("The ID of the thread"),
144
+ ids: z.union([z.string(), z.array(z.string())]).describe("Thread ID or array of thread IDs"),
145
145
  action: z.enum(['trash', 'untrash']).describe("'trash' to move to trash, 'untrash' to restore"),
146
146
  }),
147
147
  execute: async (params) => {
148
148
  const gmail = await getGmailClient();
149
+ const ids = Array.isArray(params.ids) ? params.ids : [params.ids];
149
150
  const fn = params.action === 'untrash' ? 'untrash' : 'trash';
150
- const { data } = await gmail.users.threads[fn]({ userId: 'me', id: params.id });
151
- return JSON.stringify(data);
151
+ const results = await Promise.all(
152
+ ids.map(async (id) => {
153
+ try {
154
+ const { data } = await gmail.users.threads[fn]({ userId: 'me', id });
155
+ return data;
156
+ } catch (e) {
157
+ return { id, error: e.message || `Failed to ${fn} thread` };
158
+ }
159
+ })
160
+ );
161
+ return JSON.stringify(ids.length === 1 ? results[0] : results);
152
162
  },
153
163
  });
154
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "google-tools-mcp",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "The easiest MCP server for Google Workspace — Drive, Docs, Sheets, Gmail, Calendar, and Forms. 153 tools with one-click browser auth. Read Word docs, PDFs, and spreadsheets straight from Drive.",
5
5
  "type": "module",
6
6
  "bin": {