integrate-sdk 0.9.62 → 0.10.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 (100) hide show
  1. package/README.md +2 -2
  2. package/dist/adapters/auto-routes.js +21 -21
  3. package/dist/adapters/base-handler.js +21 -21
  4. package/dist/adapters/index.js +124 -81
  5. package/dist/adapters/nextjs.js +21 -21
  6. package/dist/adapters/solid-start.js +124 -81
  7. package/dist/adapters/svelte-kit.js +124 -81
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +337 -296
  11. package/dist/integrations.js +327 -286
  12. package/dist/oauth.js +21 -21
  13. package/dist/server.js +345 -302
  14. package/dist/src/client.d.ts +23 -22
  15. package/dist/src/client.d.ts.map +1 -1
  16. package/dist/src/index.d.ts +22 -22
  17. package/dist/src/index.d.ts.map +1 -1
  18. package/dist/src/integrations/{ga4-client.d.ts → google_analytics-client.d.ts} +2 -2
  19. package/dist/src/integrations/google_analytics-client.d.ts.map +1 -0
  20. package/dist/src/integrations/google_analytics.d.ts +13 -0
  21. package/dist/src/integrations/google_analytics.d.ts.map +1 -0
  22. package/dist/src/integrations/{gcal-client.d.ts → google_calendar-client.d.ts} +11 -11
  23. package/dist/src/integrations/google_calendar-client.d.ts.map +1 -0
  24. package/dist/src/integrations/google_calendar.d.ts +39 -0
  25. package/dist/src/integrations/google_calendar.d.ts.map +1 -0
  26. package/dist/src/integrations/{gchat-client.d.ts → google_chat-client.d.ts} +2 -2
  27. package/dist/src/integrations/google_chat-client.d.ts.map +1 -0
  28. package/dist/src/integrations/google_chat.d.ts +15 -0
  29. package/dist/src/integrations/google_chat.d.ts.map +1 -0
  30. package/dist/src/integrations/{gcontacts-client.d.ts → google_contacts-client.d.ts} +2 -2
  31. package/dist/src/integrations/google_contacts-client.d.ts.map +1 -0
  32. package/dist/src/integrations/google_contacts.d.ts +22 -0
  33. package/dist/src/integrations/google_contacts.d.ts.map +1 -0
  34. package/dist/src/integrations/{gdocs-client.d.ts → google_docs-client.d.ts} +1 -1
  35. package/dist/src/integrations/google_docs-client.d.ts.map +1 -0
  36. package/dist/src/integrations/google_docs.d.ts +22 -0
  37. package/dist/src/integrations/google_docs.d.ts.map +1 -0
  38. package/dist/src/integrations/{gdrive-client.d.ts → google_drive-client.d.ts} +15 -15
  39. package/dist/src/integrations/google_drive-client.d.ts.map +1 -0
  40. package/dist/src/integrations/google_drive.d.ts +22 -0
  41. package/dist/src/integrations/google_drive.d.ts.map +1 -0
  42. package/dist/src/integrations/{gkeep-client.d.ts → google_keep-client.d.ts} +2 -2
  43. package/dist/src/integrations/google_keep-client.d.ts.map +1 -0
  44. package/dist/src/integrations/google_keep.d.ts +22 -0
  45. package/dist/src/integrations/google_keep.d.ts.map +1 -0
  46. package/dist/src/integrations/{gmeet-client.d.ts → google_meet-client.d.ts} +2 -2
  47. package/dist/src/integrations/google_meet-client.d.ts.map +1 -0
  48. package/dist/src/integrations/google_meet.d.ts +19 -0
  49. package/dist/src/integrations/google_meet.d.ts.map +1 -0
  50. package/dist/src/integrations/{gsheets-client.d.ts → google_sheets-client.d.ts} +1 -1
  51. package/dist/src/integrations/google_sheets-client.d.ts.map +1 -0
  52. package/dist/src/integrations/google_sheets.d.ts +22 -0
  53. package/dist/src/integrations/google_sheets.d.ts.map +1 -0
  54. package/dist/src/integrations/{gslides-client.d.ts → google_slides-client.d.ts} +1 -1
  55. package/dist/src/integrations/google_slides-client.d.ts.map +1 -0
  56. package/dist/src/integrations/google_slides.d.ts +22 -0
  57. package/dist/src/integrations/google_slides.d.ts.map +1 -0
  58. package/dist/src/integrations/{gtasks-client.d.ts → google_tasks-client.d.ts} +2 -2
  59. package/dist/src/integrations/google_tasks-client.d.ts.map +1 -0
  60. package/dist/src/integrations/google_tasks.d.ts +22 -0
  61. package/dist/src/integrations/google_tasks.d.ts.map +1 -0
  62. package/dist/src/integrations/list-tools-by-integration.d.ts +11 -0
  63. package/dist/src/integrations/list-tools-by-integration.d.ts.map +1 -0
  64. package/dist/src/server.d.ts +11 -11
  65. package/dist/src/server.d.ts.map +1 -1
  66. package/index.ts +20 -20
  67. package/package.json +1 -1
  68. package/dist/src/integrations/ga4-client.d.ts.map +0 -1
  69. package/dist/src/integrations/ga4.d.ts +0 -13
  70. package/dist/src/integrations/ga4.d.ts.map +0 -1
  71. package/dist/src/integrations/gcal-client.d.ts.map +0 -1
  72. package/dist/src/integrations/gcal.d.ts +0 -39
  73. package/dist/src/integrations/gcal.d.ts.map +0 -1
  74. package/dist/src/integrations/gchat-client.d.ts.map +0 -1
  75. package/dist/src/integrations/gchat.d.ts +0 -15
  76. package/dist/src/integrations/gchat.d.ts.map +0 -1
  77. package/dist/src/integrations/gcontacts-client.d.ts.map +0 -1
  78. package/dist/src/integrations/gcontacts.d.ts +0 -22
  79. package/dist/src/integrations/gcontacts.d.ts.map +0 -1
  80. package/dist/src/integrations/gdocs-client.d.ts.map +0 -1
  81. package/dist/src/integrations/gdocs.d.ts +0 -22
  82. package/dist/src/integrations/gdocs.d.ts.map +0 -1
  83. package/dist/src/integrations/gdrive-client.d.ts.map +0 -1
  84. package/dist/src/integrations/gdrive.d.ts +0 -22
  85. package/dist/src/integrations/gdrive.d.ts.map +0 -1
  86. package/dist/src/integrations/gkeep-client.d.ts.map +0 -1
  87. package/dist/src/integrations/gkeep.d.ts +0 -22
  88. package/dist/src/integrations/gkeep.d.ts.map +0 -1
  89. package/dist/src/integrations/gmeet-client.d.ts.map +0 -1
  90. package/dist/src/integrations/gmeet.d.ts +0 -19
  91. package/dist/src/integrations/gmeet.d.ts.map +0 -1
  92. package/dist/src/integrations/gsheets-client.d.ts.map +0 -1
  93. package/dist/src/integrations/gsheets.d.ts +0 -22
  94. package/dist/src/integrations/gsheets.d.ts.map +0 -1
  95. package/dist/src/integrations/gslides-client.d.ts.map +0 -1
  96. package/dist/src/integrations/gslides.d.ts +0 -22
  97. package/dist/src/integrations/gslides.d.ts.map +0 -1
  98. package/dist/src/integrations/gtasks-client.d.ts.map +0 -1
  99. package/dist/src/integrations/gtasks.d.ts +0 -22
  100. package/dist/src/integrations/gtasks.d.ts.map +0 -1
package/README.md CHANGED
@@ -344,7 +344,7 @@ For complete OAuth setup including:
344
344
  - Multiple providers
345
345
  - Callback page setup
346
346
 
347
- See the [`/examples`](/examples) directory or [OAuth documentation](https://integrate.dev/docs/guides/oauth-flow).
347
+ See the [`/examples`](/examples) directory or [OAuth documentation](https://integrate.dev/docs/getting-started/basic-usage).
348
348
 
349
349
  ## Scheduled Triggers
350
350
 
@@ -488,7 +488,7 @@ const result = await generateText({
488
488
  For detailed guides, API reference, and examples, visit the [complete documentation](https://integrate.dev):
489
489
 
490
490
  - **[Getting Started](https://integrate.dev/docs/getting-started/installation)** - Installation and quick start
491
- - **[OAuth Flow](https://integrate.dev/docs/guides/oauth-flow)** - OAuth 2.0 authorization guide
491
+ - **[OAuth Flow](https://integrate.dev/docs/getting-started/basic-usage)** - OAuth 2.0 authorization guide
492
492
  - **[Integrations](https://integrate.dev/docs/integrations)** - Built-in integrations and configuration
493
493
  - **[Vercel AI SDK](https://integrate.dev/docs/artificial-intelligence/vercel-ai-sdk)** - AI model integration
494
494
  - **[Advanced Usage](https://integrate.dev/docs/guides/advanced-usage)** - Error handling, retries, and more
@@ -750,23 +750,23 @@ var init_library_metadata = __esm(() => {
750
750
  description: "Send, read, and search Gmail messages",
751
751
  category: "Communication"
752
752
  },
753
- gcal: {
753
+ google_calendar: {
754
754
  description: "Manage Google Calendar events and schedules",
755
755
  category: "Productivity"
756
756
  },
757
- gtasks: {
757
+ google_tasks: {
758
758
  description: "Manage Google Tasks lists and to-dos",
759
759
  category: "Productivity"
760
760
  },
761
- gkeep: {
761
+ google_keep: {
762
762
  description: "Manage Google Keep notes, attachments, and sharing permissions",
763
763
  category: "Productivity"
764
764
  },
765
- gmeet: {
765
+ google_meet: {
766
766
  description: "Create Google Meet links and manage meeting events via Calendar",
767
767
  category: "Communication"
768
768
  },
769
- gcontacts: {
769
+ google_contacts: {
770
770
  description: "List, search, create, update, and delete Google Contacts via the People API",
771
771
  category: "Communication"
772
772
  },
@@ -902,19 +902,19 @@ var init_library_metadata = __esm(() => {
902
902
  description: "Manage Todoist tasks, projects, and labels",
903
903
  category: "Productivity"
904
904
  },
905
- gslides: {
905
+ google_slides: {
906
906
  description: "Create and update Google Slides presentations",
907
907
  category: "Productivity"
908
908
  },
909
- gsheets: {
909
+ google_sheets: {
910
910
  description: "Read and update Google Sheets spreadsheets",
911
911
  category: "Productivity"
912
912
  },
913
- gdocs: {
913
+ google_docs: {
914
914
  description: "Create and edit Google Docs documents",
915
915
  category: "Productivity"
916
916
  },
917
- gdrive: {
917
+ google_drive: {
918
918
  description: "Manage Google Drive files, folders, and sharing",
919
919
  category: "Storage"
920
920
  },
@@ -1030,11 +1030,11 @@ var init_library_metadata = __esm(() => {
1030
1030
  description: "Read eToro portfolio data and market instruments",
1031
1031
  category: "Finance"
1032
1032
  },
1033
- ga4: {
1033
+ google_analytics: {
1034
1034
  description: "Read Google Analytics reports, properties, and events",
1035
1035
  category: "Analytics"
1036
1036
  },
1037
- gchat: {
1037
+ google_chat: {
1038
1038
  description: "Send messages and manage Google Chat spaces and memberships",
1039
1039
  category: "Communication"
1040
1040
  },
@@ -1406,16 +1406,16 @@ var init_email_fetcher = __esm(() => {
1406
1406
  github: fetchGitHubEmail,
1407
1407
  gmail: fetchGoogleEmail,
1408
1408
  google: fetchGoogleEmail,
1409
- gcal: fetchGoogleEmail,
1410
- gdrive: fetchGoogleEmail,
1411
- gdocs: fetchGoogleEmail,
1412
- gsheets: fetchGoogleEmail,
1413
- gslides: fetchGoogleEmail,
1414
- gcontacts: fetchGoogleEmail,
1415
- gmeet: fetchGoogleEmail,
1416
- gchat: fetchGoogleEmail,
1417
- gtasks: fetchGoogleEmail,
1418
- ga4: fetchGoogleEmail,
1409
+ google_calendar: fetchGoogleEmail,
1410
+ google_drive: fetchGoogleEmail,
1411
+ google_docs: fetchGoogleEmail,
1412
+ google_sheets: fetchGoogleEmail,
1413
+ google_slides: fetchGoogleEmail,
1414
+ google_contacts: fetchGoogleEmail,
1415
+ google_meet: fetchGoogleEmail,
1416
+ google_chat: fetchGoogleEmail,
1417
+ google_tasks: fetchGoogleEmail,
1418
+ google_analytics: fetchGoogleEmail,
1419
1419
  youtube: fetchGoogleEmail,
1420
1420
  notion: fetchNotionEmail,
1421
1421
  linear: fetchLinearEmail,
@@ -750,23 +750,23 @@ var init_library_metadata = __esm(() => {
750
750
  description: "Send, read, and search Gmail messages",
751
751
  category: "Communication"
752
752
  },
753
- gcal: {
753
+ google_calendar: {
754
754
  description: "Manage Google Calendar events and schedules",
755
755
  category: "Productivity"
756
756
  },
757
- gtasks: {
757
+ google_tasks: {
758
758
  description: "Manage Google Tasks lists and to-dos",
759
759
  category: "Productivity"
760
760
  },
761
- gkeep: {
761
+ google_keep: {
762
762
  description: "Manage Google Keep notes, attachments, and sharing permissions",
763
763
  category: "Productivity"
764
764
  },
765
- gmeet: {
765
+ google_meet: {
766
766
  description: "Create Google Meet links and manage meeting events via Calendar",
767
767
  category: "Communication"
768
768
  },
769
- gcontacts: {
769
+ google_contacts: {
770
770
  description: "List, search, create, update, and delete Google Contacts via the People API",
771
771
  category: "Communication"
772
772
  },
@@ -902,19 +902,19 @@ var init_library_metadata = __esm(() => {
902
902
  description: "Manage Todoist tasks, projects, and labels",
903
903
  category: "Productivity"
904
904
  },
905
- gslides: {
905
+ google_slides: {
906
906
  description: "Create and update Google Slides presentations",
907
907
  category: "Productivity"
908
908
  },
909
- gsheets: {
909
+ google_sheets: {
910
910
  description: "Read and update Google Sheets spreadsheets",
911
911
  category: "Productivity"
912
912
  },
913
- gdocs: {
913
+ google_docs: {
914
914
  description: "Create and edit Google Docs documents",
915
915
  category: "Productivity"
916
916
  },
917
- gdrive: {
917
+ google_drive: {
918
918
  description: "Manage Google Drive files, folders, and sharing",
919
919
  category: "Storage"
920
920
  },
@@ -1030,11 +1030,11 @@ var init_library_metadata = __esm(() => {
1030
1030
  description: "Read eToro portfolio data and market instruments",
1031
1031
  category: "Finance"
1032
1032
  },
1033
- ga4: {
1033
+ google_analytics: {
1034
1034
  description: "Read Google Analytics reports, properties, and events",
1035
1035
  category: "Analytics"
1036
1036
  },
1037
- gchat: {
1037
+ google_chat: {
1038
1038
  description: "Send messages and manage Google Chat spaces and memberships",
1039
1039
  category: "Communication"
1040
1040
  },
@@ -1406,16 +1406,16 @@ var init_email_fetcher = __esm(() => {
1406
1406
  github: fetchGitHubEmail,
1407
1407
  gmail: fetchGoogleEmail,
1408
1408
  google: fetchGoogleEmail,
1409
- gcal: fetchGoogleEmail,
1410
- gdrive: fetchGoogleEmail,
1411
- gdocs: fetchGoogleEmail,
1412
- gsheets: fetchGoogleEmail,
1413
- gslides: fetchGoogleEmail,
1414
- gcontacts: fetchGoogleEmail,
1415
- gmeet: fetchGoogleEmail,
1416
- gchat: fetchGoogleEmail,
1417
- gtasks: fetchGoogleEmail,
1418
- ga4: fetchGoogleEmail,
1409
+ google_calendar: fetchGoogleEmail,
1410
+ google_drive: fetchGoogleEmail,
1411
+ google_docs: fetchGoogleEmail,
1412
+ google_sheets: fetchGoogleEmail,
1413
+ google_slides: fetchGoogleEmail,
1414
+ google_contacts: fetchGoogleEmail,
1415
+ google_meet: fetchGoogleEmail,
1416
+ google_chat: fetchGoogleEmail,
1417
+ google_tasks: fetchGoogleEmail,
1418
+ google_analytics: fetchGoogleEmail,
1419
1419
  youtube: fetchGoogleEmail,
1420
1420
  notion: fetchNotionEmail,
1421
1421
  linear: fetchLinearEmail,
@@ -750,23 +750,23 @@ var init_library_metadata = __esm(() => {
750
750
  description: "Send, read, and search Gmail messages",
751
751
  category: "Communication"
752
752
  },
753
- gcal: {
753
+ google_calendar: {
754
754
  description: "Manage Google Calendar events and schedules",
755
755
  category: "Productivity"
756
756
  },
757
- gtasks: {
757
+ google_tasks: {
758
758
  description: "Manage Google Tasks lists and to-dos",
759
759
  category: "Productivity"
760
760
  },
761
- gkeep: {
761
+ google_keep: {
762
762
  description: "Manage Google Keep notes, attachments, and sharing permissions",
763
763
  category: "Productivity"
764
764
  },
765
- gmeet: {
765
+ google_meet: {
766
766
  description: "Create Google Meet links and manage meeting events via Calendar",
767
767
  category: "Communication"
768
768
  },
769
- gcontacts: {
769
+ google_contacts: {
770
770
  description: "List, search, create, update, and delete Google Contacts via the People API",
771
771
  category: "Communication"
772
772
  },
@@ -902,19 +902,19 @@ var init_library_metadata = __esm(() => {
902
902
  description: "Manage Todoist tasks, projects, and labels",
903
903
  category: "Productivity"
904
904
  },
905
- gslides: {
905
+ google_slides: {
906
906
  description: "Create and update Google Slides presentations",
907
907
  category: "Productivity"
908
908
  },
909
- gsheets: {
909
+ google_sheets: {
910
910
  description: "Read and update Google Sheets spreadsheets",
911
911
  category: "Productivity"
912
912
  },
913
- gdocs: {
913
+ google_docs: {
914
914
  description: "Create and edit Google Docs documents",
915
915
  category: "Productivity"
916
916
  },
917
- gdrive: {
917
+ google_drive: {
918
918
  description: "Manage Google Drive files, folders, and sharing",
919
919
  category: "Storage"
920
920
  },
@@ -1030,11 +1030,11 @@ var init_library_metadata = __esm(() => {
1030
1030
  description: "Read eToro portfolio data and market instruments",
1031
1031
  category: "Finance"
1032
1032
  },
1033
- ga4: {
1033
+ google_analytics: {
1034
1034
  description: "Read Google Analytics reports, properties, and events",
1035
1035
  category: "Analytics"
1036
1036
  },
1037
- gchat: {
1037
+ google_chat: {
1038
1038
  description: "Send messages and manage Google Chat spaces and memberships",
1039
1039
  category: "Communication"
1040
1040
  },
@@ -1406,16 +1406,16 @@ var init_email_fetcher = __esm(() => {
1406
1406
  github: fetchGitHubEmail,
1407
1407
  gmail: fetchGoogleEmail,
1408
1408
  google: fetchGoogleEmail,
1409
- gcal: fetchGoogleEmail,
1410
- gdrive: fetchGoogleEmail,
1411
- gdocs: fetchGoogleEmail,
1412
- gsheets: fetchGoogleEmail,
1413
- gslides: fetchGoogleEmail,
1414
- gcontacts: fetchGoogleEmail,
1415
- gmeet: fetchGoogleEmail,
1416
- gchat: fetchGoogleEmail,
1417
- gtasks: fetchGoogleEmail,
1418
- ga4: fetchGoogleEmail,
1409
+ google_calendar: fetchGoogleEmail,
1410
+ google_drive: fetchGoogleEmail,
1411
+ google_docs: fetchGoogleEmail,
1412
+ google_sheets: fetchGoogleEmail,
1413
+ google_slides: fetchGoogleEmail,
1414
+ google_contacts: fetchGoogleEmail,
1415
+ google_meet: fetchGoogleEmail,
1416
+ google_chat: fetchGoogleEmail,
1417
+ google_tasks: fetchGoogleEmail,
1418
+ google_analytics: fetchGoogleEmail,
1419
1419
  youtube: fetchGoogleEmail,
1420
1420
  notion: fetchNotionEmail,
1421
1421
  linear: fetchLinearEmail,
@@ -2728,6 +2728,79 @@ class HttpSessionTransport {
2728
2728
 
2729
2729
  // ../client.ts
2730
2730
  init_integration_summary();
2731
+
2732
+ // ../integrations/list-tools-by-integration.ts
2733
+ function extractToolEntries(payload) {
2734
+ if (Array.isArray(payload)) {
2735
+ return payload;
2736
+ }
2737
+ if (payload && typeof payload === "object" && "tools" in payload) {
2738
+ const tools = payload.tools;
2739
+ if (Array.isArray(tools)) {
2740
+ return tools;
2741
+ }
2742
+ }
2743
+ return [];
2744
+ }
2745
+ function toMetadataTool(entry, availableTools) {
2746
+ if (entry.inputSchema) {
2747
+ return {
2748
+ name: entry.name,
2749
+ description: entry.description,
2750
+ inputSchema: entry.inputSchema
2751
+ };
2752
+ }
2753
+ const cached = availableTools.get(entry.name);
2754
+ if (cached) {
2755
+ return cached;
2756
+ }
2757
+ return {
2758
+ name: entry.name,
2759
+ description: entry.description,
2760
+ inputSchema: {
2761
+ type: "object",
2762
+ properties: {}
2763
+ }
2764
+ };
2765
+ }
2766
+ function parseToolsFromListByIntegrationPayload(payload, availableTools) {
2767
+ const tools = [];
2768
+ for (const entry of extractToolEntries(payload)) {
2769
+ if (typeof entry === "string") {
2770
+ const cached = availableTools.get(entry);
2771
+ tools.push(cached ?? {
2772
+ name: entry,
2773
+ inputSchema: { type: "object", properties: {} }
2774
+ });
2775
+ continue;
2776
+ }
2777
+ if (!entry || typeof entry !== "object" || !("name" in entry)) {
2778
+ continue;
2779
+ }
2780
+ const candidate = entry;
2781
+ if (!candidate.name) {
2782
+ continue;
2783
+ }
2784
+ const normalized = toMetadataTool({
2785
+ name: candidate.name,
2786
+ description: candidate.description,
2787
+ inputSchema: candidate.inputSchema
2788
+ }, availableTools);
2789
+ if (normalized) {
2790
+ tools.push(normalized);
2791
+ }
2792
+ }
2793
+ return tools;
2794
+ }
2795
+ function parseToolsFromListByIntegrationText(text, availableTools) {
2796
+ try {
2797
+ return parseToolsFromListByIntegrationPayload(JSON.parse(text), availableTools);
2798
+ } catch {
2799
+ return [];
2800
+ }
2801
+ }
2802
+
2803
+ // ../client.ts
2731
2804
  init_library_metadata();
2732
2805
 
2733
2806
  // ../database/token-store.ts
@@ -4270,21 +4343,7 @@ class MCPClientBase {
4270
4343
  const response = await this.callServerToolInternal("list_tools_by_integration", {
4271
4344
  integration: integration.id
4272
4345
  });
4273
- let toolMetadata = [];
4274
- if (response.content && Array.isArray(response.content)) {
4275
- for (const item of response.content) {
4276
- if (item.type === "text" && item.text) {
4277
- try {
4278
- const parsed = JSON.parse(item.text);
4279
- if (Array.isArray(parsed)) {
4280
- toolMetadata = parsed;
4281
- } else if (parsed.tools && Array.isArray(parsed.tools)) {
4282
- toolMetadata = parsed.tools;
4283
- }
4284
- } catch {}
4285
- }
4286
- }
4287
- }
4346
+ const toolMetadata = this.parseListToolsByIntegrationContent(response.content);
4288
4347
  return toConfiguredIntegrationWithToolMetadata(integration, toolMetadata);
4289
4348
  } catch (error) {
4290
4349
  logger7.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
@@ -4321,21 +4380,7 @@ class MCPClientBase {
4321
4380
  const metadataResponse = await this.callServerToolInternal("list_tools_by_integration", {
4322
4381
  integration: integration.id
4323
4382
  });
4324
- let toolMetadata = [];
4325
- if (metadataResponse.content && Array.isArray(metadataResponse.content)) {
4326
- for (const item of metadataResponse.content) {
4327
- if (item.type === "text" && item.text) {
4328
- try {
4329
- const parsed = JSON.parse(item.text);
4330
- if (Array.isArray(parsed)) {
4331
- toolMetadata = parsed;
4332
- } else if (parsed.tools && Array.isArray(parsed.tools)) {
4333
- toolMetadata = parsed.tools;
4334
- }
4335
- } catch {}
4336
- }
4337
- }
4338
- }
4383
+ const toolMetadata = this.parseListToolsByIntegrationContent(metadataResponse.content);
4339
4384
  return {
4340
4385
  ...integration,
4341
4386
  ...integrationLibraryPresentationFields(integration),
@@ -4593,6 +4638,18 @@ class MCPClientBase {
4593
4638
  }
4594
4639
  return {};
4595
4640
  }
4641
+ parseListToolsByIntegrationContent(content) {
4642
+ const tools = [];
4643
+ if (!content || !Array.isArray(content)) {
4644
+ return tools;
4645
+ }
4646
+ for (const item of content) {
4647
+ if (item.type === "text" && item.text) {
4648
+ tools.push(...parseToolsFromListByIntegrationText(item.text, this.availableTools));
4649
+ }
4650
+ }
4651
+ return tools;
4652
+ }
4596
4653
  getTool(name) {
4597
4654
  return this.availableTools.get(name);
4598
4655
  }
@@ -4637,6 +4694,11 @@ class MCPClientBase {
4637
4694
  if (this.availableTools.size > 0 && hasCompleteCache()) {
4638
4695
  return filterToTargets(this.getEnabledTools());
4639
4696
  }
4697
+ const transportHeaders = this.transport.headers || {};
4698
+ const hasApiKey = !!transportHeaders["X-API-KEY"];
4699
+ if (hasApiKey) {
4700
+ await this.ensureConnected();
4701
+ }
4640
4702
  const tools = [];
4641
4703
  const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
4642
4704
  const concurrency = options?.fetchConcurrency ?? 8;
@@ -4645,26 +4707,7 @@ class MCPClientBase {
4645
4707
  const response = await this.callServerToolInternal("list_tools_by_integration", {
4646
4708
  integration: integrationId
4647
4709
  });
4648
- const integrationTools = [];
4649
- if (response.content && Array.isArray(response.content)) {
4650
- for (const item of response.content) {
4651
- if (item.type === "text" && item.text) {
4652
- try {
4653
- const parsed = JSON.parse(item.text);
4654
- const parsedTools = Array.isArray(parsed) ? parsed : parsed.tools && Array.isArray(parsed.tools) ? parsed.tools : [];
4655
- for (const tool of parsedTools) {
4656
- if (tool.name && tool.inputSchema) {
4657
- integrationTools.push({
4658
- name: tool.name,
4659
- description: tool.description,
4660
- inputSchema: tool.inputSchema
4661
- });
4662
- }
4663
- }
4664
- } catch {}
4665
- }
4666
- }
4667
- }
4710
+ const integrationTools = this.parseListToolsByIntegrationContent(response.content).filter((tool) => tool.inputSchema);
4668
4711
  return integrationTools;
4669
4712
  } catch (error) {
4670
4713
  logger7.error(`Failed to fetch tools for integration ${integrationId}:`, error);
@@ -5291,19 +5334,19 @@ var logger107 = createLogger("Zendesk");
5291
5334
  // ../integrations/stripe.ts
5292
5335
  init_logger();
5293
5336
  var logger108 = createLogger("Stripe");
5294
- // ../integrations/gcal.ts
5337
+ // ../integrations/google_calendar.ts
5295
5338
  init_logger();
5296
5339
  var logger109 = createLogger("Google Calendar");
5297
- // ../integrations/gcontacts.ts
5340
+ // ../integrations/google_contacts.ts
5298
5341
  init_logger();
5299
5342
  var logger110 = createLogger("Google Contacts");
5300
- // ../integrations/gmeet.ts
5343
+ // ../integrations/google_meet.ts
5301
5344
  init_logger();
5302
5345
  var logger111 = createLogger("Google Meet");
5303
- // ../integrations/gtasks.ts
5346
+ // ../integrations/google_tasks.ts
5304
5347
  init_logger();
5305
5348
  var logger112 = createLogger("Google Tasks");
5306
- // ../integrations/gkeep.ts
5349
+ // ../integrations/google_keep.ts
5307
5350
  init_logger();
5308
5351
  var logger113 = createLogger("Google Keep");
5309
5352
  // ../integrations/outlook.ts
@@ -5357,16 +5400,16 @@ var logger129 = createLogger("Excel");
5357
5400
  // ../integrations/powerpoint.ts
5358
5401
  init_logger();
5359
5402
  var logger130 = createLogger("PowerPoint");
5360
- // ../integrations/gdocs.ts
5403
+ // ../integrations/google_docs.ts
5361
5404
  init_logger();
5362
5405
  var logger131 = createLogger("Google Docs");
5363
- // ../integrations/gdrive.ts
5406
+ // ../integrations/google_drive.ts
5364
5407
  init_logger();
5365
5408
  var logger132 = createLogger("Google Drive");
5366
- // ../integrations/gsheets.ts
5409
+ // ../integrations/google_sheets.ts
5367
5410
  init_logger();
5368
5411
  var logger133 = createLogger("Google Sheets");
5369
- // ../integrations/gslides.ts
5412
+ // ../integrations/google_slides.ts
5370
5413
  init_logger();
5371
5414
  var logger134 = createLogger("Google Slides");
5372
5415
  // ../integrations/polar.ts
@@ -5453,7 +5496,7 @@ var logger161 = createLogger("Xero");
5453
5496
  // ../integrations/attio.ts
5454
5497
  init_logger();
5455
5498
  var logger162 = createLogger("Attio");
5456
- // ../integrations/gchat.ts
5499
+ // ../integrations/google_chat.ts
5457
5500
  init_logger();
5458
5501
  var logger163 = createLogger("Google Chat");
5459
5502
  // ../integrations/shopify.ts
@@ -750,23 +750,23 @@ var init_library_metadata = __esm(() => {
750
750
  description: "Send, read, and search Gmail messages",
751
751
  category: "Communication"
752
752
  },
753
- gcal: {
753
+ google_calendar: {
754
754
  description: "Manage Google Calendar events and schedules",
755
755
  category: "Productivity"
756
756
  },
757
- gtasks: {
757
+ google_tasks: {
758
758
  description: "Manage Google Tasks lists and to-dos",
759
759
  category: "Productivity"
760
760
  },
761
- gkeep: {
761
+ google_keep: {
762
762
  description: "Manage Google Keep notes, attachments, and sharing permissions",
763
763
  category: "Productivity"
764
764
  },
765
- gmeet: {
765
+ google_meet: {
766
766
  description: "Create Google Meet links and manage meeting events via Calendar",
767
767
  category: "Communication"
768
768
  },
769
- gcontacts: {
769
+ google_contacts: {
770
770
  description: "List, search, create, update, and delete Google Contacts via the People API",
771
771
  category: "Communication"
772
772
  },
@@ -902,19 +902,19 @@ var init_library_metadata = __esm(() => {
902
902
  description: "Manage Todoist tasks, projects, and labels",
903
903
  category: "Productivity"
904
904
  },
905
- gslides: {
905
+ google_slides: {
906
906
  description: "Create and update Google Slides presentations",
907
907
  category: "Productivity"
908
908
  },
909
- gsheets: {
909
+ google_sheets: {
910
910
  description: "Read and update Google Sheets spreadsheets",
911
911
  category: "Productivity"
912
912
  },
913
- gdocs: {
913
+ google_docs: {
914
914
  description: "Create and edit Google Docs documents",
915
915
  category: "Productivity"
916
916
  },
917
- gdrive: {
917
+ google_drive: {
918
918
  description: "Manage Google Drive files, folders, and sharing",
919
919
  category: "Storage"
920
920
  },
@@ -1030,11 +1030,11 @@ var init_library_metadata = __esm(() => {
1030
1030
  description: "Read eToro portfolio data and market instruments",
1031
1031
  category: "Finance"
1032
1032
  },
1033
- ga4: {
1033
+ google_analytics: {
1034
1034
  description: "Read Google Analytics reports, properties, and events",
1035
1035
  category: "Analytics"
1036
1036
  },
1037
- gchat: {
1037
+ google_chat: {
1038
1038
  description: "Send messages and manage Google Chat spaces and memberships",
1039
1039
  category: "Communication"
1040
1040
  },
@@ -1406,16 +1406,16 @@ var init_email_fetcher = __esm(() => {
1406
1406
  github: fetchGitHubEmail,
1407
1407
  gmail: fetchGoogleEmail,
1408
1408
  google: fetchGoogleEmail,
1409
- gcal: fetchGoogleEmail,
1410
- gdrive: fetchGoogleEmail,
1411
- gdocs: fetchGoogleEmail,
1412
- gsheets: fetchGoogleEmail,
1413
- gslides: fetchGoogleEmail,
1414
- gcontacts: fetchGoogleEmail,
1415
- gmeet: fetchGoogleEmail,
1416
- gchat: fetchGoogleEmail,
1417
- gtasks: fetchGoogleEmail,
1418
- ga4: fetchGoogleEmail,
1409
+ google_calendar: fetchGoogleEmail,
1410
+ google_drive: fetchGoogleEmail,
1411
+ google_docs: fetchGoogleEmail,
1412
+ google_sheets: fetchGoogleEmail,
1413
+ google_slides: fetchGoogleEmail,
1414
+ google_contacts: fetchGoogleEmail,
1415
+ google_meet: fetchGoogleEmail,
1416
+ google_chat: fetchGoogleEmail,
1417
+ google_tasks: fetchGoogleEmail,
1418
+ google_analytics: fetchGoogleEmail,
1419
1419
  youtube: fetchGoogleEmail,
1420
1420
  notion: fetchNotionEmail,
1421
1421
  linear: fetchLinearEmail,