mcp-google-multi 6.0.0-alpha.47 → 6.0.0-alpha.49

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 (62) hide show
  1. package/dist/accounts.d.ts +7 -0
  2. package/dist/accounts.js +14 -0
  3. package/dist/registry.d.ts +10 -0
  4. package/dist/registry.js +32 -1
  5. package/dist/tools/account-wizard.js +9 -0
  6. package/dist/tools/generated/_shared.d.ts +2 -1
  7. package/dist/tools/generated/_shared.js +6 -3
  8. package/dist/tools/generated/admin.d.ts +2 -1
  9. package/dist/tools/generated/admin.js +265 -265
  10. package/dist/tools/generated/analytics.d.ts +2 -1
  11. package/dist/tools/generated/analytics.js +125 -125
  12. package/dist/tools/generated/appsmarket.d.ts +2 -1
  13. package/dist/tools/generated/appsmarket.js +5 -5
  14. package/dist/tools/generated/calendar.d.ts +2 -1
  15. package/dist/tools/generated/calendar.js +55 -55
  16. package/dist/tools/generated/chat.d.ts +2 -1
  17. package/dist/tools/generated/chat.js +95 -95
  18. package/dist/tools/generated/classroom.d.ts +2 -1
  19. package/dist/tools/generated/classroom.js +209 -209
  20. package/dist/tools/generated/cloudidentity.d.ts +2 -1
  21. package/dist/tools/generated/cloudidentity.js +133 -133
  22. package/dist/tools/generated/cloudsearch.d.ts +2 -1
  23. package/dist/tools/generated/cloudsearch.js +99 -99
  24. package/dist/tools/generated/contacts.d.ts +2 -1
  25. package/dist/tools/generated/contacts.js +29 -29
  26. package/dist/tools/generated/drive.d.ts +2 -1
  27. package/dist/tools/generated/drive.js +71 -71
  28. package/dist/tools/generated/driveactivity.d.ts +2 -1
  29. package/dist/tools/generated/driveactivity.js +3 -3
  30. package/dist/tools/generated/drivelabels.d.ts +2 -1
  31. package/dist/tools/generated/drivelabels.js +53 -53
  32. package/dist/tools/generated/forms.d.ts +2 -1
  33. package/dist/tools/generated/forms.js +7 -7
  34. package/dist/tools/generated/gmail.d.ts +2 -1
  35. package/dist/tools/generated/gmail.js +117 -117
  36. package/dist/tools/generated/groupsmigration.d.ts +2 -1
  37. package/dist/tools/generated/groupsmigration.js +3 -3
  38. package/dist/tools/generated/groupssettings.d.ts +2 -1
  39. package/dist/tools/generated/groupssettings.js +7 -7
  40. package/dist/tools/generated/keep.d.ts +2 -1
  41. package/dist/tools/generated/keep.js +15 -15
  42. package/dist/tools/generated/licensing.d.ts +2 -1
  43. package/dist/tools/generated/licensing.js +15 -15
  44. package/dist/tools/generated/meet.d.ts +2 -1
  45. package/dist/tools/generated/meet.js +27 -27
  46. package/dist/tools/generated/postmaster.d.ts +2 -1
  47. package/dist/tools/generated/postmaster.js +9 -9
  48. package/dist/tools/generated/reseller.d.ts +2 -1
  49. package/dist/tools/generated/reseller.js +35 -35
  50. package/dist/tools/generated/script.d.ts +2 -1
  51. package/dist/tools/generated/script.js +33 -33
  52. package/dist/tools/generated/searchconsole.d.ts +2 -1
  53. package/dist/tools/generated/searchconsole.js +3 -3
  54. package/dist/tools/generated/sheets.d.ts +2 -1
  55. package/dist/tools/generated/sheets.js +15 -15
  56. package/dist/tools/generated/tasks.d.ts +2 -1
  57. package/dist/tools/generated/tasks.js +5 -5
  58. package/dist/tools/generated/vault.d.ts +2 -1
  59. package/dist/tools/generated/vault.js +67 -67
  60. package/dist/tools/generated/workspaceevents.d.ts +2 -1
  61. package/dist/tools/generated/workspaceevents.js +31 -31
  62. package/package.json +1 -1
@@ -48,6 +48,13 @@ export declare function unknownAliasMessage(aliases: readonly string[], selector
48
48
  export declare function accountAliasSchemaFor(aliases: readonly string[]): z.ZodType<string>;
49
49
  /** Shared, load-time snapshot used by every tool's `account` field. */
50
50
  export declare const accountAliasSchema: z.ZodType<string>;
51
+ /** Live account argument: validates at PARSE time against the accessor's
52
+ * CURRENT aliases, so an alias added mid-session (account_add, or a tenant
53
+ * alias link) is immediately valid on already-registered tools — a baked
54
+ * z.enum freezes the boot-time set until restart. An empty set stays
55
+ * permissive (same empty-safe rule as above); dispatch still resolves the
56
+ * alias against the live registry. */
57
+ export declare function accountArgLive(aliases: () => readonly string[]): z.ZodType<string>;
51
58
  /**
52
59
  * BR-4: the stdio/http SERVER never boots with an empty registry — a fresh user
53
60
  * bootstraps via env / `migrate-config` / `account import` / `auth` first. The
package/dist/accounts.js CHANGED
@@ -302,6 +302,20 @@ export function accountAliasSchemaFor(aliases) {
302
302
  }
303
303
  /** Shared, load-time snapshot used by every tool's `account` field. */
304
304
  export const accountAliasSchema = accountAliasSchemaFor(ACCOUNTS);
305
+ /** Live account argument: validates at PARSE time against the accessor's
306
+ * CURRENT aliases, so an alias added mid-session (account_add, or a tenant
307
+ * alias link) is immediately valid on already-registered tools — a baked
308
+ * z.enum freezes the boot-time set until restart. An empty set stays
309
+ * permissive (same empty-safe rule as above); dispatch still resolves the
310
+ * alias against the live registry. */
311
+ export function accountArgLive(aliases) {
312
+ return z.string().superRefine((value, ctx) => {
313
+ const current = aliases();
314
+ if (current.length > 0 && !current.includes(value)) {
315
+ ctx.addIssue({ code: 'custom', message: unknownAliasMessage(current) });
316
+ }
317
+ });
318
+ }
305
319
  /**
306
320
  * BR-4: the stdio/http SERVER never boots with an empty registry — a fresh user
307
321
  * bootstraps via env / `migrate-config` / `account import` / `auth` first. The
@@ -62,6 +62,9 @@ export declare class ToolRegistry {
62
62
  constructor(server: McpServer, policy: Policy, mode?: DiscoveryMode, metrics?: Metrics | null, accounts?: () => AccountSet);
63
63
  registerMeta: McpServer['registerTool'];
64
64
  services(): string[];
65
+ /** The registry's OWN alias list: registration-time schema builders (the
66
+ * generated account enums) read this, never the process global. */
67
+ accountAliases(): readonly string[];
65
68
  /** Declared input-schema keys + scalar kinds for one tool (tools/call arg
66
69
  * normalization; the kind drives value coercion on renamed keys). */
67
70
  argShape(name: string): ArgShape | undefined;
@@ -120,4 +123,11 @@ export declare class ToolRegistry {
120
123
  };
121
124
  installListHandler(): void;
122
125
  private toToolJson;
126
+ /** Advertise the CURRENT alias enum on every tools/list: account validation
127
+ * is (or is becoming) live, so a cached boot-time enum would go stale the
128
+ * moment account_add lands mid-session. The structural schema stays cached;
129
+ * only the account property's values are refreshed per call. Skipped for
130
+ * the subject-taking account tools (their `account` is the OPERAND, e.g. a
131
+ * brand-new alias name, not an identity to enumerate). */
132
+ private withLiveAccountEnum;
123
133
  }
package/dist/registry.js CHANGED
@@ -245,6 +245,11 @@ export class ToolRegistry {
245
245
  services() {
246
246
  return [...new Set(this.tools.filter((t) => !t.meta).map((t) => t.service))];
247
247
  }
248
+ /** The registry's OWN alias list: registration-time schema builders (the
249
+ * generated account enums) read this, never the process global. */
250
+ accountAliases() {
251
+ return this.accounts().aliases;
252
+ }
248
253
  /** Declared input-schema keys + scalar kinds for one tool (tools/call arg
249
254
  * normalization; the kind drives value coercion on renamed keys). */
250
255
  argShape(name) {
@@ -446,9 +451,35 @@ export class ToolRegistry {
446
451
  return {
447
452
  name: tool.name,
448
453
  description: tool.description,
449
- inputSchema,
454
+ inputSchema: this.withLiveAccountEnum(tool, inputSchema),
450
455
  annotations: tool.annotations,
451
456
  ...(tool.clientMeta ? { _meta: tool.clientMeta } : {}),
452
457
  };
453
458
  }
459
+ /** Advertise the CURRENT alias enum on every tools/list: account validation
460
+ * is (or is becoming) live, so a cached boot-time enum would go stale the
461
+ * moment account_add lands mid-session. The structural schema stays cached;
462
+ * only the account property's values are refreshed per call. Skipped for
463
+ * the subject-taking account tools (their `account` is the OPERAND, e.g. a
464
+ * brand-new alias name, not an identity to enumerate). */
465
+ withLiveAccountEnum(tool, schema) {
466
+ if (DEFAULT_ACCOUNT_EXCLUDE.has(tool.name))
467
+ return schema;
468
+ const s = schema;
469
+ const account = s?.properties?.account;
470
+ if (!account)
471
+ return schema;
472
+ const aliases = this.accounts().aliases;
473
+ if (aliases.length === 0)
474
+ return schema;
475
+ if (Array.isArray(account.anyOf)) {
476
+ // fan-out union: refresh the enum branch ('*' + aliases), keep the CSV branch
477
+ const hasEnumBranch = account.anyOf.some((b) => Array.isArray(b.enum));
478
+ if (!hasEnumBranch)
479
+ return schema;
480
+ const anyOf = account.anyOf.map((b) => (Array.isArray(b.enum) ? { ...b, enum: ['*', ...aliases] } : b));
481
+ return { ...s, properties: { ...s.properties, account: { ...account, anyOf } } };
482
+ }
483
+ return { ...s, properties: { ...s.properties, account: { ...account, enum: [...aliases] } } };
484
+ }
454
485
  }
@@ -297,6 +297,15 @@ export function registerAccountWizardTools(registry, server) {
297
297
  // S2: atomic write + make the alias callable without a restart (BR3).
298
298
  writeAccountRow(validated.alias, validated.email, validated.bundles, validated.admin);
299
299
  invalidateAccountSet();
300
+ // Live account args validate against the refreshed registry already;
301
+ // the list_changed nudge makes clients re-fetch tools/list, where the
302
+ // advertised account enums are rebuilt from the live set.
303
+ try {
304
+ server.sendToolListChanged();
305
+ }
306
+ catch {
307
+ // a client that cannot receive notifications loses nothing but the nudge
308
+ }
300
309
  // S3 + S4: consent + validate.
301
310
  const consent = await runConsent(server, validated.alias);
302
311
  if (consent.ok === 'pending')
@@ -21,5 +21,6 @@ export interface GeneratedToolDef {
21
21
  }>;
22
22
  shape: z.ZodRawShape;
23
23
  }
24
- export declare function accountField(): z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
24
+ export declare function accountField(aliases?: readonly string[]): z.ZodOptional<z.ZodType<string, unknown, z.core.$ZodTypeInternals<string, unknown>>>;
25
+ export type { ExecuteDeps } from '../../executor.js';
25
26
  export declare function registerGeneratedTool(registry: ToolRegistry, def: GeneratedToolDef, deps?: ExecuteDeps): void;
@@ -1,7 +1,10 @@
1
- import { accountAliasSchema } from '../../accounts.js';
1
+ import { accountAliasSchema, accountAliasSchemaFor } from '../../accounts.js';
2
2
  import { executeApiMethod } from '../../executor.js';
3
- export function accountField() {
4
- return accountAliasSchema.optional().describe('Google account alias (omit for the default account)');
3
+ export function accountField(aliases) {
4
+ // Per-registry enum when the caller supplies its alias list (regenerated
5
+ // code passes registry.accountAliases()); the no-arg form keeps the
6
+ // global-bound schema for compatibility.
7
+ return (aliases ? accountAliasSchemaFor(aliases) : accountAliasSchema).optional().describe('Google account alias (omit for the default account)');
5
8
  }
6
9
  export function registerGeneratedTool(registry, def, deps = {}) {
7
10
  // Widened locally: `cud` is a registry extension the SDK config type doesn't
@@ -1,2 +1,3 @@
1
1
  import type { ToolRegistry } from '../../registry.js';
2
- export declare function registerAdminGeneratedTools(registry: ToolRegistry): void;
2
+ import { type ExecuteDeps } from './_shared.js';
3
+ export declare function registerAdminGeneratedTools(registry: ToolRegistry, deps?: ExecuteDeps): void;