@mindstone/mcp-server-google-workspace 0.4.1 → 0.4.2

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 CHANGED
@@ -8,7 +8,7 @@ Google Workspace MCP server — Gmail, Calendar, Drive, Docs, Sheets, Slides, Co
8
8
 
9
9
  ## Status
10
10
 
11
- - **Version:** [0.4.1](./CHANGELOG.md) · npm: not yet published
11
+ - **Version:** [0.4.2](./CHANGELOG.md) · npm: not yet published
12
12
  - **Auth:** OAuth (host-orchestrated) ([`GOOGLE_CLIENT_SECRET`](./server.json))
13
13
  - **Tools:** [116](./src/tools/definitions/) (Gmail, Calendar, Drive, Docs, Sheets, Slides, Contacts, Chat, Meet, Tasks, Forms, Comments, Account)
14
14
  - **Surface:** cloud-api
@@ -123,7 +123,7 @@ export const gmailTools = [
123
123
 
124
124
  Gmail query syntax: from:, to:, subject:, has:attachment, is:unread, after:YYYY-MM-DD, before:YYYY-MM-DD, label:
125
125
 
126
- Use get_workspace_email_thread with a thread_id from results to get full conversation.`,
126
+ Each result shows its id (message id) and thread_id. Use get_workspace_email_thread with that thread_id (or the message id) to get the full conversation.`,
127
127
  aliases: ['search_emails', 'find_emails', 'query_emails'],
128
128
  annotations: { readOnlyHint: true },
129
129
  inputSchema: {
@@ -143,6 +143,14 @@ Use get_workspace_email_thread with a thread_id from results to get full convers
143
143
  type: 'number',
144
144
  description: 'Maximum emails to return (default: 10, max: 100)'
145
145
  },
146
+ limit: {
147
+ type: 'number',
148
+ description: 'Alias of max_results.'
149
+ },
150
+ max_messages: {
151
+ type: 'number',
152
+ description: 'Alias of max_results.'
153
+ },
146
154
  // COMMON FILTERS: Flat for ease of use
147
155
  from: {
148
156
  oneOf: [
@@ -333,7 +341,23 @@ Use get_workspace_email_thread with a thread_id from results to get full convers
333
341
  },
334
342
  thread_id: {
335
343
  type: 'string',
336
- description: 'Thread ID (from search results or message)'
344
+ description: 'Thread ID (the thread_id shown in search results). Give this OR message_id.'
345
+ },
346
+ threadId: {
347
+ type: 'string',
348
+ description: 'Alias of thread_id.'
349
+ },
350
+ message_id: {
351
+ type: 'string',
352
+ description: 'ID of any message in the thread (the id shown in search results). The thread is looked up from it. Ignored when thread_id is given.'
353
+ },
354
+ messageId: {
355
+ type: 'string',
356
+ description: 'Alias of message_id.'
357
+ },
358
+ id: {
359
+ type: 'string',
360
+ description: 'Alias of message_id.'
337
361
  },
338
362
  max_messages: {
339
363
  type: 'number',
@@ -356,7 +380,10 @@ Use get_workspace_email_thread with a thread_id from results to get full convers
356
380
  description: 'Return structured JSON instead of formatted text (default: false)'
357
381
  }
358
382
  },
359
- required: ['thread_id']
383
+ // One of thread_id / message_id is required; the handler enforces it so
384
+ // the aliases stay valid alone (no oneOf, which would disable strict
385
+ // unknown-field rejection in the SuperMCP gate).
386
+ required: []
360
387
  }
361
388
  },
362
389
  {
@@ -149,6 +149,9 @@ interface GetThreadParams {
149
149
  email?: string;
150
150
  thread_id?: string;
151
151
  threadId?: string;
152
+ message_id?: string;
153
+ messageId?: string;
154
+ id?: string;
152
155
  max_messages?: number;
153
156
  maxMessages?: number;
154
157
  offset?: number;
@@ -243,11 +243,11 @@ export function formatEmailsAsText(result) {
243
243
  const attachmentList = email.attachments.map(a => a.name).join(', ');
244
244
  lines.push(` Attachments: ${attachmentList}`);
245
245
  }
246
- lines.push(` [id: ${email.id}, thread: ${email.threadId}${labels ? `, labels: ${labels}` : ''}]`);
246
+ lines.push(` [id: ${email.id}, thread_id: ${email.threadId}${labels ? `, labels: ${labels}` : ''}]`);
247
247
  lines.push('');
248
248
  });
249
249
  if (result.nextPageToken) {
250
- lines.push(`More results available. Use pageToken: "${result.nextPageToken}" to continue.`);
250
+ lines.push(`More results available. Use page_token: "${result.nextPageToken}" to continue.`);
251
251
  }
252
252
  return wrapUntrustedContent(lines.join('\n'), 'google-workspace:gmail:search');
253
253
  }
@@ -379,6 +379,9 @@ export async function handleSearchWorkspaceEmails(params) {
379
379
  if ('limit' in unknownParams && mergedOptions.maxResults === undefined) {
380
380
  mergedOptions.maxResults = unknownParams.limit;
381
381
  }
382
+ if (typeof unknownParams.max_messages === 'number' && mergedOptions.maxResults === undefined) {
383
+ mergedOptions.maxResults = unknownParams.max_messages;
384
+ }
382
385
  const search = mergedSearch;
383
386
  const options = mergedOptions;
384
387
  // Normalize search.from - if it's a partial name (no @), convert to content query
@@ -472,7 +475,7 @@ export function formatThreadAsText(result, offset = 0, includeFullBodies = false
472
475
  export async function handleGetWorkspaceEmailThread(params) {
473
476
  await initializeServices();
474
477
  const rawParams = params;
475
- const threadId = readAliasedString(rawParams, 'thread_id', 'threadId');
478
+ const requestedThreadId = readAliasedString(rawParams, 'thread_id', 'threadId');
476
479
  const maxMessages = readAliasedNumber(rawParams, 'max_messages', 'maxMessages') ?? 50;
477
480
  const offset = typeof params.offset === 'number' ? params.offset : 0;
478
481
  const includeBody = readAliasedBoolean(rawParams, 'include_body', 'includeBody') ?? true;
@@ -480,12 +483,23 @@ export async function handleGetWorkspaceEmailThread(params) {
480
483
  const returnJson = readAliasedBoolean(rawParams, 'return_json', 'returnJson') ?? false;
481
484
  // Resolve email - uses instance account if not provided, validates if provided
482
485
  const email = await resolveEmail(params);
483
- if (!threadId) {
484
- throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter: "thread_id" (from search results or a message). ' +
486
+ const messageId = readAliasedString(rawParams, 'message_id', 'messageId') ?? readAliasedString(rawParams, 'message_id', 'id');
487
+ if (!requestedThreadId && !messageId) {
488
+ throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter: "thread_id" (the thread_id shown in search results) or "message_id" (any message id in the thread). ' +
485
489
  'Example: { "email": "user@example.com", "thread_id": "thread123" }');
486
490
  }
487
491
  return accountManager.withTokenRenewal(email, async () => {
488
492
  try {
493
+ let threadId = requestedThreadId;
494
+ if (!threadId) {
495
+ // A message id was given instead: one extra lookup finds its thread.
496
+ const message = await gmailService.getMessage(email, messageId);
497
+ if (!message) {
498
+ throw new McpError(ErrorCode.InvalidRequest, `Message not found: "${messageId}" does not exist in the ${email} mailbox. ` +
499
+ 'Use search_workspace_emails to find the email and pass its thread_id or id.');
500
+ }
501
+ threadId = message.threadId;
502
+ }
489
503
  const result = await gmailService.getThread(email, threadId, { maxMessages, offset, includeBody });
490
504
  if (returnJson) {
491
505
  // JSON path: when full bodies aren't requested, strip body content from
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindstone/mcp-server-google-workspace",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "mcpName": "io.github.mindstone/mcp-server-google-workspace",
5
5
  "description": "Google Workspace MCP server for Gmail, Calendar, Drive, Docs, Sheets, Slides, Contacts, Tasks, and Forms",
6
6
  "license": "FSL-1.1-MIT",