integrate-sdk 0.9.61 → 0.9.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1675,6 +1675,77 @@ function toConfiguredIntegrationWithToolMetadata(integration, toolMetadata) {
1675
1675
  };
1676
1676
  }
1677
1677
 
1678
+ // src/integrations/list-tools-by-integration.ts
1679
+ function extractToolEntries(payload) {
1680
+ if (Array.isArray(payload)) {
1681
+ return payload;
1682
+ }
1683
+ if (payload && typeof payload === "object" && "tools" in payload) {
1684
+ const tools = payload.tools;
1685
+ if (Array.isArray(tools)) {
1686
+ return tools;
1687
+ }
1688
+ }
1689
+ return [];
1690
+ }
1691
+ function toMetadataTool(entry, availableTools) {
1692
+ if (entry.inputSchema) {
1693
+ return {
1694
+ name: entry.name,
1695
+ description: entry.description,
1696
+ inputSchema: entry.inputSchema
1697
+ };
1698
+ }
1699
+ const cached = availableTools.get(entry.name);
1700
+ if (cached) {
1701
+ return cached;
1702
+ }
1703
+ return {
1704
+ name: entry.name,
1705
+ description: entry.description,
1706
+ inputSchema: {
1707
+ type: "object",
1708
+ properties: {}
1709
+ }
1710
+ };
1711
+ }
1712
+ function parseToolsFromListByIntegrationPayload(payload, availableTools) {
1713
+ const tools = [];
1714
+ for (const entry of extractToolEntries(payload)) {
1715
+ if (typeof entry === "string") {
1716
+ const cached = availableTools.get(entry);
1717
+ tools.push(cached ?? {
1718
+ name: entry,
1719
+ inputSchema: { type: "object", properties: {} }
1720
+ });
1721
+ continue;
1722
+ }
1723
+ if (!entry || typeof entry !== "object" || !("name" in entry)) {
1724
+ continue;
1725
+ }
1726
+ const candidate = entry;
1727
+ if (!candidate.name) {
1728
+ continue;
1729
+ }
1730
+ const normalized = toMetadataTool({
1731
+ name: candidate.name,
1732
+ description: candidate.description,
1733
+ inputSchema: candidate.inputSchema
1734
+ }, availableTools);
1735
+ if (normalized) {
1736
+ tools.push(normalized);
1737
+ }
1738
+ }
1739
+ return tools;
1740
+ }
1741
+ function parseToolsFromListByIntegrationText(text, availableTools) {
1742
+ try {
1743
+ return parseToolsFromListByIntegrationPayload(JSON.parse(text), availableTools);
1744
+ } catch {
1745
+ return [];
1746
+ }
1747
+ }
1748
+
1678
1749
  // src/database/token-store.ts
1679
1750
  var USABLE_ACCESS_TOKEN_BUFFER_MS = 30 * 1000;
1680
1751
  var MIN_MEANINGFUL_EXPIRY_MS = Date.UTC(2000, 0, 1);
@@ -3498,21 +3569,7 @@ class MCPClientBase {
3498
3569
  const response = await this.callServerToolInternal("list_tools_by_integration", {
3499
3570
  integration: integration.id
3500
3571
  });
3501
- let toolMetadata = [];
3502
- if (response.content && Array.isArray(response.content)) {
3503
- for (const item of response.content) {
3504
- if (item.type === "text" && item.text) {
3505
- try {
3506
- const parsed = JSON.parse(item.text);
3507
- if (Array.isArray(parsed)) {
3508
- toolMetadata = parsed;
3509
- } else if (parsed.tools && Array.isArray(parsed.tools)) {
3510
- toolMetadata = parsed.tools;
3511
- }
3512
- } catch {}
3513
- }
3514
- }
3515
- }
3572
+ const toolMetadata = this.parseListToolsByIntegrationContent(response.content);
3516
3573
  return toConfiguredIntegrationWithToolMetadata(integration, toolMetadata);
3517
3574
  } catch (error) {
3518
3575
  logger5.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
@@ -3549,21 +3606,7 @@ class MCPClientBase {
3549
3606
  const metadataResponse = await this.callServerToolInternal("list_tools_by_integration", {
3550
3607
  integration: integration.id
3551
3608
  });
3552
- let toolMetadata = [];
3553
- if (metadataResponse.content && Array.isArray(metadataResponse.content)) {
3554
- for (const item of metadataResponse.content) {
3555
- if (item.type === "text" && item.text) {
3556
- try {
3557
- const parsed = JSON.parse(item.text);
3558
- if (Array.isArray(parsed)) {
3559
- toolMetadata = parsed;
3560
- } else if (parsed.tools && Array.isArray(parsed.tools)) {
3561
- toolMetadata = parsed.tools;
3562
- }
3563
- } catch {}
3564
- }
3565
- }
3566
- }
3609
+ const toolMetadata = this.parseListToolsByIntegrationContent(metadataResponse.content);
3567
3610
  return {
3568
3611
  ...integration,
3569
3612
  ...integrationLibraryPresentationFields(integration),
@@ -3821,6 +3864,18 @@ class MCPClientBase {
3821
3864
  }
3822
3865
  return {};
3823
3866
  }
3867
+ parseListToolsByIntegrationContent(content) {
3868
+ const tools = [];
3869
+ if (!content || !Array.isArray(content)) {
3870
+ return tools;
3871
+ }
3872
+ for (const item of content) {
3873
+ if (item.type === "text" && item.text) {
3874
+ tools.push(...parseToolsFromListByIntegrationText(item.text, this.availableTools));
3875
+ }
3876
+ }
3877
+ return tools;
3878
+ }
3824
3879
  getTool(name) {
3825
3880
  return this.availableTools.get(name);
3826
3881
  }
@@ -3865,6 +3920,11 @@ class MCPClientBase {
3865
3920
  if (this.availableTools.size > 0 && hasCompleteCache()) {
3866
3921
  return filterToTargets(this.getEnabledTools());
3867
3922
  }
3923
+ const transportHeaders = this.transport.headers || {};
3924
+ const hasApiKey = !!transportHeaders["X-API-KEY"];
3925
+ if (hasApiKey) {
3926
+ await this.ensureConnected();
3927
+ }
3868
3928
  const tools = [];
3869
3929
  const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
3870
3930
  const concurrency = options?.fetchConcurrency ?? 8;
@@ -3873,26 +3933,7 @@ class MCPClientBase {
3873
3933
  const response = await this.callServerToolInternal("list_tools_by_integration", {
3874
3934
  integration: integrationId
3875
3935
  });
3876
- const integrationTools = [];
3877
- if (response.content && Array.isArray(response.content)) {
3878
- for (const item of response.content) {
3879
- if (item.type === "text" && item.text) {
3880
- try {
3881
- const parsed = JSON.parse(item.text);
3882
- const parsedTools = Array.isArray(parsed) ? parsed : parsed.tools && Array.isArray(parsed.tools) ? parsed.tools : [];
3883
- for (const tool of parsedTools) {
3884
- if (tool.name && tool.inputSchema) {
3885
- integrationTools.push({
3886
- name: tool.name,
3887
- description: tool.description,
3888
- inputSchema: tool.inputSchema
3889
- });
3890
- }
3891
- }
3892
- } catch {}
3893
- }
3894
- }
3895
- }
3936
+ const integrationTools = this.parseListToolsByIntegrationContent(response.content).filter((tool) => tool.inputSchema);
3896
3937
  return integrationTools;
3897
3938
  } catch (error) {
3898
3939
  logger5.error(`Failed to fetch tools for integration ${integrationId}:`, error);
@@ -12209,6 +12250,9 @@ function tldrawIntegration(options = {}) {
12209
12250
  return {
12210
12251
  id: "tldraw",
12211
12252
  name: "tldraw",
12253
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/tldraw.png",
12254
+ description: "Create and manage tldraw collaborative whiteboards",
12255
+ category: "Productivity",
12212
12256
  tools: [...TLDRAW_TOOLS],
12213
12257
  authType: apiKey ? "apiKey" : undefined,
12214
12258
  getHeaders: apiKey ? () => ({ Authorization: `Bearer ${apiKey}` }) : undefined
@@ -12275,6 +12319,9 @@ function granolaIntegration(options) {
12275
12319
  return {
12276
12320
  id: "granola",
12277
12321
  name: "Granola",
12322
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/granola.png",
12323
+ description: "List and read Granola meeting notes and folders",
12324
+ category: "Productivity",
12278
12325
  tools: [...GRANOLA_TOOLS],
12279
12326
  authType: "apiKey",
12280
12327
  getHeaders() {
@@ -12357,6 +12404,9 @@ function mercuryIntegration(options) {
12357
12404
  return {
12358
12405
  id: "mercury",
12359
12406
  name: "Mercury",
12407
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/mercury.png",
12408
+ description: "Manage Mercury bank accounts, cards, and transactions",
12409
+ category: "Finance",
12360
12410
  tools: [...MERCURY_TOOLS],
12361
12411
  authType: "apiKey",
12362
12412
  getHeaders() {
@@ -13225,6 +13275,9 @@ function resendIntegration(options = {}) {
13225
13275
  return {
13226
13276
  id: "resend",
13227
13277
  name: "Resend",
13278
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/resend.png",
13279
+ description: "Send email and manage domains with the Resend API",
13280
+ category: "Communication",
13228
13281
  tools: [...RESEND_TOOLS],
13229
13282
  authType: "apiKey",
13230
13283
  getHeaders() {
@@ -1675,6 +1675,77 @@ function toConfiguredIntegrationWithToolMetadata(integration, toolMetadata) {
1675
1675
  };
1676
1676
  }
1677
1677
 
1678
+ // src/integrations/list-tools-by-integration.ts
1679
+ function extractToolEntries(payload) {
1680
+ if (Array.isArray(payload)) {
1681
+ return payload;
1682
+ }
1683
+ if (payload && typeof payload === "object" && "tools" in payload) {
1684
+ const tools = payload.tools;
1685
+ if (Array.isArray(tools)) {
1686
+ return tools;
1687
+ }
1688
+ }
1689
+ return [];
1690
+ }
1691
+ function toMetadataTool(entry, availableTools) {
1692
+ if (entry.inputSchema) {
1693
+ return {
1694
+ name: entry.name,
1695
+ description: entry.description,
1696
+ inputSchema: entry.inputSchema
1697
+ };
1698
+ }
1699
+ const cached = availableTools.get(entry.name);
1700
+ if (cached) {
1701
+ return cached;
1702
+ }
1703
+ return {
1704
+ name: entry.name,
1705
+ description: entry.description,
1706
+ inputSchema: {
1707
+ type: "object",
1708
+ properties: {}
1709
+ }
1710
+ };
1711
+ }
1712
+ function parseToolsFromListByIntegrationPayload(payload, availableTools) {
1713
+ const tools = [];
1714
+ for (const entry of extractToolEntries(payload)) {
1715
+ if (typeof entry === "string") {
1716
+ const cached = availableTools.get(entry);
1717
+ tools.push(cached ?? {
1718
+ name: entry,
1719
+ inputSchema: { type: "object", properties: {} }
1720
+ });
1721
+ continue;
1722
+ }
1723
+ if (!entry || typeof entry !== "object" || !("name" in entry)) {
1724
+ continue;
1725
+ }
1726
+ const candidate = entry;
1727
+ if (!candidate.name) {
1728
+ continue;
1729
+ }
1730
+ const normalized = toMetadataTool({
1731
+ name: candidate.name,
1732
+ description: candidate.description,
1733
+ inputSchema: candidate.inputSchema
1734
+ }, availableTools);
1735
+ if (normalized) {
1736
+ tools.push(normalized);
1737
+ }
1738
+ }
1739
+ return tools;
1740
+ }
1741
+ function parseToolsFromListByIntegrationText(text, availableTools) {
1742
+ try {
1743
+ return parseToolsFromListByIntegrationPayload(JSON.parse(text), availableTools);
1744
+ } catch {
1745
+ return [];
1746
+ }
1747
+ }
1748
+
1678
1749
  // src/database/token-store.ts
1679
1750
  var USABLE_ACCESS_TOKEN_BUFFER_MS = 30 * 1000;
1680
1751
  var MIN_MEANINGFUL_EXPIRY_MS = Date.UTC(2000, 0, 1);
@@ -3498,21 +3569,7 @@ class MCPClientBase {
3498
3569
  const response = await this.callServerToolInternal("list_tools_by_integration", {
3499
3570
  integration: integration.id
3500
3571
  });
3501
- let toolMetadata = [];
3502
- if (response.content && Array.isArray(response.content)) {
3503
- for (const item of response.content) {
3504
- if (item.type === "text" && item.text) {
3505
- try {
3506
- const parsed = JSON.parse(item.text);
3507
- if (Array.isArray(parsed)) {
3508
- toolMetadata = parsed;
3509
- } else if (parsed.tools && Array.isArray(parsed.tools)) {
3510
- toolMetadata = parsed.tools;
3511
- }
3512
- } catch {}
3513
- }
3514
- }
3515
- }
3572
+ const toolMetadata = this.parseListToolsByIntegrationContent(response.content);
3516
3573
  return toConfiguredIntegrationWithToolMetadata(integration, toolMetadata);
3517
3574
  } catch (error) {
3518
3575
  logger5.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
@@ -3549,21 +3606,7 @@ class MCPClientBase {
3549
3606
  const metadataResponse = await this.callServerToolInternal("list_tools_by_integration", {
3550
3607
  integration: integration.id
3551
3608
  });
3552
- let toolMetadata = [];
3553
- if (metadataResponse.content && Array.isArray(metadataResponse.content)) {
3554
- for (const item of metadataResponse.content) {
3555
- if (item.type === "text" && item.text) {
3556
- try {
3557
- const parsed = JSON.parse(item.text);
3558
- if (Array.isArray(parsed)) {
3559
- toolMetadata = parsed;
3560
- } else if (parsed.tools && Array.isArray(parsed.tools)) {
3561
- toolMetadata = parsed.tools;
3562
- }
3563
- } catch {}
3564
- }
3565
- }
3566
- }
3609
+ const toolMetadata = this.parseListToolsByIntegrationContent(metadataResponse.content);
3567
3610
  return {
3568
3611
  ...integration,
3569
3612
  ...integrationLibraryPresentationFields(integration),
@@ -3821,6 +3864,18 @@ class MCPClientBase {
3821
3864
  }
3822
3865
  return {};
3823
3866
  }
3867
+ parseListToolsByIntegrationContent(content) {
3868
+ const tools = [];
3869
+ if (!content || !Array.isArray(content)) {
3870
+ return tools;
3871
+ }
3872
+ for (const item of content) {
3873
+ if (item.type === "text" && item.text) {
3874
+ tools.push(...parseToolsFromListByIntegrationText(item.text, this.availableTools));
3875
+ }
3876
+ }
3877
+ return tools;
3878
+ }
3824
3879
  getTool(name) {
3825
3880
  return this.availableTools.get(name);
3826
3881
  }
@@ -3865,6 +3920,11 @@ class MCPClientBase {
3865
3920
  if (this.availableTools.size > 0 && hasCompleteCache()) {
3866
3921
  return filterToTargets(this.getEnabledTools());
3867
3922
  }
3923
+ const transportHeaders = this.transport.headers || {};
3924
+ const hasApiKey = !!transportHeaders["X-API-KEY"];
3925
+ if (hasApiKey) {
3926
+ await this.ensureConnected();
3927
+ }
3868
3928
  const tools = [];
3869
3929
  const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
3870
3930
  const concurrency = options?.fetchConcurrency ?? 8;
@@ -3873,26 +3933,7 @@ class MCPClientBase {
3873
3933
  const response = await this.callServerToolInternal("list_tools_by_integration", {
3874
3934
  integration: integrationId
3875
3935
  });
3876
- const integrationTools = [];
3877
- if (response.content && Array.isArray(response.content)) {
3878
- for (const item of response.content) {
3879
- if (item.type === "text" && item.text) {
3880
- try {
3881
- const parsed = JSON.parse(item.text);
3882
- const parsedTools = Array.isArray(parsed) ? parsed : parsed.tools && Array.isArray(parsed.tools) ? parsed.tools : [];
3883
- for (const tool of parsedTools) {
3884
- if (tool.name && tool.inputSchema) {
3885
- integrationTools.push({
3886
- name: tool.name,
3887
- description: tool.description,
3888
- inputSchema: tool.inputSchema
3889
- });
3890
- }
3891
- }
3892
- } catch {}
3893
- }
3894
- }
3895
- }
3936
+ const integrationTools = this.parseListToolsByIntegrationContent(response.content).filter((tool) => tool.inputSchema);
3896
3937
  return integrationTools;
3897
3938
  } catch (error) {
3898
3939
  logger5.error(`Failed to fetch tools for integration ${integrationId}:`, error);
@@ -12209,6 +12250,9 @@ function tldrawIntegration(options = {}) {
12209
12250
  return {
12210
12251
  id: "tldraw",
12211
12252
  name: "tldraw",
12253
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/tldraw.png",
12254
+ description: "Create and manage tldraw collaborative whiteboards",
12255
+ category: "Productivity",
12212
12256
  tools: [...TLDRAW_TOOLS],
12213
12257
  authType: apiKey ? "apiKey" : undefined,
12214
12258
  getHeaders: apiKey ? () => ({ Authorization: `Bearer ${apiKey}` }) : undefined
@@ -12275,6 +12319,9 @@ function granolaIntegration(options) {
12275
12319
  return {
12276
12320
  id: "granola",
12277
12321
  name: "Granola",
12322
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/granola.png",
12323
+ description: "List and read Granola meeting notes and folders",
12324
+ category: "Productivity",
12278
12325
  tools: [...GRANOLA_TOOLS],
12279
12326
  authType: "apiKey",
12280
12327
  getHeaders() {
@@ -12357,6 +12404,9 @@ function mercuryIntegration(options) {
12357
12404
  return {
12358
12405
  id: "mercury",
12359
12406
  name: "Mercury",
12407
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/mercury.png",
12408
+ description: "Manage Mercury bank accounts, cards, and transactions",
12409
+ category: "Finance",
12360
12410
  tools: [...MERCURY_TOOLS],
12361
12411
  authType: "apiKey",
12362
12412
  getHeaders() {
@@ -13225,6 +13275,9 @@ function resendIntegration(options = {}) {
13225
13275
  return {
13226
13276
  id: "resend",
13227
13277
  name: "Resend",
13278
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/resend.png",
13279
+ description: "Send email and manage domains with the Resend API",
13280
+ category: "Communication",
13228
13281
  tools: [...RESEND_TOOLS],
13229
13282
  authType: "apiKey",
13230
13283
  getHeaders() {
package/dist/server.js CHANGED
@@ -3448,6 +3448,79 @@ class HttpSessionTransport {
3448
3448
 
3449
3449
  // src/client.ts
3450
3450
  init_integration_summary();
3451
+
3452
+ // src/integrations/list-tools-by-integration.ts
3453
+ function extractToolEntries(payload) {
3454
+ if (Array.isArray(payload)) {
3455
+ return payload;
3456
+ }
3457
+ if (payload && typeof payload === "object" && "tools" in payload) {
3458
+ const tools = payload.tools;
3459
+ if (Array.isArray(tools)) {
3460
+ return tools;
3461
+ }
3462
+ }
3463
+ return [];
3464
+ }
3465
+ function toMetadataTool(entry, availableTools) {
3466
+ if (entry.inputSchema) {
3467
+ return {
3468
+ name: entry.name,
3469
+ description: entry.description,
3470
+ inputSchema: entry.inputSchema
3471
+ };
3472
+ }
3473
+ const cached = availableTools.get(entry.name);
3474
+ if (cached) {
3475
+ return cached;
3476
+ }
3477
+ return {
3478
+ name: entry.name,
3479
+ description: entry.description,
3480
+ inputSchema: {
3481
+ type: "object",
3482
+ properties: {}
3483
+ }
3484
+ };
3485
+ }
3486
+ function parseToolsFromListByIntegrationPayload(payload, availableTools) {
3487
+ const tools = [];
3488
+ for (const entry of extractToolEntries(payload)) {
3489
+ if (typeof entry === "string") {
3490
+ const cached = availableTools.get(entry);
3491
+ tools.push(cached ?? {
3492
+ name: entry,
3493
+ inputSchema: { type: "object", properties: {} }
3494
+ });
3495
+ continue;
3496
+ }
3497
+ if (!entry || typeof entry !== "object" || !("name" in entry)) {
3498
+ continue;
3499
+ }
3500
+ const candidate = entry;
3501
+ if (!candidate.name) {
3502
+ continue;
3503
+ }
3504
+ const normalized = toMetadataTool({
3505
+ name: candidate.name,
3506
+ description: candidate.description,
3507
+ inputSchema: candidate.inputSchema
3508
+ }, availableTools);
3509
+ if (normalized) {
3510
+ tools.push(normalized);
3511
+ }
3512
+ }
3513
+ return tools;
3514
+ }
3515
+ function parseToolsFromListByIntegrationText(text, availableTools) {
3516
+ try {
3517
+ return parseToolsFromListByIntegrationPayload(JSON.parse(text), availableTools);
3518
+ } catch {
3519
+ return [];
3520
+ }
3521
+ }
3522
+
3523
+ // src/client.ts
3451
3524
  init_library_metadata();
3452
3525
 
3453
3526
  // src/database/token-store.ts
@@ -5132,21 +5205,7 @@ class MCPClientBase {
5132
5205
  const response = await this.callServerToolInternal("list_tools_by_integration", {
5133
5206
  integration: integration.id
5134
5207
  });
5135
- let toolMetadata = [];
5136
- if (response.content && Array.isArray(response.content)) {
5137
- for (const item of response.content) {
5138
- if (item.type === "text" && item.text) {
5139
- try {
5140
- const parsed = JSON.parse(item.text);
5141
- if (Array.isArray(parsed)) {
5142
- toolMetadata = parsed;
5143
- } else if (parsed.tools && Array.isArray(parsed.tools)) {
5144
- toolMetadata = parsed.tools;
5145
- }
5146
- } catch {}
5147
- }
5148
- }
5149
- }
5208
+ const toolMetadata = this.parseListToolsByIntegrationContent(response.content);
5150
5209
  return toConfiguredIntegrationWithToolMetadata(integration, toolMetadata);
5151
5210
  } catch (error) {
5152
5211
  logger5.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
@@ -5183,21 +5242,7 @@ class MCPClientBase {
5183
5242
  const metadataResponse = await this.callServerToolInternal("list_tools_by_integration", {
5184
5243
  integration: integration.id
5185
5244
  });
5186
- let toolMetadata = [];
5187
- if (metadataResponse.content && Array.isArray(metadataResponse.content)) {
5188
- for (const item of metadataResponse.content) {
5189
- if (item.type === "text" && item.text) {
5190
- try {
5191
- const parsed = JSON.parse(item.text);
5192
- if (Array.isArray(parsed)) {
5193
- toolMetadata = parsed;
5194
- } else if (parsed.tools && Array.isArray(parsed.tools)) {
5195
- toolMetadata = parsed.tools;
5196
- }
5197
- } catch {}
5198
- }
5199
- }
5200
- }
5245
+ const toolMetadata = this.parseListToolsByIntegrationContent(metadataResponse.content);
5201
5246
  return {
5202
5247
  ...integration,
5203
5248
  ...integrationLibraryPresentationFields(integration),
@@ -5455,6 +5500,18 @@ class MCPClientBase {
5455
5500
  }
5456
5501
  return {};
5457
5502
  }
5503
+ parseListToolsByIntegrationContent(content) {
5504
+ const tools = [];
5505
+ if (!content || !Array.isArray(content)) {
5506
+ return tools;
5507
+ }
5508
+ for (const item of content) {
5509
+ if (item.type === "text" && item.text) {
5510
+ tools.push(...parseToolsFromListByIntegrationText(item.text, this.availableTools));
5511
+ }
5512
+ }
5513
+ return tools;
5514
+ }
5458
5515
  getTool(name) {
5459
5516
  return this.availableTools.get(name);
5460
5517
  }
@@ -5499,6 +5556,11 @@ class MCPClientBase {
5499
5556
  if (this.availableTools.size > 0 && hasCompleteCache()) {
5500
5557
  return filterToTargets(this.getEnabledTools());
5501
5558
  }
5559
+ const transportHeaders = this.transport.headers || {};
5560
+ const hasApiKey = !!transportHeaders["X-API-KEY"];
5561
+ if (hasApiKey) {
5562
+ await this.ensureConnected();
5563
+ }
5502
5564
  const tools = [];
5503
5565
  const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
5504
5566
  const concurrency = options?.fetchConcurrency ?? 8;
@@ -5507,26 +5569,7 @@ class MCPClientBase {
5507
5569
  const response = await this.callServerToolInternal("list_tools_by_integration", {
5508
5570
  integration: integrationId
5509
5571
  });
5510
- const integrationTools = [];
5511
- if (response.content && Array.isArray(response.content)) {
5512
- for (const item of response.content) {
5513
- if (item.type === "text" && item.text) {
5514
- try {
5515
- const parsed = JSON.parse(item.text);
5516
- const parsedTools = Array.isArray(parsed) ? parsed : parsed.tools && Array.isArray(parsed.tools) ? parsed.tools : [];
5517
- for (const tool of parsedTools) {
5518
- if (tool.name && tool.inputSchema) {
5519
- integrationTools.push({
5520
- name: tool.name,
5521
- description: tool.description,
5522
- inputSchema: tool.inputSchema
5523
- });
5524
- }
5525
- }
5526
- } catch {}
5527
- }
5528
- }
5529
- }
5572
+ const integrationTools = this.parseListToolsByIntegrationContent(response.content).filter((tool) => tool.inputSchema);
5530
5573
  return integrationTools;
5531
5574
  } catch (error) {
5532
5575
  logger5.error(`Failed to fetch tools for integration ${integrationId}:`, error);
@@ -13724,6 +13767,9 @@ function granolaIntegration(options) {
13724
13767
  return {
13725
13768
  id: "granola",
13726
13769
  name: "Granola",
13770
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/granola.png",
13771
+ description: "List and read Granola meeting notes and folders",
13772
+ category: "Productivity",
13727
13773
  tools: [...GRANOLA_TOOLS],
13728
13774
  authType: "apiKey",
13729
13775
  getHeaders() {
@@ -13806,6 +13852,9 @@ function mercuryIntegration(options) {
13806
13852
  return {
13807
13853
  id: "mercury",
13808
13854
  name: "Mercury",
13855
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/mercury.png",
13856
+ description: "Manage Mercury bank accounts, cards, and transactions",
13857
+ category: "Finance",
13809
13858
  tools: [...MERCURY_TOOLS],
13810
13859
  authType: "apiKey",
13811
13860
  getHeaders() {
@@ -14417,6 +14466,9 @@ function resendIntegration(options = {}) {
14417
14466
  return {
14418
14467
  id: "resend",
14419
14468
  name: "Resend",
14469
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/resend.png",
14470
+ description: "Send email and manage domains with the Resend API",
14471
+ category: "Communication",
14420
14472
  tools: [...RESEND_TOOLS],
14421
14473
  authType: "apiKey",
14422
14474
  getHeaders() {
@@ -14443,6 +14495,9 @@ function tldrawIntegration(options = {}) {
14443
14495
  return {
14444
14496
  id: "tldraw",
14445
14497
  name: "tldraw",
14498
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/tldraw.png",
14499
+ description: "Create and manage tldraw collaborative whiteboards",
14500
+ category: "Productivity",
14446
14501
  tools: [...TLDRAW_TOOLS],
14447
14502
  authType: apiKey ? "apiKey" : undefined,
14448
14503
  getHeaders: apiKey ? () => ({ Authorization: `Bearer ${apiKey}` }) : undefined
@@ -561,6 +561,7 @@ export declare class MCPClientBase<TIntegrations extends readonly MCPIntegration
561
561
  * Get static integration headers for a given tool.
562
562
  */
563
563
  private getHeadersForTool;
564
+ private parseListToolsByIntegrationContent;
564
565
  /**
565
566
  * Get a tool by name
566
567
  */