@mastra/connect 1.0.0 → 1.0.1-alpha.1

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
@@ -5478,7 +5478,7 @@ const listGuildMembersInputSchema = z.object({
5478
5478
  limit: z.number().min(1).max(1e3).optional().describe("Max number of members to return (1-1000)."),
5479
5479
  after: z.string().optional().describe("The highest user id in the previous page. Omit for the first page.")
5480
5480
  });
5481
- const ProviderUserSchema$22 = z.object({
5481
+ const ProviderUserSchema$23 = z.object({
5482
5482
  id: z.string(),
5483
5483
  username: z.string(),
5484
5484
  discriminator: z.string(),
@@ -5487,8 +5487,8 @@ const ProviderUserSchema$22 = z.object({
5487
5487
  bot: z.boolean().optional(),
5488
5488
  system: z.boolean().optional()
5489
5489
  });
5490
- const ProviderGuildMemberSchema = z.object({
5491
- user: ProviderUserSchema$22.optional(),
5490
+ const ProviderGuildMemberSchema$1 = z.object({
5491
+ user: ProviderUserSchema$23.optional(),
5492
5492
  nick: z.string().nullable().optional(),
5493
5493
  avatar: z.string().nullable().optional(),
5494
5494
  banner: z.string().nullable().optional(),
@@ -5504,7 +5504,7 @@ const ProviderGuildMemberSchema = z.object({
5504
5504
  avatar_decoration_data: z.unknown().nullable().optional(),
5505
5505
  collectibles: z.unknown().nullable().optional()
5506
5506
  });
5507
- const OutputMemberSchema = z.object({
5507
+ const OutputMemberSchema$1 = z.object({
5508
5508
  user: z.object({
5509
5509
  id: z.string(),
5510
5510
  username: z.string(),
@@ -5528,7 +5528,7 @@ const OutputMemberSchema = z.object({
5528
5528
  communication_disabled_until: z.string().optional()
5529
5529
  });
5530
5530
  const listGuildMembersOutputSchema = z.object({
5531
- items: z.array(OutputMemberSchema),
5531
+ items: z.array(OutputMemberSchema$1),
5532
5532
  next_after: z.string().optional()
5533
5533
  });
5534
5534
  function listGuildMembersTool(proxy) {
@@ -5554,7 +5554,7 @@ function listGuildMembersTool(proxy) {
5554
5554
  const items = [];
5555
5555
  let lastUserId;
5556
5556
  for (const rawMember of rawMembers) {
5557
- const providerMember = ProviderGuildMemberSchema.parse(rawMember);
5557
+ const providerMember = ProviderGuildMemberSchema$1.parse(rawMember);
5558
5558
  const user = providerMember.user ? {
5559
5559
  id: providerMember.user.id,
5560
5560
  username: providerMember.user.username,
@@ -5973,6 +5973,109 @@ function removeGuildMemberRoleTool(proxy) {
5973
5973
  });
5974
5974
  }
5975
5975
  //#endregion
5976
+ //#region src/providers/discord/tools/search-members.ts
5977
+ const searchMembersInputSchema = z.object({
5978
+ guild_id: z.string().describe("Guild ID. Example: \"197038439483310086\""),
5979
+ query: z.string().min(1).describe("Username or nickname prefix to search for."),
5980
+ limit: z.number().int().min(1).max(1e3).optional().describe("Max number of members to return (1-1000). Default: 25.")
5981
+ });
5982
+ const ProviderUserSchema$22 = z.object({
5983
+ id: z.string(),
5984
+ username: z.string(),
5985
+ discriminator: z.string(),
5986
+ global_name: z.string().nullable().optional(),
5987
+ avatar: z.string().nullable().optional(),
5988
+ bot: z.boolean().optional(),
5989
+ system: z.boolean().optional()
5990
+ });
5991
+ const ProviderGuildMemberSchema = z.object({
5992
+ user: ProviderUserSchema$22.optional(),
5993
+ nick: z.string().nullable().optional(),
5994
+ avatar: z.string().nullable().optional(),
5995
+ roles: z.array(z.string()),
5996
+ joined_at: z.string().nullable(),
5997
+ premium_since: z.string().nullable().optional(),
5998
+ deaf: z.boolean(),
5999
+ mute: z.boolean(),
6000
+ flags: z.number(),
6001
+ pending: z.boolean().optional(),
6002
+ permissions: z.string().optional(),
6003
+ communication_disabled_until: z.string().nullable().optional()
6004
+ });
6005
+ const OutputMemberSchema = z.object({
6006
+ user: z.object({
6007
+ id: z.string(),
6008
+ username: z.string(),
6009
+ discriminator: z.string(),
6010
+ global_name: z.string().optional(),
6011
+ avatar: z.string().optional(),
6012
+ bot: z.boolean().optional(),
6013
+ system: z.boolean().optional()
6014
+ }).optional(),
6015
+ nick: z.string().optional(),
6016
+ avatar: z.string().optional(),
6017
+ roles: z.array(z.string()),
6018
+ joined_at: z.string().optional(),
6019
+ premium_since: z.string().optional(),
6020
+ deaf: z.boolean(),
6021
+ mute: z.boolean(),
6022
+ flags: z.number(),
6023
+ pending: z.boolean().optional(),
6024
+ permissions: z.string().optional(),
6025
+ communication_disabled_until: z.string().optional()
6026
+ });
6027
+ const searchMembersOutputSchema = z.object({ items: z.array(OutputMemberSchema) });
6028
+ function searchMembersTool(proxy) {
6029
+ return createTool({
6030
+ id: "discord_search_members",
6031
+ description: "Search guild members whose username or nickname starts with the query, instead of paging the full member list.",
6032
+ inputSchema: searchMembersInputSchema,
6033
+ outputSchema: searchMembersOutputSchema,
6034
+ execute: async (input, { requestContext }) => {
6035
+ const platformProxy = proxy.withRequestContext(requestContext);
6036
+ const botToken = await resolveDiscordBotToken(platformProxy);
6037
+ const response = await platformProxy.get({
6038
+ endpoint: `/api/v10/guilds/${input.guild_id}/members/search`,
6039
+ params: {
6040
+ query: input.query,
6041
+ limit: String(input.limit ?? 25)
6042
+ },
6043
+ headers: { Authorization: `Bot ${botToken}` },
6044
+ retries: 3
6045
+ });
6046
+ const rawMembers = z.array(z.unknown()).parse(response.data);
6047
+ const items = [];
6048
+ for (const rawMember of rawMembers) {
6049
+ const providerMember = ProviderGuildMemberSchema.parse(rawMember);
6050
+ const user = providerMember.user ? {
6051
+ id: providerMember.user.id,
6052
+ username: providerMember.user.username,
6053
+ discriminator: providerMember.user.discriminator,
6054
+ ...providerMember.user.global_name != null && { global_name: providerMember.user.global_name },
6055
+ ...providerMember.user.avatar != null && { avatar: providerMember.user.avatar },
6056
+ ...providerMember.user.bot !== void 0 && { bot: providerMember.user.bot },
6057
+ ...providerMember.user.system !== void 0 && { system: providerMember.user.system }
6058
+ } : void 0;
6059
+ items.push({
6060
+ ...user !== void 0 && { user },
6061
+ ...providerMember.nick != null && { nick: providerMember.nick },
6062
+ ...providerMember.avatar != null && { avatar: providerMember.avatar },
6063
+ roles: providerMember.roles,
6064
+ ...providerMember.joined_at != null && { joined_at: providerMember.joined_at },
6065
+ ...providerMember.premium_since != null && { premium_since: providerMember.premium_since },
6066
+ deaf: providerMember.deaf,
6067
+ mute: providerMember.mute,
6068
+ flags: providerMember.flags,
6069
+ ...providerMember.pending !== void 0 && { pending: providerMember.pending },
6070
+ ...providerMember.permissions !== void 0 && { permissions: providerMember.permissions },
6071
+ ...providerMember.communication_disabled_until != null && { communication_disabled_until: providerMember.communication_disabled_until }
6072
+ });
6073
+ }
6074
+ return { items };
6075
+ }
6076
+ });
6077
+ }
6078
+ //#endregion
5976
6079
  //#region src/providers/discord/tools/update-channel.ts
5977
6080
  const updateChannelInputSchema$1 = z.object({
5978
6081
  channel_id: z.string().describe("The ID of the channel to update. Example: \"1504364254634180618\""),
@@ -6655,6 +6758,7 @@ function createDiscordTools(options) {
6655
6758
  discord_list_roles: listRolesTool$1(platformProxy),
6656
6759
  discord_list_webhooks: listWebhooksTool$1(platformProxy),
6657
6760
  discord_remove_guild_member_role: removeGuildMemberRoleTool(platformProxy),
6761
+ discord_search_members: searchMembersTool(platformProxy),
6658
6762
  discord_update_channel: updateChannelTool$1(platformProxy),
6659
6763
  discord_update_guild_member: updateGuildMemberTool(platformProxy),
6660
6764
  discord_update_guild: updateGuildTool(platformProxy),
@@ -8338,13 +8442,13 @@ const ProviderContactSchema = z.object({
8338
8442
  picture: z.string().nullable(),
8339
8443
  last_meeting_date: z.string().nullable()
8340
8444
  });
8341
- const ContactSchema$1 = z.object({
8445
+ const ContactSchema$2 = z.object({
8342
8446
  email: z.string(),
8343
8447
  name: z.string().optional(),
8344
8448
  picture: z.string().optional(),
8345
8449
  last_meeting_date: z.string().optional()
8346
8450
  });
8347
- const listContactsOutputSchema$2 = z.object({ contacts: z.array(ContactSchema$1) });
8451
+ const listContactsOutputSchema$2 = z.object({ contacts: z.array(ContactSchema$2) });
8348
8452
  function listContactsTool$2(proxy) {
8349
8453
  return createTool({
8350
8454
  id: "fireflies_list_contacts",
@@ -12763,6 +12867,229 @@ function rerunWorkflowRunTool(proxy) {
12763
12867
  });
12764
12868
  }
12765
12869
  //#endregion
12870
+ //#region src/providers/github/tools/search-code.ts
12871
+ const searchCodeInputSchema = z.object({
12872
+ q: z.string().min(1).describe("GitHub code search query. Must include at least one qualifier such as repo:owner/name, org:name, or user:name. Example: \"createTool repo:mastra-ai/mastra language:typescript\"."),
12873
+ per_page: z.number().int().min(1).max(100).optional().describe("The number of results per page (max 100)."),
12874
+ cursor: z.string().regex(/^[1-9]\d*$/, "Cursor must be a positive page number.").refine((value) => Number.isSafeInteger(Number.parseInt(value, 10)), "Cursor must be a positive page number.").optional().describe("Pagination cursor (page number). Omit for the first page.")
12875
+ });
12876
+ const SearchCodeItemSchema = z.object({
12877
+ name: z.string(),
12878
+ path: z.string(),
12879
+ sha: z.string(),
12880
+ html_url: z.string(),
12881
+ repository_full_name: z.string().optional()
12882
+ });
12883
+ const searchCodeOutputSchema = z.object({
12884
+ total_count: z.number(),
12885
+ incomplete_results: z.boolean(),
12886
+ items: z.array(SearchCodeItemSchema),
12887
+ next_cursor: z.string().optional()
12888
+ });
12889
+ function searchCodeTool(proxy) {
12890
+ return createTool({
12891
+ id: "github_search_code",
12892
+ description: "Search file contents across GitHub repositories. The query must be scoped with a repo:, org:, or user: qualifier.",
12893
+ inputSchema: searchCodeInputSchema,
12894
+ outputSchema: searchCodeOutputSchema,
12895
+ execute: async (input, { requestContext }) => {
12896
+ const platformProxy = proxy.withRequestContext(requestContext);
12897
+ const page = input.cursor ? Number.parseInt(input.cursor, 10) : 1;
12898
+ const perPage = input.per_page ?? 30;
12899
+ const data = (await platformProxy.get({
12900
+ endpoint: "search/code",
12901
+ params: {
12902
+ q: input.q,
12903
+ per_page: perPage,
12904
+ page
12905
+ },
12906
+ retries: 3
12907
+ })).data;
12908
+ const items = (data.items || []).map((item) => ({
12909
+ name: item.name,
12910
+ path: item.path,
12911
+ sha: item.sha,
12912
+ html_url: item.html_url,
12913
+ repository_full_name: item.repository?.full_name ?? void 0
12914
+ }));
12915
+ const reachableResults = Math.min(data.total_count ?? 0, 1e3);
12916
+ const hasMore = page * perPage < reachableResults && items.length === perPage;
12917
+ return {
12918
+ total_count: data.total_count ?? 0,
12919
+ incomplete_results: data.incomplete_results ?? false,
12920
+ items,
12921
+ ...hasMore && { next_cursor: String(page + 1) }
12922
+ };
12923
+ }
12924
+ });
12925
+ }
12926
+ //#endregion
12927
+ //#region src/providers/github/tools/search-issues.ts
12928
+ const searchIssuesInputSchema$2 = z.object({
12929
+ q: z.string().min(1).describe("GitHub search query. Supports qualifiers like repo:owner/name, is:issue, is:pr, is:open, label:bug, author:user. Example: \"repo:mastra-ai/mastra is:issue is:open label:bug\"."),
12930
+ sort: z.enum([
12931
+ "comments",
12932
+ "reactions",
12933
+ "created",
12934
+ "updated"
12935
+ ]).optional().describe("What to sort results by. Default: best match."),
12936
+ order: z.enum(["asc", "desc"]).optional().describe("The direction to sort the results by. Default: desc."),
12937
+ per_page: z.number().int().min(1).max(100).optional().describe("The number of results per page (max 100)."),
12938
+ cursor: z.string().regex(/^[1-9]\d*$/, "Cursor must be a positive page number.").refine((value) => Number.isSafeInteger(Number.parseInt(value, 10)), "Cursor must be a positive page number.").optional().describe("Pagination cursor (page number). Omit for the first page.")
12939
+ });
12940
+ const SearchIssueSchema = z.object({
12941
+ id: z.number(),
12942
+ number: z.number(),
12943
+ title: z.string(),
12944
+ state: z.string(),
12945
+ html_url: z.string(),
12946
+ repository_url: z.string(),
12947
+ user_login: z.string().optional(),
12948
+ labels: z.array(z.string()),
12949
+ is_pull_request: z.boolean(),
12950
+ comments: z.number(),
12951
+ created_at: z.string(),
12952
+ updated_at: z.string()
12953
+ });
12954
+ const searchIssuesOutputSchema$2 = z.object({
12955
+ total_count: z.number(),
12956
+ incomplete_results: z.boolean(),
12957
+ items: z.array(SearchIssueSchema),
12958
+ next_cursor: z.string().optional()
12959
+ });
12960
+ function searchIssuesTool$2(proxy) {
12961
+ return createTool({
12962
+ id: "github_search_issues",
12963
+ description: "Search issues and pull requests across GitHub with the search API instead of paging repository listings. Supports the full GitHub search query syntax.",
12964
+ inputSchema: searchIssuesInputSchema$2,
12965
+ outputSchema: searchIssuesOutputSchema$2,
12966
+ execute: async (input, { requestContext }) => {
12967
+ const platformProxy = proxy.withRequestContext(requestContext);
12968
+ const page = input.cursor ? Number.parseInt(input.cursor, 10) : 1;
12969
+ const perPage = input.per_page ?? 30;
12970
+ const data = (await platformProxy.get({
12971
+ endpoint: "search/issues",
12972
+ params: {
12973
+ q: input.q,
12974
+ ...input.sort !== void 0 && { sort: input.sort },
12975
+ ...input.order !== void 0 && { order: input.order },
12976
+ per_page: perPage,
12977
+ page
12978
+ },
12979
+ retries: 3
12980
+ })).data;
12981
+ const items = (data.items || []).map((item) => ({
12982
+ id: item.id,
12983
+ number: item.number,
12984
+ title: item.title,
12985
+ state: item.state,
12986
+ html_url: item.html_url,
12987
+ repository_url: item.repository_url,
12988
+ user_login: item.user?.login ?? void 0,
12989
+ labels: (item.labels || []).map((label) => typeof label === "string" ? label : label.name || ""),
12990
+ is_pull_request: item.pull_request !== void 0,
12991
+ comments: item.comments ?? 0,
12992
+ created_at: item.created_at,
12993
+ updated_at: item.updated_at
12994
+ }));
12995
+ const reachableResults = Math.min(data.total_count ?? 0, 1e3);
12996
+ const hasMore = page * perPage < reachableResults && items.length === perPage;
12997
+ return {
12998
+ total_count: data.total_count ?? 0,
12999
+ incomplete_results: data.incomplete_results ?? false,
13000
+ items,
13001
+ ...hasMore && { next_cursor: String(page + 1) }
13002
+ };
13003
+ }
13004
+ });
13005
+ }
13006
+ //#endregion
13007
+ //#region src/providers/github/tools/search-repositories.ts
13008
+ const searchRepositoriesInputSchema = z.object({
13009
+ q: z.string().min(1).describe("GitHub search query. Supports qualifiers like org:mastra-ai, user:someone, language:typescript, topic:ai. Example: \"org:mastra-ai mastra in:name\"."),
13010
+ sort: z.enum([
13011
+ "stars",
13012
+ "forks",
13013
+ "help-wanted-issues",
13014
+ "updated"
13015
+ ]).optional().describe("What to sort results by. Default: best match."),
13016
+ order: z.enum(["asc", "desc"]).optional().describe("The direction to sort the results by. Default: desc."),
13017
+ per_page: z.number().int().min(1).max(100).optional().describe("The number of results per page (max 100)."),
13018
+ cursor: z.string().regex(/^[1-9]\d*$/, "Cursor must be a positive page number.").refine((value) => Number.isSafeInteger(Number.parseInt(value, 10)), "Cursor must be a positive page number.").optional().describe("Pagination cursor (page number). Omit for the first page.")
13019
+ });
13020
+ const SearchRepositorySchema = z.object({
13021
+ id: z.number(),
13022
+ name: z.string(),
13023
+ full_name: z.string(),
13024
+ owner_login: z.string().optional(),
13025
+ html_url: z.string(),
13026
+ description: z.string().nullable().optional(),
13027
+ private: z.boolean(),
13028
+ fork: z.boolean(),
13029
+ archived: z.boolean().optional(),
13030
+ language: z.string().nullable().optional(),
13031
+ default_branch: z.string().optional(),
13032
+ stargazers_count: z.number().optional(),
13033
+ forks_count: z.number().optional(),
13034
+ open_issues_count: z.number().optional(),
13035
+ updated_at: z.string().optional()
13036
+ });
13037
+ const searchRepositoriesOutputSchema = z.object({
13038
+ total_count: z.number(),
13039
+ incomplete_results: z.boolean(),
13040
+ items: z.array(SearchRepositorySchema),
13041
+ next_cursor: z.string().optional()
13042
+ });
13043
+ function searchRepositoriesTool(proxy) {
13044
+ return createTool({
13045
+ id: "github_search_repositories",
13046
+ description: "Search repositories across GitHub by name, organization, language, or topic instead of needing to know the exact owner/repo up front.",
13047
+ inputSchema: searchRepositoriesInputSchema,
13048
+ outputSchema: searchRepositoriesOutputSchema,
13049
+ execute: async (input, { requestContext }) => {
13050
+ const platformProxy = proxy.withRequestContext(requestContext);
13051
+ const page = input.cursor ? Number.parseInt(input.cursor, 10) : 1;
13052
+ const perPage = input.per_page ?? 30;
13053
+ const data = (await platformProxy.get({
13054
+ endpoint: "search/repositories",
13055
+ params: {
13056
+ q: input.q,
13057
+ ...input.sort !== void 0 && { sort: input.sort },
13058
+ ...input.order !== void 0 && { order: input.order },
13059
+ per_page: perPage,
13060
+ page
13061
+ },
13062
+ retries: 3
13063
+ })).data;
13064
+ const items = (data.items || []).map((item) => ({
13065
+ id: item.id,
13066
+ name: item.name,
13067
+ full_name: item.full_name,
13068
+ owner_login: item.owner?.login ?? void 0,
13069
+ html_url: item.html_url,
13070
+ description: item.description ?? void 0,
13071
+ private: item.private ?? false,
13072
+ fork: item.fork ?? false,
13073
+ archived: item.archived,
13074
+ language: item.language ?? void 0,
13075
+ default_branch: item.default_branch,
13076
+ stargazers_count: item.stargazers_count,
13077
+ forks_count: item.forks_count,
13078
+ open_issues_count: item.open_issues_count,
13079
+ updated_at: item.updated_at
13080
+ }));
13081
+ const reachableResults = Math.min(data.total_count ?? 0, 1e3);
13082
+ const hasMore = page * perPage < reachableResults && items.length === perPage;
13083
+ return {
13084
+ total_count: data.total_count ?? 0,
13085
+ incomplete_results: data.incomplete_results ?? false,
13086
+ items,
13087
+ ...hasMore && { next_cursor: String(page + 1) }
13088
+ };
13089
+ }
13090
+ });
13091
+ }
13092
+ //#endregion
12766
13093
  //#region src/providers/github/tools/submit-pull-request-review.ts
12767
13094
  const InlineCommentSchema = z.object({
12768
13095
  path: z.string().describe("The relative path to the file that necessitates a review comment."),
@@ -13477,6 +13804,9 @@ function createGithubTools(options) {
13477
13804
  github_list_workflows: listWorkflowsTool(platformProxy),
13478
13805
  github_merge_pull_request: mergePullRequestTool(platformProxy),
13479
13806
  github_rerun_workflow_run: rerunWorkflowRunTool(platformProxy),
13807
+ github_search_code: searchCodeTool(platformProxy),
13808
+ github_search_issues: searchIssuesTool$2(platformProxy),
13809
+ github_search_repositories: searchRepositoriesTool(platformProxy),
13480
13810
  github_submit_pull_request_review: submitPullRequestReviewTool(platformProxy),
13481
13811
  github_update_issue: updateIssueTool$2(platformProxy),
13482
13812
  github_update_label: updateLabelTool$1(platformProxy),
@@ -27632,7 +27962,7 @@ function listCompaniesTool(proxy) {
27632
27962
  //#endregion
27633
27963
  //#region src/providers/hubspot/tools/list-contacts.ts
27634
27964
  const listContactsInputSchema$1 = z.object({ cursor: z.string().optional().describe("Pagination cursor from previous response. Omit for first page.") });
27635
- const ContactSchema = z.object({
27965
+ const ContactSchema$1 = z.object({
27636
27966
  id: z.string(),
27637
27967
  email: z.string().optional(),
27638
27968
  firstName: z.string().optional(),
@@ -27642,7 +27972,7 @@ const ContactSchema = z.object({
27642
27972
  updatedAt: z.string().optional()
27643
27973
  });
27644
27974
  const listContactsOutputSchema$1 = z.object({
27645
- contacts: z.array(ContactSchema),
27975
+ contacts: z.array(ContactSchema$1),
27646
27976
  nextCursor: z.string().optional()
27647
27977
  });
27648
27978
  function listContactsTool$1(proxy) {
@@ -27952,6 +28282,95 @@ function searchCompaniesTool(proxy) {
27952
28282
  });
27953
28283
  }
27954
28284
  //#endregion
28285
+ //#region src/providers/hubspot/tools/search-contacts.ts
28286
+ const searchContactsInputSchema = z.object({
28287
+ query: z.string().optional().describe("Free-text search across default searchable contact properties (name, email, phone, company)."),
28288
+ email: z.string().optional().describe("Contact email to search for (exact match)."),
28289
+ firstname: z.string().optional().describe("Contact first name to search for."),
28290
+ lastname: z.string().optional().describe("Contact last name to search for."),
28291
+ company: z.string().optional().describe("Contact company name to search for."),
28292
+ cursor: z.string().optional().describe("Pagination cursor from previous response. Omit for first page.")
28293
+ });
28294
+ const ContactSchema = z.object({
28295
+ id: z.string(),
28296
+ firstname: z.string().optional(),
28297
+ lastname: z.string().optional(),
28298
+ email: z.string().optional(),
28299
+ phone: z.string().optional(),
28300
+ company: z.string().optional(),
28301
+ createdAt: z.string().optional(),
28302
+ updatedAt: z.string().optional()
28303
+ });
28304
+ const searchContactsOutputSchema = z.object({
28305
+ contacts: z.array(ContactSchema),
28306
+ nextCursor: z.string().optional()
28307
+ });
28308
+ function searchContactsTool(proxy) {
28309
+ return createTool({
28310
+ id: "hubspot_search_contacts",
28311
+ description: "Search contacts by free-text query or property filters instead of paging the full contact list.",
28312
+ inputSchema: searchContactsInputSchema,
28313
+ outputSchema: searchContactsOutputSchema,
28314
+ execute: async (input, { requestContext }) => {
28315
+ const platformProxy = proxy.withRequestContext(requestContext);
28316
+ const filters = [];
28317
+ if (input.email) filters.push({
28318
+ propertyName: "email",
28319
+ operator: "EQ",
28320
+ value: input.email
28321
+ });
28322
+ if (input.firstname) filters.push({
28323
+ propertyName: "firstname",
28324
+ operator: "CONTAINS_TOKEN",
28325
+ value: input.firstname
28326
+ });
28327
+ if (input.lastname) filters.push({
28328
+ propertyName: "lastname",
28329
+ operator: "CONTAINS_TOKEN",
28330
+ value: input.lastname
28331
+ });
28332
+ if (input.company) filters.push({
28333
+ propertyName: "company",
28334
+ operator: "CONTAINS_TOKEN",
28335
+ value: input.company
28336
+ });
28337
+ const searchBody = {
28338
+ properties: [
28339
+ "firstname",
28340
+ "lastname",
28341
+ "email",
28342
+ "phone",
28343
+ "company",
28344
+ "createdate",
28345
+ "lastmodifieddate"
28346
+ ],
28347
+ limit: 100
28348
+ };
28349
+ if (input.query) searchBody.query = input.query;
28350
+ if (filters.length > 0) searchBody.filterGroups = [{ filters }];
28351
+ if (input.cursor) searchBody.after = input.cursor;
28352
+ const data = (await platformProxy.post({
28353
+ endpoint: "/crm/v3/objects/contacts/search",
28354
+ data: searchBody,
28355
+ retries: 3
28356
+ })).data;
28357
+ return {
28358
+ contacts: (data.results || []).map((contact) => ({
28359
+ id: contact.id,
28360
+ firstname: contact.properties?.["firstname"] ?? void 0,
28361
+ lastname: contact.properties?.["lastname"] ?? void 0,
28362
+ email: contact.properties?.["email"] ?? void 0,
28363
+ phone: contact.properties?.["phone"] ?? void 0,
28364
+ company: contact.properties?.["company"] ?? void 0,
28365
+ createdAt: contact.properties?.["createdate"] ?? void 0,
28366
+ updatedAt: contact.properties?.["lastmodifieddate"] ?? void 0
28367
+ })),
28368
+ nextCursor: data.paging?.next?.after || void 0
28369
+ };
28370
+ }
28371
+ });
28372
+ }
28373
+ //#endregion
27955
28374
  //#region src/providers/hubspot/tools/search-deals.ts
27956
28375
  const searchDealsInputSchema = z.object({
27957
28376
  query: z.string().optional().describe("Search query to match against default searchable properties (dealname, pipeline, dealstage, description, dealtype)"),
@@ -28699,6 +29118,7 @@ function createHubspotTools(options) {
28699
29118
  hubspot_list_marketing_emails: listMarketingEmailsTool(platformProxy),
28700
29119
  hubspot_list_tickets: listTicketsTool(platformProxy),
28701
29120
  hubspot_search_companies: searchCompaniesTool(platformProxy),
29121
+ hubspot_search_contacts: searchContactsTool(platformProxy),
28702
29122
  hubspot_search_deals: searchDealsTool(platformProxy),
28703
29123
  hubspot_search_tickets: searchTicketsTool(platformProxy),
28704
29124
  hubspot_submit_form: submitFormTool(platformProxy),
@@ -60052,7 +60472,7 @@ function leaveChannelTool(proxy) {
60052
60472
  }
60053
60473
  //#endregion
60054
60474
  //#region src/providers/slack/tools/list-channels.ts
60055
- const ConversationSchema = z.object({
60475
+ const ConversationSchema$1 = z.object({
60056
60476
  id: z.string(),
60057
60477
  name: z.string(),
60058
60478
  created: z.number(),
@@ -60070,7 +60490,7 @@ const listChannelsInputSchema = z.object({
60070
60490
  limit: z.number().optional().describe("Maximum number of conversations to return (1-200). Default: 100.")
60071
60491
  });
60072
60492
  const listChannelsOutputSchema = z.object({
60073
- conversations: z.array(ConversationSchema),
60493
+ conversations: z.array(ConversationSchema$1),
60074
60494
  next_cursor: z.string().optional(),
60075
60495
  total: z.number()
60076
60496
  });
@@ -61001,6 +61421,122 @@ function scheduleMessageTool(proxy) {
61001
61421
  });
61002
61422
  }
61003
61423
  //#endregion
61424
+ //#region src/providers/slack/tools/search-channels.ts
61425
+ const ConversationSchema = z.object({
61426
+ id: z.string(),
61427
+ name: z.string(),
61428
+ created: z.number(),
61429
+ creator: z.string(),
61430
+ is_archived: z.boolean(),
61431
+ is_general: z.boolean(),
61432
+ is_private: z.boolean(),
61433
+ is_mpim: z.boolean(),
61434
+ is_im: z.boolean(),
61435
+ num_members: z.number().optional()
61436
+ });
61437
+ const searchChannelsInputSchema = z.object({
61438
+ query: z.string().min(1).describe("Channel name to search for. Case-insensitive substring match; a leading # is ignored."),
61439
+ types: z.string().optional().describe("Comma-separated list of conversation types to search. Options: public_channel, private_channel, mpim, im. Default: public_channel."),
61440
+ limit: z.number().int().min(1).max(100).optional().describe("Maximum number of matching channels to return. Default: 20."),
61441
+ cursor: z.string().optional().describe("Pagination cursor from a previous response to continue scanning. Omit to start from the beginning.")
61442
+ });
61443
+ const searchChannelsOutputSchema = z.object({
61444
+ conversations: z.array(ConversationSchema),
61445
+ total: z.number(),
61446
+ next_cursor: z.string().optional().describe("Present when the workspace was not fully scanned; pass back as cursor to continue searching.")
61447
+ });
61448
+ const PAGE_SIZE = 200;
61449
+ const MAX_PAGES_PER_CALL = 10;
61450
+ /**
61451
+ * The continuation cursor is either a raw Slack conversations.list cursor or,
61452
+ * when a call stopped mid-page because the match limit was reached, an
61453
+ * `offset:<n>:<slack cursor>` composite that re-fetches the same page and
61454
+ * resumes from channel index `<n>` so no matches are skipped.
61455
+ */
61456
+ function parseContinuationCursor(raw) {
61457
+ if (!raw) return {
61458
+ pageCursor: void 0,
61459
+ offset: 0
61460
+ };
61461
+ const match = /^offset:(\d+):(.*)$/.exec(raw);
61462
+ if (match) return {
61463
+ pageCursor: match[2] || void 0,
61464
+ offset: Number.parseInt(match[1], 10)
61465
+ };
61466
+ return {
61467
+ pageCursor: raw,
61468
+ offset: 0
61469
+ };
61470
+ }
61471
+ function searchChannelsTool(proxy) {
61472
+ return createTool({
61473
+ id: "slack_search_channels",
61474
+ description: "Find Slack channels by name without paging manually. Scans conversations.list and returns channels whose name contains the query (case-insensitive).",
61475
+ inputSchema: searchChannelsInputSchema,
61476
+ outputSchema: searchChannelsOutputSchema,
61477
+ execute: async (input, { requestContext }) => {
61478
+ const platformProxy = proxy.withRequestContext(requestContext);
61479
+ const query = input.query.replace(/^#/, "").toLowerCase();
61480
+ const maxMatches = input.limit ?? 20;
61481
+ const matches = [];
61482
+ let { pageCursor, offset } = parseContinuationCursor(input.cursor);
61483
+ let nextCursor;
61484
+ for (let page = 0; page < MAX_PAGES_PER_CALL; page++) {
61485
+ const config = {
61486
+ endpoint: "conversations.list",
61487
+ params: {
61488
+ types: input.types || "public_channel",
61489
+ limit: PAGE_SIZE,
61490
+ ...pageCursor && { cursor: pageCursor }
61491
+ },
61492
+ retries: 3
61493
+ };
61494
+ const response = await platformProxy.get(config);
61495
+ const channels = response.data.channels || [];
61496
+ const rawNextCursor = (response.data.response_metadata || {}).next_cursor || void 0;
61497
+ const slackNextCursor = rawNextCursor !== pageCursor ? rawNextCursor : void 0;
61498
+ for (let index = offset; index < channels.length; index++) {
61499
+ const channel = channels[index];
61500
+ const name = channel.name || "";
61501
+ if (!name.toLowerCase().includes(query)) continue;
61502
+ matches.push({
61503
+ id: channel.id,
61504
+ name,
61505
+ created: channel.created || 0,
61506
+ creator: channel.creator || "",
61507
+ is_archived: channel.is_archived || false,
61508
+ is_general: channel.is_general || false,
61509
+ is_private: channel.is_private || false,
61510
+ is_mpim: channel.is_mpim || false,
61511
+ is_im: channel.is_im || false,
61512
+ num_members: channel.num_members
61513
+ });
61514
+ if (matches.length >= maxMatches) {
61515
+ nextCursor = index + 1 < channels.length ? `offset:${index + 1}:${pageCursor ?? ""}` : slackNextCursor;
61516
+ return {
61517
+ conversations: matches,
61518
+ total: matches.length,
61519
+ ...nextCursor !== void 0 && { next_cursor: nextCursor }
61520
+ };
61521
+ }
61522
+ }
61523
+ offset = 0;
61524
+ if (!slackNextCursor) {
61525
+ nextCursor = void 0;
61526
+ break;
61527
+ }
61528
+ pageCursor = slackNextCursor;
61529
+ nextCursor = slackNextCursor;
61530
+ }
61531
+ return {
61532
+ conversations: matches,
61533
+ total: matches.length,
61534
+ ...nextCursor !== void 0 && { next_cursor: nextCursor }
61535
+ };
61536
+ }
61537
+ });
61538
+ }
61539
+ //#endregion
61004
61540
  //#region src/providers/slack/tools/search-files.ts
61005
61541
  const searchFilesInputSchema = z.object({
61006
61542
  query: z.string().describe("Search query string. Example: \"report\""),
@@ -61667,6 +62203,7 @@ function createSlackTools(options) {
61667
62203
  slack_remove_reaction: removeReactionTool(platformProxy),
61668
62204
  slack_rename_channel: renameChannelTool(platformProxy),
61669
62205
  slack_schedule_message: scheduleMessageTool(platformProxy),
62206
+ slack_search_channels: searchChannelsTool(platformProxy),
61670
62207
  slack_search_files: searchFilesTool(platformProxy),
61671
62208
  slack_search_messages: searchMessagesTool(platformProxy),
61672
62209
  slack_send_ephemeral_message: sendEphemeralMessageTool(platformProxy),
@@ -66299,7 +66836,7 @@ const listCustomersInputSchema = z.object({
66299
66836
  created_after: z.number().int().optional().describe("Only return customers that were created after this Unix timestamp. Maps to created[gte]."),
66300
66837
  created_before: z.number().int().optional().describe("Only return customers that were created before this Unix timestamp. Maps to created[lte].")
66301
66838
  });
66302
- const CustomerSchema = z.object({
66839
+ const CustomerSchema$1 = z.object({
66303
66840
  id: z.string(),
66304
66841
  object: z.literal("customer"),
66305
66842
  address: z.object({
@@ -66353,10 +66890,10 @@ const ListResponseSchema$1 = z.object({
66353
66890
  object: z.literal("list"),
66354
66891
  url: z.string().optional(),
66355
66892
  has_more: z.boolean(),
66356
- data: z.array(CustomerSchema)
66893
+ data: z.array(CustomerSchema$1)
66357
66894
  });
66358
66895
  const listCustomersOutputSchema = z.object({
66359
- items: z.array(CustomerSchema),
66896
+ items: z.array(CustomerSchema$1),
66360
66897
  next_cursor: z.string().optional()
66361
66898
  });
66362
66899
  function listCustomersTool(proxy) {
@@ -67239,6 +67776,63 @@ function retrieveBalanceTool(proxy) {
67239
67776
  });
67240
67777
  }
67241
67778
  //#endregion
67779
+ //#region src/providers/stripe/tools/search-customers.ts
67780
+ const searchCustomersInputSchema = z.object({
67781
+ query: z.string().min(1).describe("Stripe search query. Supports field-scoped clauses like email:\"jane@example.com\", name~\"jane\" (substring), or metadata[\"key\"]:\"value\". See https://stripe.com/docs/search#search-query-language."),
67782
+ limit: z.number().int().min(1).max(100).optional().describe("A limit on the number of objects to be returned. Between 1 and 100, default 10."),
67783
+ cursor: z.string().optional().describe("Pagination cursor from the previous response. Maps to Stripe's page parameter. Omit for first page.")
67784
+ });
67785
+ const CustomerSchema = z.object({
67786
+ id: z.string(),
67787
+ email: z.string().nullable().optional(),
67788
+ name: z.string().nullable().optional(),
67789
+ description: z.string().nullable().optional(),
67790
+ created: z.number().optional(),
67791
+ currency: z.string().nullable().optional(),
67792
+ delinquent: z.boolean().nullable().optional(),
67793
+ livemode: z.boolean().optional(),
67794
+ metadata: z.record(z.string(), z.string()).optional()
67795
+ });
67796
+ const searchCustomersOutputSchema = z.object({
67797
+ customers: z.array(CustomerSchema),
67798
+ next_cursor: z.string().optional(),
67799
+ total_count: z.number().optional()
67800
+ });
67801
+ function searchCustomersTool(proxy) {
67802
+ return createTool({
67803
+ id: "stripe_search_customers",
67804
+ description: "Search Stripe customers by email, name, or metadata using Stripe's search query language instead of paging the full customer list. New customers can take up to a minute to become searchable.",
67805
+ inputSchema: searchCustomersInputSchema,
67806
+ outputSchema: searchCustomersOutputSchema,
67807
+ execute: async (input, { requestContext }) => {
67808
+ const data = (await proxy.withRequestContext(requestContext).get({
67809
+ endpoint: "/v1/customers/search",
67810
+ params: {
67811
+ query: input.query,
67812
+ ...input.limit !== void 0 && { limit: String(input.limit) },
67813
+ ...input.cursor !== void 0 && { page: input.cursor }
67814
+ },
67815
+ retries: 3
67816
+ })).data;
67817
+ return {
67818
+ customers: (data.data || []).map((customer) => ({
67819
+ id: customer.id,
67820
+ email: customer.email ?? void 0,
67821
+ name: customer.name ?? void 0,
67822
+ description: customer.description ?? void 0,
67823
+ created: customer.created,
67824
+ currency: customer.currency ?? void 0,
67825
+ delinquent: customer.delinquent ?? void 0,
67826
+ livemode: customer.livemode,
67827
+ metadata: customer.metadata
67828
+ })),
67829
+ ...data.has_more && data.next_page && { next_cursor: data.next_page },
67830
+ ...data.total_count !== void 0 && { total_count: data.total_count }
67831
+ };
67832
+ }
67833
+ });
67834
+ }
67835
+ //#endregion
67242
67836
  //#region src/providers/stripe/tools/update-customer.ts
67243
67837
  const updateCustomerInputSchema = z.object({
67244
67838
  id: z.string().describe("The ID of the customer to update. Example: cus_123"),
@@ -68365,6 +68959,7 @@ function createStripeTools(options) {
68365
68959
  stripe_list_setup_intents: listSetupIntentsTool(platformProxy),
68366
68960
  stripe_list_subscriptions: listSubscriptionsTool(platformProxy),
68367
68961
  stripe_retrieve_balance: retrieveBalanceTool(platformProxy),
68962
+ stripe_search_customers: searchCustomersTool(platformProxy),
68368
68963
  stripe_update_customer: updateCustomerTool(platformProxy),
68369
68964
  stripe_update_invoice_item: updateInvoiceItemTool(platformProxy),
68370
68965
  stripe_update_invoice: updateInvoiceTool(platformProxy),