mcp-google-multi 6.0.0-beta.2 → 6.0.0-beta.3

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 (165) hide show
  1. package/dist/accounts.d.ts +17 -1
  2. package/dist/accounts.js +52 -15
  3. package/dist/api-probe.d.ts +5 -0
  4. package/dist/api-probe.js +20 -15
  5. package/dist/arg-normalize.js +6 -5
  6. package/dist/arg-strict.d.ts +7 -0
  7. package/dist/arg-strict.js +34 -4
  8. package/dist/auth.d.ts +4 -3
  9. package/dist/auth.js +11 -13
  10. package/dist/boot-gates.d.ts +26 -0
  11. package/dist/boot-gates.js +38 -0
  12. package/dist/cimd-cache.d.ts +38 -0
  13. package/dist/cimd-cache.js +117 -0
  14. package/dist/client.d.ts +32 -2
  15. package/dist/client.js +0 -0
  16. package/dist/compose.d.ts +11 -0
  17. package/dist/compose.js +109 -0
  18. package/dist/config-file.d.ts +13 -0
  19. package/dist/config-file.js +37 -1
  20. package/dist/discover.js +3 -1
  21. package/dist/discovery-client.d.ts +3 -0
  22. package/dist/discovery-client.js +25 -2
  23. package/dist/doctor.d.ts +6 -2
  24. package/dist/doctor.js +119 -23
  25. package/dist/executor.d.ts +3 -0
  26. package/dist/executor.js +4 -2
  27. package/dist/fanout.d.ts +9 -1
  28. package/dist/fanout.js +44 -10
  29. package/dist/fs-atomic.d.ts +11 -0
  30. package/dist/fs-atomic.js +219 -28
  31. package/dist/hint-provider.d.ts +129 -0
  32. package/dist/hint-provider.js +64 -0
  33. package/dist/http-transport.d.ts +62 -4
  34. package/dist/http-transport.js +343 -24
  35. package/dist/identity.d.ts +4 -1
  36. package/dist/identity.js +25 -6
  37. package/dist/index.js +66 -138
  38. package/dist/master-key.js +13 -5
  39. package/dist/mcp-token.d.ts +136 -19
  40. package/dist/mcp-token.js +569 -72
  41. package/dist/migrate-config.js +2 -2
  42. package/dist/oauth-as.d.ts +103 -3
  43. package/dist/oauth-as.js +374 -79
  44. package/dist/oauth-consent.d.ts +10 -0
  45. package/dist/oauth-consent.js +16 -0
  46. package/dist/outbound-allowlist.js +5 -2
  47. package/dist/reauth-hint.d.ts +1 -1
  48. package/dist/reauth-hint.js +12 -8
  49. package/dist/registry-transfer.d.ts +5 -0
  50. package/dist/registry-transfer.js +65 -5
  51. package/dist/registry.d.ts +18 -1
  52. package/dist/registry.js +71 -15
  53. package/dist/scope-catalog.d.ts +11 -0
  54. package/dist/scope-catalog.js +23 -6
  55. package/dist/scope-observability.d.ts +8 -6
  56. package/dist/scope-observability.js +29 -13
  57. package/dist/services.d.ts +15 -10
  58. package/dist/services.js +59 -15
  59. package/dist/ssrf-guard.d.ts +23 -9
  60. package/dist/ssrf-guard.js +101 -62
  61. package/dist/tenant-purge.d.ts +26 -0
  62. package/dist/tenant-purge.js +67 -0
  63. package/dist/token-store.d.ts +20 -2
  64. package/dist/token-store.js +0 -0
  65. package/dist/tools/_errors.d.ts +3 -0
  66. package/dist/tools/_errors.js +53 -24
  67. package/dist/tools/_local-files.d.ts +9 -0
  68. package/dist/tools/_local-files.js +18 -0
  69. package/dist/tools/account-wizard.d.ts +10 -1
  70. package/dist/tools/account-wizard.js +74 -17
  71. package/dist/tools/accounts-tool.d.ts +7 -0
  72. package/dist/tools/accounts-tool.js +34 -18
  73. package/dist/tools/admin.d.ts +10 -1
  74. package/dist/tools/admin.js +15 -11
  75. package/dist/tools/analytics.d.ts +10 -1
  76. package/dist/tools/analytics.js +13 -8
  77. package/dist/tools/calendar.d.ts +2 -1
  78. package/dist/tools/calendar.js +18 -14
  79. package/dist/tools/chat.d.ts +10 -1
  80. package/dist/tools/chat.js +13 -8
  81. package/dist/tools/contacts.d.ts +2 -1
  82. package/dist/tools/contacts.js +17 -13
  83. package/dist/tools/docs.d.ts +2 -1
  84. package/dist/tools/docs.js +34 -30
  85. package/dist/tools/drive.d.ts +2 -1
  86. package/dist/tools/drive.js +65 -50
  87. package/dist/tools/forms.d.ts +10 -1
  88. package/dist/tools/forms.js +19 -12
  89. package/dist/tools/generated/_shared.d.ts +2 -1
  90. package/dist/tools/generated/_shared.js +7 -3
  91. package/dist/tools/generated/admin.d.ts +2 -1
  92. package/dist/tools/generated/admin.js +265 -265
  93. package/dist/tools/generated/analytics.d.ts +2 -1
  94. package/dist/tools/generated/analytics.js +125 -125
  95. package/dist/tools/generated/appsmarket.d.ts +2 -1
  96. package/dist/tools/generated/appsmarket.js +5 -5
  97. package/dist/tools/generated/calendar.d.ts +2 -1
  98. package/dist/tools/generated/calendar.js +55 -55
  99. package/dist/tools/generated/chat.d.ts +2 -1
  100. package/dist/tools/generated/chat.js +95 -95
  101. package/dist/tools/generated/classroom.d.ts +2 -1
  102. package/dist/tools/generated/classroom.js +209 -209
  103. package/dist/tools/generated/cloudidentity.d.ts +2 -1
  104. package/dist/tools/generated/cloudidentity.js +133 -133
  105. package/dist/tools/generated/cloudsearch.d.ts +2 -1
  106. package/dist/tools/generated/cloudsearch.js +99 -99
  107. package/dist/tools/generated/contacts.d.ts +2 -1
  108. package/dist/tools/generated/contacts.js +29 -29
  109. package/dist/tools/generated/drive.d.ts +2 -1
  110. package/dist/tools/generated/drive.js +71 -71
  111. package/dist/tools/generated/driveactivity.d.ts +2 -1
  112. package/dist/tools/generated/driveactivity.js +3 -3
  113. package/dist/tools/generated/drivelabels.d.ts +2 -1
  114. package/dist/tools/generated/drivelabels.js +53 -53
  115. package/dist/tools/generated/forms.d.ts +2 -1
  116. package/dist/tools/generated/forms.js +7 -7
  117. package/dist/tools/generated/gmail.d.ts +2 -1
  118. package/dist/tools/generated/gmail.js +117 -117
  119. package/dist/tools/generated/groupsmigration.d.ts +2 -1
  120. package/dist/tools/generated/groupsmigration.js +3 -3
  121. package/dist/tools/generated/groupssettings.d.ts +2 -1
  122. package/dist/tools/generated/groupssettings.js +7 -7
  123. package/dist/tools/generated/index.d.ts +2 -1
  124. package/dist/tools/generated/keep.d.ts +2 -1
  125. package/dist/tools/generated/keep.js +15 -15
  126. package/dist/tools/generated/licensing.d.ts +2 -1
  127. package/dist/tools/generated/licensing.js +15 -15
  128. package/dist/tools/generated/meet.d.ts +2 -1
  129. package/dist/tools/generated/meet.js +27 -27
  130. package/dist/tools/generated/postmaster.d.ts +2 -1
  131. package/dist/tools/generated/postmaster.js +9 -9
  132. package/dist/tools/generated/reseller.d.ts +2 -1
  133. package/dist/tools/generated/reseller.js +35 -35
  134. package/dist/tools/generated/script.d.ts +2 -1
  135. package/dist/tools/generated/script.js +33 -33
  136. package/dist/tools/generated/searchconsole.d.ts +2 -1
  137. package/dist/tools/generated/searchconsole.js +3 -3
  138. package/dist/tools/generated/sheets.d.ts +2 -1
  139. package/dist/tools/generated/sheets.js +15 -15
  140. package/dist/tools/generated/tasks.d.ts +2 -1
  141. package/dist/tools/generated/tasks.js +5 -5
  142. package/dist/tools/generated/vault.d.ts +2 -1
  143. package/dist/tools/generated/vault.js +67 -67
  144. package/dist/tools/generated/workspaceevents.d.ts +2 -1
  145. package/dist/tools/generated/workspaceevents.js +31 -31
  146. package/dist/tools/gmail.d.ts +2 -1
  147. package/dist/tools/gmail.js +45 -33
  148. package/dist/tools/google-api.d.ts +2 -3
  149. package/dist/tools/google-api.js +30 -16
  150. package/dist/tools/meet.d.ts +10 -1
  151. package/dist/tools/meet.js +13 -9
  152. package/dist/tools/searchconsole.d.ts +2 -1
  153. package/dist/tools/searchconsole.js +17 -13
  154. package/dist/tools/sheets.d.ts +2 -1
  155. package/dist/tools/sheets.js +36 -32
  156. package/dist/tools/slides.d.ts +10 -1
  157. package/dist/tools/slides.js +17 -10
  158. package/dist/tools/tasks.d.ts +2 -1
  159. package/dist/tools/tasks.js +19 -15
  160. package/dist/trim.d.ts +5 -0
  161. package/dist/trim.js +20 -0
  162. package/dist/usage-metrics.d.ts +23 -0
  163. package/dist/usage-metrics.js +65 -47
  164. package/dist/write-control.js +10 -2
  165. package/package.json +27 -1
@@ -2,7 +2,7 @@
2
2
  import { z } from 'zod';
3
3
  import { coerceBoolean, coerceJson } from '../_coerce.js';
4
4
  import { accountField, registerGeneratedTool } from './_shared.js';
5
- export function registerWorkspaceeventsGeneratedTools(registry) {
5
+ export function registerWorkspaceeventsGeneratedTools(registry, deps = {}) {
6
6
  // Interned method scope sets (shared across tools; see scope-observability).
7
7
  const S_workspaceevents_v1 = [
8
8
  ["https://www.googleapis.com/auth/chat.bot", "https://www.googleapis.com/auth/chat.memberships", "https://www.googleapis.com/auth/chat.memberships.readonly", "https://www.googleapis.com/auth/chat.messages", "https://www.googleapis.com/auth/chat.messages.reactions", "https://www.googleapis.com/auth/chat.messages.reactions.readonly", "https://www.googleapis.com/auth/chat.messages.readonly", "https://www.googleapis.com/auth/chat.spaces", "https://www.googleapis.com/auth/chat.spaces.readonly", "https://www.googleapis.com/auth/chat.users.availability", "https://www.googleapis.com/auth/chat.users.availability.readonly", "https://www.googleapis.com/auth/chat.users.readstate", "https://www.googleapis.com/auth/chat.users.readstate.readonly", "https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file", "https://www.googleapis.com/auth/drive.metadata", "https://www.googleapis.com/auth/drive.metadata.readonly", "https://www.googleapis.com/auth/drive.readonly", "https://www.googleapis.com/auth/meetings.space.created", "https://www.googleapis.com/auth/meetings.space.readonly"],
@@ -16,11 +16,11 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
16
16
  params: [{ "field": "fields", "api": "fields", "location": "query" }],
17
17
  hasBody: true,
18
18
  shape: {
19
- account: accountField(),
19
+ account: accountField(() => registry.accountAliases()),
20
20
  body: coerceJson(z.record(z.string(), z.unknown())).describe("SendMessageRequest JSON request body. Top-level fields: configuration, message, metadata, tenant."),
21
21
  fields: z.string().optional().describe('Response field mask.'),
22
22
  },
23
- });
23
+ }, deps);
24
24
  registerGeneratedTool(registry, {
25
25
  name: "workspaceevents_operations_get",
26
26
  cud: "read",
@@ -29,11 +29,11 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
29
29
  params: [{ "field": "name", "api": "name", "location": "path" }, { "field": "fields", "api": "fields", "location": "query" }],
30
30
  hasBody: false,
31
31
  shape: {
32
- account: accountField(),
32
+ account: accountField(() => registry.accountAliases()),
33
33
  name: z.string().min(1).describe("The name of the operation resource."),
34
34
  fields: z.string().optional().describe('Response field mask.'),
35
35
  },
36
- });
36
+ }, deps);
37
37
  registerGeneratedTool(registry, {
38
38
  name: "workspaceevents_subscriptions_create",
39
39
  cud: "create",
@@ -42,12 +42,12 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
42
42
  params: [{ "field": "validateOnly", "api": "validateOnly", "location": "query" }, { "field": "fields", "api": "fields", "location": "query" }],
43
43
  hasBody: true,
44
44
  shape: {
45
- account: accountField(),
45
+ account: accountField(() => registry.accountAliases()),
46
46
  validateOnly: coerceBoolean.describe("Optional. If set to `true`, validates and previews the request, but doesn't create the subscription.").optional(),
47
47
  body: coerceJson(z.record(z.string(), z.unknown())).describe("Subscription JSON request body. Top-level fields: authority, createTime, driveOptions, etag, eventTypes, expireTime, name, notificationEndpoint, payloadOptions, reconciling, serviceAccountAuthority, state, +6 more."),
48
48
  fields: z.string().optional().describe('Response field mask.'),
49
49
  },
50
- });
50
+ }, deps);
51
51
  registerGeneratedTool(registry, {
52
52
  name: "workspaceevents_subscriptions_delete",
53
53
  cud: "delete",
@@ -56,14 +56,14 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
56
56
  params: [{ "field": "name", "api": "name", "location": "path" }, { "field": "allowMissing", "api": "allowMissing", "location": "query" }, { "field": "etag", "api": "etag", "location": "query" }, { "field": "validateOnly", "api": "validateOnly", "location": "query" }, { "field": "fields", "api": "fields", "location": "query" }],
57
57
  hasBody: false,
58
58
  shape: {
59
- account: accountField(),
59
+ account: accountField(() => registry.accountAliases()),
60
60
  name: z.string().min(1).describe("Required. Resource name of the subscription to delete. Format: `subscriptions/{subscription}`"),
61
61
  allowMissing: coerceBoolean.describe("Optional. If set to `true` and the subscription isn't found, the request succeeds but doesn't delete the subscription.").optional(),
62
62
  etag: z.string().describe("Optional. Etag of the subscription. If present, it must match with the server's etag. Otherwise, request fails with the status `ABORTED`.").optional(),
63
63
  validateOnly: coerceBoolean.describe("Optional. If set to `true`, validates and previews the request, but doesn't delete the subscription.").optional(),
64
64
  fields: z.string().optional().describe('Response field mask.'),
65
65
  },
66
- });
66
+ }, deps);
67
67
  registerGeneratedTool(registry, {
68
68
  name: "workspaceevents_subscriptions_get",
69
69
  cud: "read",
@@ -72,11 +72,11 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
72
72
  params: [{ "field": "name", "api": "name", "location": "path" }, { "field": "fields", "api": "fields", "location": "query" }],
73
73
  hasBody: false,
74
74
  shape: {
75
- account: accountField(),
75
+ account: accountField(() => registry.accountAliases()),
76
76
  name: z.string().min(1).describe("Required. Resource name of the subscription. Format: `subscriptions/{subscription}`"),
77
77
  fields: z.string().optional().describe('Response field mask.'),
78
78
  },
79
- });
79
+ }, deps);
80
80
  registerGeneratedTool(registry, {
81
81
  name: "workspaceevents_subscriptions_list",
82
82
  cud: "read",
@@ -85,13 +85,13 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
85
85
  params: [{ "field": "filter", "api": "filter", "location": "query" }, { "field": "pageSize", "api": "pageSize", "location": "query" }, { "field": "pageToken", "api": "pageToken", "location": "query" }, { "field": "fields", "api": "fields", "location": "query" }],
86
86
  hasBody: false,
87
87
  shape: {
88
- account: accountField(),
88
+ account: accountField(() => registry.accountAliases()),
89
89
  filter: z.string().describe("Required. A query filter. You can filter subscriptions by event type (`event_types`) and target resource (`target_resource`). You must specify at least one event type in your query. To filter for mult").optional(),
90
90
  pageSize: z.number().describe("Optional. The maximum number of subscriptions to return. The service might return fewer than this value. If unspecified or set to `0`, up to 50 subscriptions are returned. The maximum value is 100. If").optional(),
91
91
  pageToken: z.string().describe("Optional. A page token, received from a previous list subscriptions call. Provide this parameter to retrieve the subsequent page. When paginating, the filter value should match the call that provided ").optional(),
92
92
  fields: z.string().optional().describe('Response field mask.'),
93
93
  },
94
- });
94
+ }, deps);
95
95
  registerGeneratedTool(registry, {
96
96
  name: "workspaceevents_subscriptions_patch",
97
97
  cud: "update",
@@ -100,14 +100,14 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
100
100
  params: [{ "field": "name", "api": "name", "location": "path" }, { "field": "updateMask", "api": "updateMask", "location": "query" }, { "field": "validateOnly", "api": "validateOnly", "location": "query" }, { "field": "fields", "api": "fields", "location": "query" }],
101
101
  hasBody: true,
102
102
  shape: {
103
- account: accountField(),
103
+ account: accountField(() => registry.accountAliases()),
104
104
  name: z.string().min(1).describe("Identifier. Resource name of the subscription. Format: `subscriptions/{subscription}`"),
105
105
  updateMask: z.string().describe("Optional. The field to update. If omitted, updates any fields included in the request. You can update one of the following fields in a subscription: * `expire_time`: The timestamp when the subscriptio").optional(),
106
106
  validateOnly: coerceBoolean.describe("Optional. If set to `true`, validates and previews the request, but doesn't update the subscription.").optional(),
107
107
  body: coerceJson(z.record(z.string(), z.unknown())).describe("Subscription JSON request body. Top-level fields: authority, createTime, driveOptions, etag, eventTypes, expireTime, name, notificationEndpoint, payloadOptions, reconciling, serviceAccountAuthority, state, +6 more."),
108
108
  fields: z.string().optional().describe('Response field mask.'),
109
109
  },
110
- });
110
+ }, deps);
111
111
  registerGeneratedTool(registry, {
112
112
  name: "workspaceevents_subscriptions_reactivate",
113
113
  cud: "update",
@@ -117,11 +117,11 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
117
117
  hasBody: true,
118
118
  bodyParams: [],
119
119
  shape: {
120
- account: accountField(),
120
+ account: accountField(() => registry.accountAliases()),
121
121
  name: z.string().min(1).describe("Required. Resource name of the subscription. Format: `subscriptions/{subscription}`"),
122
122
  fields: z.string().optional().describe('Response field mask.'),
123
123
  },
124
- });
124
+ }, deps);
125
125
  registerGeneratedTool(registry, {
126
126
  name: "workspaceevents_tasks_cancel",
127
127
  cud: "delete",
@@ -131,12 +131,12 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
131
131
  hasBody: true,
132
132
  bodyParams: [{ "field": "tenant", "api": "tenant" }],
133
133
  shape: {
134
- account: accountField(),
134
+ account: accountField(() => registry.accountAliases()),
135
135
  name: z.string().min(1).describe("The resource name of the task to cancel. Format: tasks/{task_id}"),
136
136
  tenant: z.string().describe("Optional tenant, provided as a path parameter. Experimental, might still change for 1.0 release.").optional(),
137
137
  fields: z.string().optional().describe('Response field mask.'),
138
138
  },
139
- });
139
+ }, deps);
140
140
  registerGeneratedTool(registry, {
141
141
  name: "workspaceevents_tasks_get",
142
142
  cud: "read",
@@ -145,13 +145,13 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
145
145
  params: [{ "field": "name", "api": "name", "location": "path" }, { "field": "historyLength", "api": "historyLength", "location": "query" }, { "field": "tenant", "api": "tenant", "location": "query" }, { "field": "fields", "api": "fields", "location": "query" }],
146
146
  hasBody: false,
147
147
  shape: {
148
- account: accountField(),
148
+ account: accountField(() => registry.accountAliases()),
149
149
  name: z.string().min(1).describe("Required. The resource name of the task. Format: tasks/{task_id}"),
150
150
  historyLength: z.number().describe("The number of most recent messages from the task's history to retrieve.").optional(),
151
151
  tenant: z.string().describe("Optional tenant, provided as a path parameter. Experimental, might still change for 1.0 release.").optional(),
152
152
  fields: z.string().optional().describe('Response field mask.'),
153
153
  },
154
- });
154
+ }, deps);
155
155
  registerGeneratedTool(registry, {
156
156
  name: "workspaceevents_tasks_push_notification_configs_create",
157
157
  cud: "create",
@@ -160,14 +160,14 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
160
160
  params: [{ "field": "parent", "api": "parent", "location": "path" }, { "field": "configId", "api": "configId", "location": "query" }, { "field": "tenant", "api": "tenant", "location": "query" }, { "field": "fields", "api": "fields", "location": "query" }],
161
161
  hasBody: true,
162
162
  shape: {
163
- account: accountField(),
163
+ account: accountField(() => registry.accountAliases()),
164
164
  parent: z.string().min(1).describe("Required. The parent task resource for this config. Format: tasks/{task_id}"),
165
165
  configId: z.string().describe("Required. The ID for the new config.").optional(),
166
166
  tenant: z.string().describe("Optional tenant, provided as a path parameter. Experimental, might still change for 1.0 release.").optional(),
167
167
  body: coerceJson(z.record(z.string(), z.unknown())).describe("TaskPushNotificationConfig JSON request body. Top-level fields: name, pushNotificationConfig."),
168
168
  fields: z.string().optional().describe('Response field mask.'),
169
169
  },
170
- });
170
+ }, deps);
171
171
  registerGeneratedTool(registry, {
172
172
  name: "workspaceevents_tasks_push_notification_configs_delete",
173
173
  cud: "delete",
@@ -176,12 +176,12 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
176
176
  params: [{ "field": "name", "api": "name", "location": "path" }, { "field": "tenant", "api": "tenant", "location": "query" }, { "field": "fields", "api": "fields", "location": "query" }],
177
177
  hasBody: false,
178
178
  shape: {
179
- account: accountField(),
179
+ account: accountField(() => registry.accountAliases()),
180
180
  name: z.string().min(1).describe("The resource name of the config to delete. Format: tasks/{task_id}/pushNotificationConfigs/{config_id}"),
181
181
  tenant: z.string().describe("Optional tenant, provided as a path parameter. Experimental, might still change for 1.0 release.").optional(),
182
182
  fields: z.string().optional().describe('Response field mask.'),
183
183
  },
184
- });
184
+ }, deps);
185
185
  registerGeneratedTool(registry, {
186
186
  name: "workspaceevents_tasks_push_notification_configs_get",
187
187
  cud: "read",
@@ -190,12 +190,12 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
190
190
  params: [{ "field": "name", "api": "name", "location": "path" }, { "field": "tenant", "api": "tenant", "location": "query" }, { "field": "fields", "api": "fields", "location": "query" }],
191
191
  hasBody: false,
192
192
  shape: {
193
- account: accountField(),
193
+ account: accountField(() => registry.accountAliases()),
194
194
  name: z.string().min(1).describe("The resource name of the config to retrieve. Format: tasks/{task_id}/pushNotificationConfigs/{config_id}"),
195
195
  tenant: z.string().describe("Optional tenant, provided as a path parameter. Experimental, might still change for 1.0 release.").optional(),
196
196
  fields: z.string().optional().describe('Response field mask.'),
197
197
  },
198
- });
198
+ }, deps);
199
199
  registerGeneratedTool(registry, {
200
200
  name: "workspaceevents_tasks_push_notification_configs_list",
201
201
  cud: "read",
@@ -204,14 +204,14 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
204
204
  params: [{ "field": "parent", "api": "parent", "location": "path" }, { "field": "pageSize", "api": "pageSize", "location": "query" }, { "field": "pageToken", "api": "pageToken", "location": "query" }, { "field": "tenant", "api": "tenant", "location": "query" }, { "field": "fields", "api": "fields", "location": "query" }],
205
205
  hasBody: false,
206
206
  shape: {
207
- account: accountField(),
207
+ account: accountField(() => registry.accountAliases()),
208
208
  parent: z.string().min(1).describe("The parent task resource. Format: tasks/{task_id}"),
209
209
  pageSize: z.number().describe("For AIP-158 these fields are present. Usually not used/needed. The maximum number of configurations to return. If unspecified, all configs will be returned.").optional(),
210
210
  pageToken: z.string().describe("A page token received from a previous ListTaskPushNotificationConfigRequest call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListTaskPushNotificat").optional(),
211
211
  tenant: z.string().describe("Optional tenant, provided as a path parameter. Experimental, might still change for 1.0 release.").optional(),
212
212
  fields: z.string().optional().describe('Response field mask.'),
213
213
  },
214
- });
214
+ }, deps);
215
215
  registerGeneratedTool(registry, {
216
216
  name: "workspaceevents_tasks_subscribe",
217
217
  cud: "read",
@@ -220,10 +220,10 @@ export function registerWorkspaceeventsGeneratedTools(registry) {
220
220
  params: [{ "field": "name", "api": "name", "location": "path" }, { "field": "tenant", "api": "tenant", "location": "query" }, { "field": "fields", "api": "fields", "location": "query" }],
221
221
  hasBody: false,
222
222
  shape: {
223
- account: accountField(),
223
+ account: accountField(() => registry.accountAliases()),
224
224
  name: z.string().min(1).describe("The resource name of the task to subscribe to. Format: tasks/{task_id}"),
225
225
  tenant: z.string().describe("Optional tenant, provided as a path parameter. Experimental, might still change for 1.0 release.").optional(),
226
226
  fields: z.string().optional().describe('Response field mask.'),
227
227
  },
228
- });
228
+ }, deps);
229
229
  }
@@ -1,5 +1,6 @@
1
1
  import type { ToolRegistry } from '../registry.js';
2
2
  import type { Account } from '../accounts.js';
3
+ import { type CuratedToolDeps } from '../client.js';
3
4
  import { type ComposeAttachment } from './gmail-mime.js';
4
5
  import type { GmailMessageHeader, GmailMessageFull } from '../types.js';
5
6
  /** Re: prefix unless the subject already carries one (case-insensitive, after
@@ -42,5 +43,5 @@ export declare function compactMessageRow(m: GmailMessageHeader): {
42
43
  date: string;
43
44
  snippet: string;
44
45
  };
45
- export declare function registerGmailTools(server: ToolRegistry): void;
46
+ export declare function registerGmailTools(server: ToolRegistry, deps?: CuratedToolDeps): void;
46
47
  export {};
@@ -1,11 +1,11 @@
1
1
  import { z } from 'zod';
2
2
  import { coerceArray, coerceBoolean, coerceJson, coerceNumber } from './_coerce.js';
3
3
  import { gmail as gmailClient } from '@googleapis/gmail';
4
- import { accountAliasSchema } from '../accounts.js';
4
+ import { accountArgLive } from '../accounts.js';
5
5
  import { getClient } from '../client.js';
6
6
  import { handleGoogleApiError, invalidParams, mapGoogleError } from './_errors.js';
7
7
  import { buildReplyHeaders, composeRaw, renderMarkdown, htmlToMarkdown, HeaderInjectionError } from './gmail-mime.js';
8
- import { prepareLocalDest } from './_local-files.js';
8
+ import { hostFilesRefused, prepareLocalDest } from './_local-files.js';
9
9
  import { checkOutbound } from '../outbound-allowlist.js';
10
10
  import addressparser from 'nodemailer/lib/addressparser/index.js';
11
11
  import { lookup as lookupMime } from 'mime-types';
@@ -14,7 +14,6 @@ import { getTokenDir } from '../accounts.js';
14
14
  import { sliceClean } from '../trim.js';
15
15
  import * as path from 'path';
16
16
  import * as fs from 'fs';
17
- const accountEnum = accountAliasSchema.optional();
18
17
  function getHeader(headers, name) {
19
18
  return headers?.find((h) => h.name?.toLowerCase() === name.toLowerCase())?.value ?? '';
20
19
  }
@@ -107,9 +106,11 @@ export function deriveReplySubject(sourceSubject) {
107
106
  // The account's own-address set (primary + Gmail send-as aliases) used to
108
107
  // exclude the caller from reply-all. Send-as rarely changes, so memoize per
109
108
  // process; a stale miss only costs one extra self-copy, never a wrong send.
109
+ // Keyed by alias AND mailbox: two contexts can share an alias name.
110
110
  const ownAddressCache = new Map();
111
111
  function getOwnAddresses(gmail, account, primaryEmail) {
112
- let cached = ownAddressCache.get(account);
112
+ const key = `${account} ${normAddr(primaryEmail)}`;
113
+ let cached = ownAddressCache.get(key);
113
114
  if (!cached) {
114
115
  cached = (async () => {
115
116
  const set = new Set([normAddr(primaryEmail)]);
@@ -125,7 +126,7 @@ function getOwnAddresses(gmail, account, primaryEmail) {
125
126
  }
126
127
  return set;
127
128
  })();
128
- ownAddressCache.set(account, cached);
129
+ ownAddressCache.set(key, cached);
129
130
  }
130
131
  return cached;
131
132
  }
@@ -436,7 +437,14 @@ export function compactMessageRow(m) {
436
437
  snippet: snippet.length > 120 ? `${snippet.slice(0, 119)}…` : snippet,
437
438
  };
438
439
  }
439
- export function registerGmailTools(server) {
440
+ export function registerGmailTools(server, deps = {}) {
441
+ // Per-registry, LIVE account enum + injectable client (S1.10): the
442
+ // schema follows the registry's account view at parse time, and the
443
+ // custody path is the context's, not the process global.
444
+ const accountEnum = accountArgLive(() => server.accountAliases()).optional();
445
+ const getClientFn = deps.getClientFn ?? getClient;
446
+ const localFiles = deps.localFiles ?? true;
447
+ const registerHostFileTool = localFiles ? server.registerTool : (() => undefined);
440
448
  server.registerTool('gmail_search', {
441
449
  description: 'Search messages in a Gmail account. Returns compact rows (id, from, subject, date, snippet); ' +
442
450
  'pass full=true for threadId, to, labelIds and the untruncated snippet.',
@@ -454,7 +462,7 @@ export function registerGmailTools(server) {
454
462
  if (query.trim() === '') {
455
463
  return invalidParams(account, '`query` is empty, and Gmail reads an empty query as "match everything".', 'Pass a real Gmail search term such as "is:unread" or "from:someone@example.com". Returning the whole mailbox for a blank query would look like a successful search.');
456
464
  }
457
- const auth = await getClient(account);
465
+ const auth = await getClientFn(account);
458
466
  const gmail = gmailClient({ version: 'v1', auth });
459
467
  const listRes = await gmail.users.messages.list({
460
468
  userId: 'me',
@@ -511,7 +519,7 @@ export function registerGmailTools(server) {
511
519
  },
512
520
  }, async ({ account, messageId, full, rawHtml }) => {
513
521
  try {
514
- const auth = await getClient(account);
522
+ const auth = await getClientFn(account);
515
523
  const gmail = gmailClient({ version: 'v1', auth });
516
524
  const res = await gmail.users.messages.get({
517
525
  userId: 'me',
@@ -542,7 +550,7 @@ export function registerGmailTools(server) {
542
550
  },
543
551
  }, async ({ account, threadId, full, rawHtml, mode }) => {
544
552
  try {
545
- const auth = await getClient(account);
553
+ const auth = await getClientFn(account);
546
554
  const gmail = gmailClient({ version: 'v1', auth });
547
555
  if (mode === 'summary') {
548
556
  const res = await gmail.users.threads.get({
@@ -592,7 +600,7 @@ export function registerGmailTools(server) {
592
600
  },
593
601
  }, async ({ account, ids, full, rawHtml }) => {
594
602
  try {
595
- const auth = await getClient(account);
603
+ const auth = await getClientFn(account);
596
604
  const gmail = gmailClient({ version: 'v1', auth });
597
605
  const result = await readBatch(gmail, account, ids ?? [], full === true, rawHtml === true);
598
606
  return {
@@ -622,13 +630,15 @@ export function registerGmailTools(server) {
622
630
  .describe('With replyToMessageId: include the source To+Cc (minus your own addresses) in cc. Default false (reply to sender only).'),
623
631
  replyToThreadId: z.string().optional()
624
632
  .describe('Thread ID to send the message in'),
625
- attachments: coerceJson(attachmentSchema),
633
+ ...(localFiles ? { attachments: coerceJson(attachmentSchema) } : {}),
626
634
  },
627
635
  }, async ({ account, to, subject, body, htmlBody, allowRawHtml, cc, replyToMessageId, replyAll, replyToThreadId, attachments }) => {
636
+ if (!localFiles && attachments?.length)
637
+ return hostFilesRefused(account, 'attachments');
628
638
  try {
629
- const auth = await getClient(account);
639
+ const auth = await getClientFn(account);
630
640
  const gmail = gmailClient({ version: 'v1', auth });
631
- const config = (await import('../accounts.js')).getAccountSet().configs[account];
641
+ const config = server.accountSet().configs[account];
632
642
  if (htmlBody !== undefined) {
633
643
  throw new GmailComposeError('E_HTMLBODY_REMOVED', 'htmlBody was removed in v6: author Markdown in `body`; for literal HTML pass `allowRawHtml: true`.');
634
644
  }
@@ -686,7 +696,7 @@ export function registerGmailTools(server) {
686
696
  return mapped ?? handleGmailError(error, account);
687
697
  }
688
698
  });
689
- server.registerTool('gmail_download_attachment', {
699
+ registerHostFileTool('gmail_download_attachment', {
690
700
  description: 'Download an email attachment to local disk. Use gmail_read first to get the attachmentId.',
691
701
  inputSchema: {
692
702
  account: accountEnum.describe('Google account alias'),
@@ -697,7 +707,7 @@ export function registerGmailTools(server) {
697
707
  },
698
708
  }, async ({ account, messageId, attachmentId, filename, savePath }) => {
699
709
  try {
700
- const auth = await getClient(account);
710
+ const auth = await getClientFn(account);
701
711
  const gmail = gmailClient({ version: 'v1', auth });
702
712
  const res = await gmail.users.messages.attachments.get({
703
713
  userId: 'me',
@@ -737,13 +747,15 @@ export function registerGmailTools(server) {
737
747
  .describe('With replyToMessageId: include the source To+Cc (minus your own addresses) in cc. Default false (reply to sender only).'),
738
748
  replyToThreadId: z.string().optional()
739
749
  .describe('Thread ID to associate the draft with'),
740
- attachments: coerceJson(attachmentSchema),
750
+ ...(localFiles ? { attachments: coerceJson(attachmentSchema) } : {}),
741
751
  },
742
752
  }, async ({ account, to, subject, body, htmlBody, allowRawHtml, cc, replyToMessageId, replyAll, replyToThreadId, attachments }) => {
753
+ if (!localFiles && attachments?.length)
754
+ return hostFilesRefused(account, 'attachments');
743
755
  try {
744
- const auth = await getClient(account);
756
+ const auth = await getClientFn(account);
745
757
  const gmail = gmailClient({ version: 'v1', auth });
746
- const config = (await import('../accounts.js')).getAccountSet().configs[account];
758
+ const config = server.accountSet().configs[account];
747
759
  if (htmlBody !== undefined) {
748
760
  throw new GmailComposeError('E_HTMLBODY_REMOVED', 'htmlBody was removed in v6: author Markdown in `body`; for literal HTML pass `allowRawHtml: true`.');
749
761
  }
@@ -811,7 +823,7 @@ export function registerGmailTools(server) {
811
823
  },
812
824
  }, async ({ account, messageId, addLabelIds, removeLabelIds }) => {
813
825
  try {
814
- const auth = await getClient(account);
826
+ const auth = await getClientFn(account);
815
827
  const gmail = gmailClient({ version: 'v1', auth });
816
828
  const res = await gmail.users.messages.modify({
817
829
  userId: 'me',
@@ -838,7 +850,7 @@ export function registerGmailTools(server) {
838
850
  },
839
851
  }, async ({ account, messageId }) => {
840
852
  try {
841
- const auth = await getClient(account);
853
+ const auth = await getClientFn(account);
842
854
  const gmail = gmailClient({ version: 'v1', auth });
843
855
  const res = await gmail.users.messages.trash({ userId: 'me', id: messageId });
844
856
  return {
@@ -858,7 +870,7 @@ export function registerGmailTools(server) {
858
870
  },
859
871
  }, async ({ account, messageId }) => {
860
872
  try {
861
- const auth = await getClient(account);
873
+ const auth = await getClientFn(account);
862
874
  const gmail = gmailClient({ version: 'v1', auth });
863
875
  await gmail.users.messages.delete({ userId: 'me', id: messageId });
864
876
  return {
@@ -880,7 +892,7 @@ export function registerGmailTools(server) {
880
892
  },
881
893
  }, async ({ account, messageIds, addLabelIds, removeLabelIds }) => {
882
894
  try {
883
- const auth = await getClient(account);
895
+ const auth = await getClientFn(account);
884
896
  const gmail = gmailClient({ version: 'v1', auth });
885
897
  await gmail.users.messages.batchModify({
886
898
  userId: 'me',
@@ -907,7 +919,7 @@ export function registerGmailTools(server) {
907
919
  },
908
920
  }, async ({ account, messageIds }) => {
909
921
  try {
910
- const auth = await getClient(account);
922
+ const auth = await getClientFn(account);
911
923
  const gmail = gmailClient({ version: 'v1', auth });
912
924
  await gmail.users.messages.batchDelete({
913
925
  userId: 'me',
@@ -932,7 +944,7 @@ export function registerGmailTools(server) {
932
944
  },
933
945
  }, async ({ account, maxResults, query }) => {
934
946
  try {
935
- const auth = await getClient(account);
947
+ const auth = await getClientFn(account);
936
948
  const gmail = gmailClient({ version: 'v1', auth });
937
949
  const res = await gmail.users.drafts.list({
938
950
  userId: 'me',
@@ -956,7 +968,7 @@ export function registerGmailTools(server) {
956
968
  },
957
969
  }, async ({ account, draftId }) => {
958
970
  try {
959
- const auth = await getClient(account);
971
+ const auth = await getClientFn(account);
960
972
  const gmail = gmailClient({ version: 'v1', auth });
961
973
  const res = await gmail.users.drafts.get({
962
974
  userId: 'me',
@@ -980,7 +992,7 @@ export function registerGmailTools(server) {
980
992
  },
981
993
  }, async ({ account, draftId }) => {
982
994
  try {
983
- const auth = await getClient(account);
995
+ const auth = await getClientFn(account);
984
996
  const gmail = gmailClient({ version: 'v1', auth });
985
997
  const res = await gmail.users.drafts.send({
986
998
  userId: 'me',
@@ -1002,7 +1014,7 @@ export function registerGmailTools(server) {
1002
1014
  },
1003
1015
  }, async ({ account }) => {
1004
1016
  try {
1005
- const auth = await getClient(account);
1017
+ const auth = await getClientFn(account);
1006
1018
  const gmail = gmailClient({ version: 'v1', auth });
1007
1019
  const res = await gmail.users.labels.list({ userId: 'me' });
1008
1020
  return {
@@ -1026,7 +1038,7 @@ export function registerGmailTools(server) {
1026
1038
  },
1027
1039
  }, async ({ account, name, messageListVisibility, labelListVisibility }) => {
1028
1040
  try {
1029
- const auth = await getClient(account);
1041
+ const auth = await getClientFn(account);
1030
1042
  const gmail = gmailClient({ version: 'v1', auth });
1031
1043
  const res = await gmail.users.labels.create({
1032
1044
  userId: 'me',
@@ -1053,7 +1065,7 @@ export function registerGmailTools(server) {
1053
1065
  },
1054
1066
  }, async ({ account, labelId }) => {
1055
1067
  try {
1056
- const auth = await getClient(account);
1068
+ const auth = await getClientFn(account);
1057
1069
  const gmail = gmailClient({ version: 'v1', auth });
1058
1070
  await gmail.users.labels.delete({ userId: 'me', id: labelId });
1059
1071
  return {
@@ -1072,7 +1084,7 @@ export function registerGmailTools(server) {
1072
1084
  },
1073
1085
  }, async ({ account }) => {
1074
1086
  try {
1075
- const auth = await getClient(account);
1087
+ const auth = await getClientFn(account);
1076
1088
  const gmail = gmailClient({ version: 'v1', auth });
1077
1089
  const res = await gmail.users.getProfile({ userId: 'me' });
1078
1090
  return {
@@ -1096,7 +1108,7 @@ export function registerGmailTools(server) {
1096
1108
  },
1097
1109
  }, async ({ account, startHistoryId, maxResults, historyTypes }) => {
1098
1110
  try {
1099
- const auth = await getClient(account);
1111
+ const auth = await getClientFn(account);
1100
1112
  const gmail = gmailClient({ version: 'v1', auth });
1101
1113
  const res = await gmail.users.history.list({
1102
1114
  userId: 'me',
@@ -1120,7 +1132,7 @@ export function registerGmailTools(server) {
1120
1132
  },
1121
1133
  }, async ({ account }) => {
1122
1134
  try {
1123
- const auth = await getClient(account);
1135
+ const auth = await getClientFn(account);
1124
1136
  const gmail = gmailClient({ version: 'v1', auth });
1125
1137
  const res = await gmail.users.settings.getVacation({ userId: 'me' });
1126
1138
  return {
@@ -1146,7 +1158,7 @@ export function registerGmailTools(server) {
1146
1158
  },
1147
1159
  }, async ({ account, enableAutoReply, responseSubject, responseBodyPlainText, startTime, endTime, restrictToContacts, restrictToDomain }) => {
1148
1160
  try {
1149
- const auth = await getClient(account);
1161
+ const auth = await getClientFn(account);
1150
1162
  const gmail = gmailClient({ version: 'v1', auth });
1151
1163
  const res = await gmail.users.settings.updateVacation({
1152
1164
  userId: 'me',
@@ -1,10 +1,9 @@
1
1
  import type { ToolRegistry } from '../registry.js';
2
2
  import { type Policy } from '../write-control.js';
3
- import { getClient } from '../client.js';
4
3
  import { type Toolsets } from '../toolsets.js';
4
+ import { type ExecuteDeps } from '../executor.js';
5
5
  import { type DiscoveryDeps, type DiscoveryMethod } from '../discovery-client.js';
6
- export interface EscapeDeps extends DiscoveryDeps {
7
- getClientFn?: typeof getClient;
6
+ export interface EscapeDeps extends DiscoveryDeps, ExecuteDeps {
8
7
  toolsets?: Toolsets;
9
8
  }
10
9
  /** Up to three closest known ids for the unknown_method did-you-mean hint;