@mindstone/mcp-server-google-workspace 0.2.0 → 0.3.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.
Files changed (69) hide show
  1. package/README.md +14 -8
  2. package/dist/modules/chat/index.d.ts +12 -0
  3. package/dist/modules/chat/index.js +18 -0
  4. package/dist/modules/chat/scopes.d.ts +14 -0
  5. package/dist/modules/chat/scopes.js +32 -0
  6. package/dist/modules/chat/types.d.ts +88 -0
  7. package/dist/modules/chat/types.js +14 -0
  8. package/dist/modules/comments/service.js +21 -1
  9. package/dist/modules/contacts/scopes.d.ts +1 -0
  10. package/dist/modules/contacts/scopes.js +2 -2
  11. package/dist/modules/contacts/types.d.ts +34 -0
  12. package/dist/modules/docs/service.js +29 -1
  13. package/dist/modules/drive/activity-service.d.ts +45 -0
  14. package/dist/modules/drive/activity-service.js +114 -0
  15. package/dist/modules/drive/index.d.ts +4 -0
  16. package/dist/modules/drive/index.js +12 -0
  17. package/dist/modules/drive/scopes.d.ts +1 -0
  18. package/dist/modules/drive/scopes.js +3 -0
  19. package/dist/modules/forms/service.js +13 -1
  20. package/dist/modules/gmail/services/base.d.ts +5 -1
  21. package/dist/modules/gmail/services/base.js +8 -0
  22. package/dist/modules/gmail/services/settings.d.ts +14 -1
  23. package/dist/modules/gmail/services/settings.js +94 -0
  24. package/dist/modules/gmail/types.d.ts +36 -0
  25. package/dist/modules/meet/index.d.ts +12 -0
  26. package/dist/modules/meet/index.js +18 -0
  27. package/dist/modules/meet/scopes.d.ts +9 -0
  28. package/dist/modules/meet/scopes.js +25 -0
  29. package/dist/modules/meet/types.d.ts +97 -0
  30. package/dist/modules/meet/types.js +14 -0
  31. package/dist/modules/sheets/service.js +49 -0
  32. package/dist/modules/slides/service.js +25 -1
  33. package/dist/modules/tasks/service.js +25 -1
  34. package/dist/services/base/BaseGoogleService.d.ts +9 -1
  35. package/dist/services/base/BaseGoogleService.js +26 -1
  36. package/dist/services/chat/index.d.ts +34 -0
  37. package/dist/services/chat/index.js +120 -0
  38. package/dist/services/contacts/index.d.ts +19 -1
  39. package/dist/services/contacts/index.js +124 -0
  40. package/dist/services/meet/index.d.ts +35 -0
  41. package/dist/services/meet/index.js +116 -0
  42. package/dist/tools/chat-handlers.d.ts +14 -0
  43. package/dist/tools/chat-handlers.js +126 -0
  44. package/dist/tools/contacts-handlers.d.ts +31 -0
  45. package/dist/tools/contacts-handlers.js +88 -0
  46. package/dist/tools/definitions/chat.d.ts +3 -0
  47. package/dist/tools/definitions/chat.js +137 -0
  48. package/dist/tools/definitions/contacts.js +82 -0
  49. package/dist/tools/definitions/destructive-overrides.json +11 -0
  50. package/dist/tools/definitions/drive.js +48 -0
  51. package/dist/tools/definitions/gmail.js +94 -0
  52. package/dist/tools/definitions/index.d.ts +2 -0
  53. package/dist/tools/definitions/index.js +6 -0
  54. package/dist/tools/definitions/meet.d.ts +3 -0
  55. package/dist/tools/definitions/meet.js +149 -0
  56. package/dist/tools/definitions/open-world-overrides.json +11 -0
  57. package/dist/tools/drive-handlers.d.ts +17 -0
  58. package/dist/tools/drive-handlers.js +49 -1
  59. package/dist/tools/gmail-handlers.d.ts +24 -0
  60. package/dist/tools/gmail-handlers.js +129 -11
  61. package/dist/tools/meet-handlers.d.ts +42 -0
  62. package/dist/tools/meet-handlers.js +144 -0
  63. package/dist/tools/server.js +53 -3
  64. package/dist/utils/apiError.js +5 -2
  65. package/dist/utils/scope-hierarchy.js +10 -0
  66. package/dist/utils/service-initializer.js +9 -0
  67. package/dist/utils/untrusted-content.d.ts +37 -1
  68. package/dist/utils/untrusted-content.js +61 -6
  69. package/package.json +1 -1
@@ -0,0 +1,116 @@
1
+ import { google } from "googleapis";
2
+ import { BaseGoogleService, GoogleServiceError } from "../base/BaseGoogleService.js";
3
+ import { MeetError } from "../../modules/meet/types.js";
4
+ import { MEET_SCOPES } from "../../modules/meet/scopes.js";
5
+ /**
6
+ * Meet service implementation extending BaseGoogleService.
7
+ * Handles Google Meet API v2 read-only operations (conference records,
8
+ * transcripts, and transcript entries).
9
+ */
10
+ export class MeetService extends BaseGoogleService {
11
+ constructor() {
12
+ super({
13
+ serviceName: "meet", // Use 'meet' for the Google Meet API
14
+ version: "v2"
15
+ });
16
+ // Initialize immediately or ensure initialized before first use
17
+ this.initialize();
18
+ }
19
+ /**
20
+ * Gets an authenticated Meet API client for the specified account.
21
+ */
22
+ async getMeetClient(email) {
23
+ // The clientFactory function tells BaseGoogleService how to create the specific client
24
+ return this.getAuthenticatedClient(email, (auth) => google.meet({ version: "v2", auth }));
25
+ }
26
+ /**
27
+ * Maps a thrown error into a MeetError, mirroring the Contacts service.
28
+ */
29
+ toMeetError(error, action) {
30
+ if (error instanceof GoogleServiceError) {
31
+ // Assuming GoogleServiceError inherits message and data from McpError
32
+ // Use type assertion as the linter seems unsure
33
+ const gError = error;
34
+ return new MeetError(gError.message || `Error ${action}`, // Fallback message
35
+ gError.data?.code || "GOOGLE_SERVICE_ERROR", // Code from data
36
+ gError.data?.details // Details from data
37
+ );
38
+ }
39
+ // Handle other potential errors (e.g. network errors)
40
+ else if (error instanceof Error) {
41
+ return new MeetError(`Failed to ${action}: ${error.message}`, "UNKNOWN_API_ERROR" // More specific code
42
+ );
43
+ }
44
+ // Handle non-Error throws
45
+ return new MeetError(`Failed to ${action} due to an unknown issue`, "UNKNOWN_INTERNAL_ERROR" // More specific code
46
+ );
47
+ }
48
+ /**
49
+ * Lists past conference records for the specified user account.
50
+ * Supports pagination and an optional EBNF filter passed through to the API.
51
+ */
52
+ async listConferenceRecords(params) {
53
+ const { email, pageSize, pageToken, filter } = params;
54
+ try {
55
+ // Ensure necessary scopes are granted
56
+ await this.validateScopes(email, [MEET_SCOPES.MEETINGS_SPACE_READONLY]);
57
+ const meetApi = await this.getMeetClient(email);
58
+ const response = await meetApi.conferenceRecords.list({
59
+ pageSize: pageSize,
60
+ pageToken: pageToken,
61
+ filter: filter
62
+ });
63
+ // googleapis types use 'null' where we defined optional fields ('undefined');
64
+ // the shapes otherwise match the Meet API v2 resources.
65
+ return response.data;
66
+ }
67
+ catch (error) {
68
+ throw this.toMeetError(error, "list conference records");
69
+ }
70
+ }
71
+ /**
72
+ * Lists the transcripts of a conference record.
73
+ */
74
+ async listTranscripts(params) {
75
+ const { email, parent, pageSize, pageToken } = params;
76
+ if (!parent) {
77
+ throw new MeetError("Missing required parameter: parent", "INVALID_PARAMS", 'Specify the conference record resource name (e.g. "conferenceRecords/abc-123")');
78
+ }
79
+ try {
80
+ await this.validateScopes(email, [MEET_SCOPES.MEETINGS_SPACE_READONLY]);
81
+ const meetApi = await this.getMeetClient(email);
82
+ const response = await meetApi.conferenceRecords.transcripts.list({
83
+ parent: parent,
84
+ pageSize: pageSize,
85
+ pageToken: pageToken
86
+ });
87
+ return response.data;
88
+ }
89
+ catch (error) {
90
+ throw this.toMeetError(error, "list transcripts");
91
+ }
92
+ }
93
+ /**
94
+ * Lists the entries (speaker + text) of one transcript, paginated.
95
+ */
96
+ async listTranscriptEntries(params) {
97
+ const { email, parent, pageSize, pageToken } = params;
98
+ if (!parent) {
99
+ throw new MeetError("Missing required parameter: parent", "INVALID_PARAMS", 'Specify the transcript resource name (e.g. "conferenceRecords/abc-123/transcripts/def-456")');
100
+ }
101
+ try {
102
+ await this.validateScopes(email, [MEET_SCOPES.MEETINGS_SPACE_READONLY]);
103
+ const meetApi = await this.getMeetClient(email);
104
+ const response = await meetApi.conferenceRecords.transcripts.entries.list({
105
+ parent: parent,
106
+ pageSize: pageSize,
107
+ pageToken: pageToken
108
+ });
109
+ return response.data;
110
+ }
111
+ catch (error) {
112
+ throw this.toMeetError(error, "list transcript entries");
113
+ }
114
+ }
115
+ }
116
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,14 @@
1
+ import { ListChatSpacesResponse, ListChatMessagesResponse, ChatMessage } from "../modules/chat/types.js";
2
+ /**
3
+ * Handler function for listing Google Chat spaces.
4
+ */
5
+ export declare function handleListChatSpaces(params: Record<string, unknown>): Promise<ListChatSpacesResponse>;
6
+ /**
7
+ * Handler function for listing messages in a Google Chat space.
8
+ */
9
+ export declare function handleListChatMessages(params: Record<string, unknown>): Promise<ListChatMessagesResponse>;
10
+ /**
11
+ * Handler function for posting a text message to a Google Chat space.
12
+ */
13
+ export declare function handleSendChatMessage(params: Record<string, unknown>): Promise<ChatMessage>;
14
+ //# sourceMappingURL=chat-handlers.d.ts.map
@@ -0,0 +1,126 @@
1
+ import { ChatService } from "../services/chat/index.js";
2
+ import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
3
+ import { toMcpError } from "../utils/apiError.js";
4
+ import { getAccountManager, resolveEmail } from "../modules/accounts/index.js";
5
+ import { readAliasedNumber, readAliasedString } from './arg-aliases.js';
6
+ import { wrapUntrustedJsonStrings } from "../utils/untrusted-content.js";
7
+ // Cap page sizes well below the Chat API maximum (1000) to keep responses manageable
8
+ const MAX_CHAT_PAGE_SIZE = 100;
9
+ // Google Chat documents a maximum TOTAL message size of 32,000 bytes
10
+ // (spaces.messages.create). Enforce it against the UTF-8 byte length of the
11
+ // text body — the only sizable field this tool sends.
12
+ const MAX_CHAT_MESSAGE_TEXT_BYTES = 32_000;
13
+ // Space resource names look like "spaces/AAAA..." — exactly one segment after the prefix.
14
+ const SPACE_NAME_PATTERN = /^spaces\/[^/\s]+$/;
15
+ // Singleton instances - Initialize or inject as per project pattern
16
+ let chatService;
17
+ let accountManager;
18
+ /**
19
+ * Initialize required services.
20
+ * This should likely be integrated into a central initialization process.
21
+ */
22
+ async function initializeServices() {
23
+ if (!chatService) {
24
+ chatService = new ChatService();
25
+ }
26
+ if (!accountManager) {
27
+ accountManager = getAccountManager();
28
+ }
29
+ }
30
+ function capPageSize(pageSize) {
31
+ return pageSize !== undefined ? Math.min(pageSize, MAX_CHAT_PAGE_SIZE) : undefined;
32
+ }
33
+ function requireSpaceName(space) {
34
+ if (!space || !SPACE_NAME_PATTERN.test(space)) {
35
+ throw new McpError(ErrorCode.InvalidParams, 'space must be a space resource name of the form "spaces/<id>" (e.g. "spaces/AAAA...")');
36
+ }
37
+ return space;
38
+ }
39
+ /**
40
+ * Handler function for listing Google Chat spaces.
41
+ */
42
+ export async function handleListChatSpaces(params) {
43
+ await initializeServices(); // Ensure services are ready
44
+ const pageSize = readAliasedNumber(params, 'page_size', 'pageSize');
45
+ const pageToken = readAliasedString(params, 'page_token', 'pageToken');
46
+ const filter = typeof params.filter === 'string' ? params.filter : undefined;
47
+ // Resolve email - uses instance account if not provided, validates if provided
48
+ const email = await resolveEmail(params);
49
+ // Use accountManager for token renewal like in Contacts handlers
50
+ return accountManager.withTokenRenewal(email, async () => {
51
+ try {
52
+ const result = await chatService.listSpaces({
53
+ email,
54
+ pageSize: capPageSize(pageSize),
55
+ pageToken,
56
+ filter
57
+ });
58
+ return wrapUntrustedJsonStrings(result, 'google-workspace:chat:spaces');
59
+ }
60
+ catch (error) {
61
+ // toMcpError passes an McpError (and auth-handoff errors) through unchanged, and folds
62
+ // a ChatError's details into the message so the real cause reaches the user.
63
+ throw toMcpError(error, 'Failed to list chat spaces');
64
+ }
65
+ });
66
+ }
67
+ /**
68
+ * Handler function for listing messages in a Google Chat space.
69
+ */
70
+ export async function handleListChatMessages(params) {
71
+ await initializeServices();
72
+ const pageSize = readAliasedNumber(params, 'page_size', 'pageSize');
73
+ const pageToken = readAliasedString(params, 'page_token', 'pageToken');
74
+ const filter = typeof params.filter === 'string' ? params.filter : undefined;
75
+ const orderBy = readAliasedString(params, 'order_by', 'orderBy');
76
+ const space = requireSpaceName(readAliasedString(params, 'space', 'space'));
77
+ // Resolve email - uses instance account if not provided, validates if provided
78
+ const email = await resolveEmail(params);
79
+ return accountManager.withTokenRenewal(email, async () => {
80
+ try {
81
+ const result = await chatService.listMessages({
82
+ email,
83
+ parent: space,
84
+ pageSize: capPageSize(pageSize),
85
+ pageToken,
86
+ filter,
87
+ orderBy
88
+ });
89
+ return wrapUntrustedJsonStrings(result, 'google-workspace:chat:messages');
90
+ }
91
+ catch (error) {
92
+ throw toMcpError(error, 'Failed to list chat messages');
93
+ }
94
+ });
95
+ }
96
+ /**
97
+ * Handler function for posting a text message to a Google Chat space.
98
+ */
99
+ export async function handleSendChatMessage(params) {
100
+ await initializeServices();
101
+ const space = requireSpaceName(readAliasedString(params, 'space', 'space'));
102
+ const text = readAliasedString(params, 'text', 'text');
103
+ if (!text) {
104
+ throw new McpError(ErrorCode.InvalidParams, 'text parameter is required (the plain-text message body to send)');
105
+ }
106
+ const textBytes = Buffer.byteLength(text, 'utf8');
107
+ if (textBytes > MAX_CHAT_MESSAGE_TEXT_BYTES) {
108
+ throw new McpError(ErrorCode.InvalidParams, `text exceeds the Chat message size limit of ${MAX_CHAT_MESSAGE_TEXT_BYTES} bytes (got ${textBytes})`);
109
+ }
110
+ // Resolve email - uses instance account if not provided, validates if provided
111
+ const email = await resolveEmail(params);
112
+ return accountManager.withTokenRenewal(email, async () => {
113
+ try {
114
+ const result = await chatService.sendMessage({
115
+ email,
116
+ parent: space,
117
+ text
118
+ });
119
+ return wrapUntrustedJsonStrings(result, 'google-workspace:chat:message');
120
+ }
121
+ catch (error) {
122
+ throw toMcpError(error, 'Failed to send chat message');
123
+ }
124
+ });
125
+ }
126
+ //# sourceMappingURL=chat-handlers.js.map
@@ -32,5 +32,36 @@ export declare function handleSearchContacts(params: SearchContactsParams): Prom
32
32
  }>;
33
33
  totalResults: number;
34
34
  }>;
35
+ export interface ContactWriteToolParams {
36
+ email?: string;
37
+ given_name?: string;
38
+ givenName?: string;
39
+ family_name?: string;
40
+ familyName?: string;
41
+ email_address?: string;
42
+ emailAddress?: string;
43
+ email_type?: string;
44
+ emailType?: string;
45
+ phone_number?: string;
46
+ phoneNumber?: string;
47
+ phone_type?: string;
48
+ phoneType?: string;
49
+ organization?: string;
50
+ job_title?: string;
51
+ jobTitle?: string;
52
+ notes?: string;
53
+ }
54
+ /**
55
+ * Handler for creating a new Google Contact.
56
+ */
57
+ export declare function handleCreateContact(params: ContactWriteToolParams): Promise<unknown>;
58
+ /**
59
+ * Handler for updating an existing Google Contact. Only the provided fields
60
+ * are replaced; everything else on the contact is left untouched.
61
+ */
62
+ export declare function handleUpdateContact(params: ContactWriteToolParams & {
63
+ resource_name?: string;
64
+ resourceName?: string;
65
+ }): Promise<unknown>;
35
66
  export {};
36
67
  //# sourceMappingURL=contacts-handlers.d.ts.map
@@ -110,4 +110,92 @@ export async function handleSearchContacts(params) {
110
110
  }
111
111
  });
112
112
  }
113
+ // Contact resource names follow the documented "people/<id>" form.
114
+ const CONTACT_RESOURCE_NAME_PATTERN = /^people\/[^/\s]+$/;
115
+ // Deliberately permissive email shape check — the People API is the authority;
116
+ // this only catches clearly-malformed values before a network round-trip.
117
+ const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
118
+ // Phone values are free-form upstream, but must contain at least one digit.
119
+ const MAX_PHONE_LENGTH = 64;
120
+ function readContactWriteFields(params) {
121
+ const raw = params;
122
+ return {
123
+ givenName: readAliasedString(raw, 'given_name', 'givenName'),
124
+ familyName: readAliasedString(raw, 'family_name', 'familyName'),
125
+ emailAddress: readAliasedString(raw, 'email_address', 'emailAddress'),
126
+ emailType: readAliasedString(raw, 'email_type', 'emailType'),
127
+ phoneNumber: readAliasedString(raw, 'phone_number', 'phoneNumber'),
128
+ phoneType: readAliasedString(raw, 'phone_type', 'phoneType'),
129
+ organization: readAliasedString(raw, 'organization', 'organization'),
130
+ jobTitle: readAliasedString(raw, 'job_title', 'jobTitle'),
131
+ notes: readAliasedString(raw, 'notes', 'notes')
132
+ };
133
+ }
134
+ function validateContactWriteFields(fields) {
135
+ if (fields.emailAddress !== undefined && !EMAIL_PATTERN.test(fields.emailAddress)) {
136
+ throw new McpError(ErrorCode.InvalidParams, 'email_address must be a valid email address (e.g. "jane@example.com")');
137
+ }
138
+ if (fields.phoneNumber !== undefined
139
+ && (fields.phoneNumber.length > MAX_PHONE_LENGTH || !/\d/.test(fields.phoneNumber))) {
140
+ throw new McpError(ErrorCode.InvalidParams, 'phone_number must contain at least one digit and be at most 64 characters');
141
+ }
142
+ }
143
+ function hasAnyWriteField(fields) {
144
+ return Object.values(fields).some(value => value !== undefined);
145
+ }
146
+ function formatWriteResult(action, result) {
147
+ // Every string field is enveloped, matching the read handlers' whole-result wrapping.
148
+ return wrapUntrustedJsonStrings({ status: 'success', action, contact: result }, 'google-workspace:contacts:write');
149
+ }
150
+ /**
151
+ * Handler for creating a new Google Contact.
152
+ */
153
+ export async function handleCreateContact(params) {
154
+ await initializeServices();
155
+ const email = await resolveEmail(params);
156
+ const fields = readContactWriteFields(params);
157
+ validateContactWriteFields(fields);
158
+ if (!hasAnyWriteField(fields)) {
159
+ throw new McpError(ErrorCode.InvalidParams, 'Provide at least one contact field (e.g. given_name, email_address, phone_number)');
160
+ }
161
+ if (!fields.givenName && !fields.familyName && !fields.emailAddress) {
162
+ throw new McpError(ErrorCode.InvalidParams, 'A new contact needs at least a name (given_name / family_name) or an email_address');
163
+ }
164
+ return accountManager.withTokenRenewal(email, async () => {
165
+ try {
166
+ const result = await contactsService.createContact({ email, ...fields });
167
+ return formatWriteResult('created', result);
168
+ }
169
+ catch (error) {
170
+ throw toMcpError(error, 'Failed to create contact');
171
+ }
172
+ });
173
+ }
174
+ /**
175
+ * Handler for updating an existing Google Contact. Only the provided fields
176
+ * are replaced; everything else on the contact is left untouched.
177
+ */
178
+ export async function handleUpdateContact(params) {
179
+ await initializeServices();
180
+ const email = await resolveEmail(params);
181
+ const raw = params;
182
+ const resourceName = readAliasedString(raw, 'resource_name', 'resourceName');
183
+ const fields = readContactWriteFields(params);
184
+ validateContactWriteFields(fields);
185
+ if (!resourceName || !CONTACT_RESOURCE_NAME_PATTERN.test(resourceName)) {
186
+ throw new McpError(ErrorCode.InvalidParams, 'resource_name is required in the form "people/c1234567890" — get it from search_workspace_contacts');
187
+ }
188
+ if (!hasAnyWriteField(fields)) {
189
+ throw new McpError(ErrorCode.InvalidParams, 'Provide at least one field to update (e.g. phone_number, organization, notes)');
190
+ }
191
+ return accountManager.withTokenRenewal(email, async () => {
192
+ try {
193
+ const result = await contactsService.updateContact({ email, resourceName, ...fields });
194
+ return formatWriteResult('updated', result);
195
+ }
196
+ catch (error) {
197
+ throw toMcpError(error, 'Failed to update contact');
198
+ }
199
+ });
200
+ }
113
201
  //# sourceMappingURL=contacts-handlers.js.map
@@ -0,0 +1,3 @@
1
+ import { ToolMetadata } from "../../modules/tools/registry.js";
2
+ export declare const chatTools: ToolMetadata[];
3
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1,137 @@
1
+ // Define Chat Tools
2
+ export const chatTools = [
3
+ {
4
+ name: "list_chat_spaces",
5
+ category: "Chat",
6
+ description: `List Google Chat spaces (direct messages, group chats, and named spaces) for the authenticated user.
7
+
8
+ IMPORTANT: Before using this tool:
9
+ 1. Verify account access with list_workspace_accounts
10
+ 2. Confirm account if multiple exist
11
+ 3. Check required scopes include Chat read access
12
+
13
+ Parameters:
14
+ - email: The Google account email to list spaces for
15
+ - page_size: Optional maximum number of spaces to return (max 100)
16
+ - page_token: Optional token for pagination (to get the next page)
17
+ - filter: Optional filter by space type (e.g. 'space_type = "SPACE"')
18
+
19
+ Example Usage:
20
+ 1. Call list_workspace_accounts to check for valid accounts
21
+ 2. Call list_chat_spaces to retrieve spaces
22
+ 3. Use the space "name" field (e.g. "spaces/AAAA...") with list_chat_messages or send_chat_message`,
23
+ aliases: ["list_spaces", "get_chat_spaces"],
24
+ annotations: { readOnlyHint: true },
25
+ inputSchema: {
26
+ type: "object",
27
+ properties: {
28
+ email: {
29
+ type: "string",
30
+ description: "Email address of the Google account"
31
+ },
32
+ page_size: {
33
+ type: "number",
34
+ description: "Maximum number of spaces to return (default: API default, max: 100)"
35
+ },
36
+ page_token: {
37
+ type: "string",
38
+ description: "Page token from a previous response (for pagination)"
39
+ },
40
+ filter: {
41
+ type: "string",
42
+ description: 'Optional filter by space type (e.g. \'space_type = "SPACE"\' or \'space_type = "GROUP_CHAT"\')'
43
+ }
44
+ },
45
+ required: []
46
+ }
47
+ },
48
+ {
49
+ name: "list_chat_messages",
50
+ category: "Chat",
51
+ description: `List messages in a Google Chat space.
52
+
53
+ Use list_chat_spaces first to find the space resource name (e.g. "spaces/AAAA...").
54
+
55
+ Parameters:
56
+ - email: The Google account email to read messages for
57
+ - space: Required space resource name (e.g. "spaces/AAAA...")
58
+ - page_size: Optional maximum number of messages to return (max 100)
59
+ - page_token: Optional token for pagination (to get the next page)
60
+ - filter: Optional filter (e.g. 'create_time > "2026-01-01T00:00:00+00:00"')
61
+ - order_by: Optional ordering (e.g. "create_time desc"; default is create_time ascending)
62
+
63
+ Example usage:
64
+ - Recent messages: { "space": "spaces/AAAA...", "page_size": 20, "order_by": "create_time desc" }`,
65
+ aliases: ["list_messages", "get_chat_messages"],
66
+ annotations: { readOnlyHint: true },
67
+ inputSchema: {
68
+ type: "object",
69
+ properties: {
70
+ email: {
71
+ type: "string",
72
+ description: "Email address of the Google account"
73
+ },
74
+ space: {
75
+ type: "string",
76
+ description: 'Space resource name, e.g. "spaces/AAAA..." (from list_chat_spaces)'
77
+ },
78
+ page_size: {
79
+ type: "number",
80
+ description: "Maximum number of messages to return (default: 25, max: 100)"
81
+ },
82
+ page_token: {
83
+ type: "string",
84
+ description: "Page token from a previous response (for pagination)"
85
+ },
86
+ filter: {
87
+ type: "string",
88
+ description: 'Optional filter by create_time and/or thread.name (e.g. \'create_time > "2026-01-01T00:00:00+00:00"\')'
89
+ },
90
+ order_by: {
91
+ type: "string",
92
+ description: 'Optional ordering, e.g. "create_time desc" (default: create_time ascending)'
93
+ }
94
+ },
95
+ required: ["space"]
96
+ }
97
+ },
98
+ {
99
+ name: "send_chat_message",
100
+ category: "Chat",
101
+ description: `Post a plain-text message to a Google Chat space as the authenticated user.
102
+
103
+ This sends a real message visible to everyone in the space. Confirm the space
104
+ and the message content with the user before sending.
105
+
106
+ Use list_chat_spaces first to find the space resource name (e.g. "spaces/AAAA...").
107
+
108
+ Parameters:
109
+ - email: The Google account email to send from
110
+ - space: Required space resource name (e.g. "spaces/AAAA...")
111
+ - text: Required plain-text message body
112
+
113
+ Example usage:
114
+ - { "space": "spaces/AAAA...", "text": "Meeting moved to 3pm" }`,
115
+ aliases: ["send_message", "post_chat_message"],
116
+ annotations: { readOnlyHint: false },
117
+ inputSchema: {
118
+ type: "object",
119
+ properties: {
120
+ email: {
121
+ type: "string",
122
+ description: "Email address of the Google account"
123
+ },
124
+ space: {
125
+ type: "string",
126
+ description: 'Space resource name, e.g. "spaces/AAAA..." (from list_chat_spaces)'
127
+ },
128
+ text: {
129
+ type: "string",
130
+ description: "Plain-text message body to post to the space"
131
+ }
132
+ },
133
+ required: ["space", "text"]
134
+ }
135
+ }
136
+ ];
137
+ //# sourceMappingURL=chat.js.map
@@ -88,6 +88,88 @@ export const contactsTools = [
88
88
  },
89
89
  required: ["query"]
90
90
  }
91
+ },
92
+ {
93
+ name: "create_workspace_contact",
94
+ category: "Contacts",
95
+ description: `Create a new Google Contact.
96
+
97
+ Requires the full Contacts permission (read + write). If the connected account
98
+ only granted read access, the tool explains how to reconnect with the write
99
+ permission.
100
+
101
+ Parameters:
102
+ - email: The Google account email to create the contact in
103
+ - given_name / family_name: Contact name (at least a name or email_address is required)
104
+ - email_address (+ optional email_type, e.g. "work")
105
+ - phone_number (+ optional phone_type, e.g. "mobile")
106
+ - organization / job_title
107
+ - notes: Free-text note stored on the contact
108
+
109
+ Example: { "given_name": "Jane", "family_name": "Doe", "email_address": "jane@example.com", "organization": "Acme Corp" }`,
110
+ aliases: ["create_contact", "add_contact", "new_contact"],
111
+ annotations: { readOnlyHint: false },
112
+ inputSchema: {
113
+ type: "object",
114
+ properties: {
115
+ email: {
116
+ type: "string",
117
+ description: "Email address of the Google account"
118
+ },
119
+ given_name: { type: "string", description: "First name" },
120
+ family_name: { type: "string", description: "Last name" },
121
+ email_address: { type: "string", description: "Contact email address" },
122
+ email_type: { type: "string", description: 'Email type label (e.g. "home", "work")' },
123
+ phone_number: { type: "string", description: "Contact phone number" },
124
+ phone_type: { type: "string", description: 'Phone type label (e.g. "mobile", "work")' },
125
+ organization: { type: "string", description: "Company or organization name" },
126
+ job_title: { type: "string", description: "Job title at the organization" },
127
+ notes: { type: "string", description: "Free-text note stored on the contact" }
128
+ },
129
+ required: []
130
+ }
131
+ },
132
+ {
133
+ name: "update_workspace_contact",
134
+ category: "Contacts",
135
+ description: `Update fields on an existing Google Contact. Only the fields you
136
+ provide are replaced; everything else on the contact is left untouched.
137
+
138
+ Get the resource_name from search_workspace_contacts or get_workspace_contacts
139
+ (it looks like "people/c1234567890").
140
+
141
+ Parameters:
142
+ - email: The Google account email that owns the contact
143
+ - resource_name: Required. The contact's resource name (e.g. "people/c1234567890")
144
+ - Any of the create_workspace_contact fields to replace: given_name, family_name,
145
+ email_address, email_type, phone_number, phone_type, organization, job_title, notes
146
+
147
+ Example: { "resource_name": "people/c1234567890", "phone_number": "+1 555 0100", "organization": "Acme Corp" }`,
148
+ aliases: ["update_contact", "edit_contact", "modify_contact"],
149
+ annotations: { readOnlyHint: false },
150
+ inputSchema: {
151
+ type: "object",
152
+ properties: {
153
+ email: {
154
+ type: "string",
155
+ description: "Email address of the Google account"
156
+ },
157
+ resource_name: {
158
+ type: "string",
159
+ description: 'The contact resource name (e.g. "people/c1234567890")'
160
+ },
161
+ given_name: { type: "string", description: "First name" },
162
+ family_name: { type: "string", description: "Last name" },
163
+ email_address: { type: "string", description: "Contact email address" },
164
+ email_type: { type: "string", description: 'Email type label (e.g. "home", "work")' },
165
+ phone_number: { type: "string", description: "Contact phone number" },
166
+ phone_type: { type: "string", description: 'Phone type label (e.g. "mobile", "work")' },
167
+ organization: { type: "string", description: "Company or organization name" },
168
+ job_title: { type: "string", description: "Job title at the organization" },
169
+ notes: { type: "string", description: "Free-text note stored on the contact" }
170
+ },
171
+ required: ["resource_name"]
172
+ }
91
173
  }
92
174
  ];
93
175
  //# sourceMappingURL=contacts.js.map