@apex-inc/mcp-server 0.65.0 → 0.68.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 (48) hide show
  1. package/dist/api-client.d.ts +2 -0
  2. package/dist/api-client.d.ts.map +1 -1
  3. package/dist/api-client.js +11 -0
  4. package/dist/api-client.js.map +1 -1
  5. package/dist/letter-blocks.d.ts +15 -3
  6. package/dist/letter-blocks.d.ts.map +1 -1
  7. package/dist/letter-blocks.js +28 -1
  8. package/dist/letter-blocks.js.map +1 -1
  9. package/dist/setup-catchup-tools.d.ts +130 -4
  10. package/dist/setup-catchup-tools.d.ts.map +1 -1
  11. package/dist/setup-catchup-tools.js +205 -14
  12. package/dist/setup-catchup-tools.js.map +1 -1
  13. package/dist/tool-groups.d.ts.map +1 -1
  14. package/dist/tool-groups.js +8 -1
  15. package/dist/tool-groups.js.map +1 -1
  16. package/dist/tool-shared.d.ts +10 -2
  17. package/dist/tool-shared.d.ts.map +1 -1
  18. package/dist/tool-shared.js +36 -2
  19. package/dist/tool-shared.js.map +1 -1
  20. package/dist/tools/ad-platforms.d.ts +24 -16
  21. package/dist/tools/ad-platforms.d.ts.map +1 -1
  22. package/dist/tools/ad-platforms.js +54 -11
  23. package/dist/tools/ad-platforms.js.map +1 -1
  24. package/dist/tools/apex-campaigns.d.ts +2 -2
  25. package/dist/tools/context.d.ts +48 -8
  26. package/dist/tools/context.d.ts.map +1 -1
  27. package/dist/tools/context.js +114 -35
  28. package/dist/tools/context.js.map +1 -1
  29. package/dist/tools/experiments.d.ts.map +1 -1
  30. package/dist/tools/experiments.js +31 -14
  31. package/dist/tools/experiments.js.map +1 -1
  32. package/dist/tools/letters.d.ts +115 -26
  33. package/dist/tools/letters.d.ts.map +1 -1
  34. package/dist/tools/letters.js +243 -24
  35. package/dist/tools/letters.js.map +1 -1
  36. package/dist/tools/measurement.d.ts +150 -7
  37. package/dist/tools/measurement.d.ts.map +1 -1
  38. package/dist/tools/measurement.js +270 -34
  39. package/dist/tools/measurement.js.map +1 -1
  40. package/dist/tools/partners.d.ts +27 -4
  41. package/dist/tools/partners.d.ts.map +1 -1
  42. package/dist/tools/partners.js +74 -6
  43. package/dist/tools/partners.js.map +1 -1
  44. package/dist/tools.d.ts +503 -67
  45. package/dist/tools.d.ts.map +1 -1
  46. package/package.json +1 -1
  47. package/skills/apex-communications/SKILL.md +4 -3
  48. package/skills/apex-integration-cookbook/SKILL.md +25 -0
@@ -8,7 +8,7 @@ import { readFile, stat } from "node:fs/promises";
8
8
  import { homedir } from "node:os";
9
9
  import { join, resolve } from "node:path";
10
10
  import { z } from "zod";
11
- import { apiGet, apiPatch, apiPost, apiPut, apiDeleteJson, resolveActiveOrg, getActiveWorkspaceLabel, getActiveWorkspace, refreshUserContext, setActiveWorkspace, } from "./api-client.js";
11
+ import { apiGet, apiPatch, apiPost, apiPut, apiDeleteJson, resolveActiveOrg, getUserContext, getActiveWorkspaceLabel, getActiveWorkspace, refreshUserContext, setActiveWorkspace, } from "./api-client.js";
12
12
  import { REPO_BINDING_PATH } from "./repo-binding.js";
13
13
  import { apexBaseUrl } from "./base-url.js";
14
14
  const APEX = "Apex";
@@ -201,19 +201,27 @@ export const setupCatchupTools = {
201
201
  },
202
202
  },
203
203
  create_workspace: {
204
- description: `${APEX} — A new workspace inside one of the owner's organizations: another site, app, or product of the same business. For a separate company use create_organization instead; ask "separate company, or another site of the same business?" first. Switches to the new workspace and returns the ${REPO_BINDING_PATH} contents to commit in this repo. Org owner or admin only.`,
204
+ description: `${APEX} — A new workspace inside one of the owner's organizations: another site, app, or product of the same business. For a separate company use create_organization instead; ask "separate company, or another site of the same business?" first. When the owner belongs to multiple organizations, always confirm which organization and pass org_id explicitly. Switches to the new workspace and returns the ${REPO_BINDING_PATH} contents to commit in this repo. Org owner or admin only.`,
205
205
  schema: z.object({
206
206
  orgId: z
207
207
  .string()
208
208
  .optional()
209
- .describe("Organization it joins (from list_orgs). Defaults to the active org."),
209
+ .describe("Organization it joins (from list_orgs). Required when the owner belongs to 2+ organizations; defaults to the active org when they have one."),
210
210
  name: z.string().min(1).max(100).describe("What the owner calls this site or product."),
211
211
  websiteUrl: z.string().optional().describe("Its website, if it has one."),
212
212
  vertical: z.enum(VERTICALS).optional(),
213
213
  conversionModel: z.enum(CONVERSION_MODELS).optional(),
214
214
  }),
215
215
  handler: async ({ orgId, name, websiteUrl, vertical, conversionModel, }) => {
216
- const id = await resolveOrgId(orgId);
216
+ const explicitOrgId = orgId?.trim();
217
+ const id = await resolveOrgId(explicitOrgId);
218
+ if (!explicitOrgId) {
219
+ const orgs = getUserContext()?.orgs ?? [];
220
+ if (orgs.length > 1) {
221
+ const list = orgs.map((o) => `${o.orgName} (${o.orgId})`).join(", ");
222
+ return jsonResult(null, `You belong to multiple organizations (${list}). Confirm with the owner which organization this workspace joins, then call create_workspace with org_id.`);
223
+ }
224
+ }
217
225
  if (!id) {
218
226
  return jsonResult(null, "No active organization. Pass org_id from list_orgs.");
219
227
  }
@@ -375,6 +383,32 @@ export const setupCatchupTools = {
375
383
  return jsonResult(linkDomainReply(data));
376
384
  },
377
385
  },
386
+ get_consent_posture: {
387
+ description: `${APEX} — Read the workspace's saved consent posture (whether the site shows a consent box, which banner, whether events default to granted, whether the owner signed off on sending to ad networks, and the last consent signal received). Read-only.`,
388
+ schema: z.object({}),
389
+ handler: async () => {
390
+ const cfg = await apiGet("/api/config");
391
+ const policy = cfg?.consentPolicy;
392
+ const banner = policy?.banner ?? null;
393
+ const hasForm = banner === "none" ? "no" : banner ? "yes" : null;
394
+ const outboundChoice = policy?.outboundChoice ?? null;
395
+ const outboundSignedOff = outboundChoice === "hold" ||
396
+ outboundChoice === "when_allowed" ||
397
+ outboundChoice === "inferred";
398
+ return jsonResult({
399
+ has_form: hasForm,
400
+ banner,
401
+ default_granted: policy?.defaultGranted ?? false,
402
+ regional: policy?.regional ?? false,
403
+ outbound_choice: outboundChoice,
404
+ outbound_signed_off: outboundSignedOff,
405
+ outbound_attested_at: policy?.outboundAttestedAt ?? null,
406
+ last_signal_source: policy?.lastSignalSource ?? null,
407
+ last_signal_at: policy?.lastSignalAt ?? null,
408
+ setup_url: consentPostureUrl(),
409
+ });
410
+ },
411
+ },
378
412
  set_consent_posture: {
379
413
  description: `${APEX} — Save the workspace's consent-form answers (do they have a box, which kind). This does not finish the step: whether Apex may send people to ad networks is the owner's own sign-off, checked in Set up Apex. The reply carries the link to give them. Admin only.`,
380
414
  schema: z.object({
@@ -468,7 +502,7 @@ export const setupCatchupTools = {
468
502
  },
469
503
  },
470
504
  get_messaging_guardrails: {
471
- description: `${APEX} — Read holdout percent and channel send limits for Adaptive Journeys.`,
505
+ description: `${APEX} — Read holdout percent, channel send limits, and quiet hours for Adaptive Journeys (same settings as Settings → Messaging & holdout).`,
472
506
  schema: z.object({}),
473
507
  handler: async () => {
474
508
  const data = await apiGet("/api/journeys/settings");
@@ -476,7 +510,7 @@ export const setupCatchupTools = {
476
510
  },
477
511
  },
478
512
  set_messaging_guardrails: {
479
- description: `${APEX} — Set holdout and channel send limits. Omit a field to keep the current value. reset_to_defaults puts every limit back to Apex's default (any field you also pass still wins). nudge_cap_per_day null = no daily limit on milestone nudges. Admin only.`,
513
+ description: `${APEX} — Set holdout, channel send limits, and quiet hours. Omit a field to keep the current value. reset_to_defaults puts every limit back to Apex's default (any field you also pass still wins). nudge_cap_per_day null = no daily limit on milestone nudges. quiet_hours pauses non-transactional sends overnight in the recipient's local timezone (when known) or the workspace fallback timezone. Admin only.`,
480
514
  schema: z.object({
481
515
  resetToDefaults: z
482
516
  .boolean()
@@ -507,6 +541,38 @@ export const setupCatchupTools = {
507
541
  }),
508
542
  })
509
543
  .optional(),
544
+ quietHours: z
545
+ .object({
546
+ enabled: z.boolean().describe("Turn quiet hours on or off."),
547
+ start_hour: z
548
+ .number()
549
+ .int()
550
+ .min(0)
551
+ .max(23)
552
+ .optional()
553
+ .describe("Hour of day (0-23) quiet hours begin, e.g. 21 for 9 PM."),
554
+ end_hour: z
555
+ .number()
556
+ .int()
557
+ .min(0)
558
+ .max(23)
559
+ .optional()
560
+ .describe("Hour of day (0-23) quiet hours end, e.g. 8 for 8 AM."),
561
+ timezone: z
562
+ .string()
563
+ .optional()
564
+ .describe('Fallback IANA timezone, e.g. "America/Chicago".'),
565
+ use_recipient_timezone: z
566
+ .boolean()
567
+ .optional()
568
+ .describe("Use each recipient's timezone trait when known (default true)."),
569
+ channels: z
570
+ .array(z.enum(["email", "in_app", "mobile_push"]))
571
+ .optional()
572
+ .describe('Channels paused during quiet hours (default ["email", "mobile_push"]).'),
573
+ })
574
+ .optional()
575
+ .describe("Quiet hours window that suppresses non-transactional sends overnight."),
510
576
  }),
511
577
  handler: async (args) => {
512
578
  const current = await apiGet("/api/journeys/settings");
@@ -514,6 +580,24 @@ export const setupCatchupTools = {
514
580
  return jsonResult(null, "This Apex server doesn't report its defaults yet. Pass the values instead.");
515
581
  }
516
582
  const base = args.resetToDefaults && current.defaults ? current.defaults : current;
583
+ const baseQh = base.quietHours ?? {
584
+ enabled: false,
585
+ startHour: 21,
586
+ endHour: 8,
587
+ timezone: "America/New_York",
588
+ useRecipientTimezone: true,
589
+ channels: ["email", "mobile_push"],
590
+ };
591
+ const quietHours = args.quietHours
592
+ ? {
593
+ enabled: args.quietHours.enabled,
594
+ startHour: args.quietHours.start_hour ?? baseQh.startHour,
595
+ endHour: args.quietHours.end_hour ?? baseQh.endHour,
596
+ timezone: args.quietHours.timezone ?? baseQh.timezone,
597
+ useRecipientTimezone: args.quietHours.use_recipient_timezone ?? baseQh.useRecipientTimezone,
598
+ channels: args.quietHours.channels ?? baseQh.channels,
599
+ }
600
+ : base.quietHours;
517
601
  const data = await apiPatch("/api/journeys/settings", {
518
602
  holdoutPct: args.holdoutPct ?? base.holdoutPct,
519
603
  attributionWindowDays: args.attributionWindowDays ?? base.attributionWindowDays,
@@ -522,6 +606,7 @@ export const setupCatchupTools = {
522
606
  : base.nudgeCapPerDay,
523
607
  fireOnTestEvents: args.fireOnTestEvents ?? base.fireOnTestEvents,
524
608
  capPolicy: args.capPolicy ?? base.capPolicy,
609
+ ...(quietHours ? { quietHours } : {}),
525
610
  });
526
611
  return jsonResult(data);
527
612
  },
@@ -743,10 +828,18 @@ export const setupCatchupTools = {
743
828
  },
744
829
  },
745
830
  set_app_platforms: {
746
- description: `${APEX} — Tell Apex where the app ships (iOS / Android / web app) and whether they buy install ads. Also sets attribution windows when provided. Merges into the existing app settings so bundle IDs are not wiped. Admin only.`,
831
+ description: `${APEX} — Tell Apex where the app ships (iOS / Android / web app), whether they buy install ads, and its store listings (iOS App Store ID and Google Play or direct Android APK download URL). Also sets attribution windows when provided. Merges into the existing app settings so bundle IDs are not wiped. Admin only.`,
747
832
  schema: z.object({
748
- platforms: z.array(z.enum(["ios", "android", "web"])).min(1),
833
+ platforms: z.array(z.enum(["ios", "android", "web"])).min(1).optional(),
749
834
  outcome: z.enum(["behavior", "ad-roi", "partners"]).optional(),
835
+ appStoreId: z
836
+ .string()
837
+ .optional()
838
+ .describe("Numeric iOS App Store Connect ID (e.g. 6479731571). Powers Apex Links, Smart Banner, and iPhone Get the app handoff."),
839
+ playStoreUrl: z
840
+ .string()
841
+ .optional()
842
+ .describe("Google Play listing URL, or an https:// direct APK / Android download URL if the app ships outside Google Play."),
750
843
  attributionWindows: z
751
844
  .object({
752
845
  click_through: z.number().optional(),
@@ -757,13 +850,25 @@ export const setupCatchupTools = {
757
850
  .optional(),
758
851
  }),
759
852
  handler: async (args) => {
853
+ if (args.appStoreId !== undefined) {
854
+ const cleaned = args.appStoreId.trim().replace(/^id/i, "");
855
+ if (cleaned && !/^\d+$/.test(cleaned)) {
856
+ return jsonResult(null, "app_store_id must be digits, like 6479731571.");
857
+ }
858
+ }
760
859
  const current = await apiGet("/api/config");
761
860
  const existing = current.mobileAppConfig ?? {};
762
861
  const windows = args.attributionWindows;
763
862
  const mobileAppConfig = {
764
863
  ...existing,
765
- platforms: args.platforms,
864
+ ...(args.platforms ? { platforms: args.platforms } : {}),
766
865
  ...(args.outcome ? { outcome: args.outcome } : {}),
866
+ ...(args.appStoreId !== undefined
867
+ ? { appStoreId: args.appStoreId.trim().replace(/^id/i, "") || undefined }
868
+ : {}),
869
+ ...(args.playStoreUrl !== undefined
870
+ ? { playStoreUrl: args.playStoreUrl.trim() || undefined }
871
+ : {}),
767
872
  };
768
873
  if (windows) {
769
874
  const prev = (existing.attributionWindows ?? {});
@@ -890,12 +995,16 @@ export const setupCatchupTools = {
890
995
  },
891
996
  },
892
997
  set_app_links: {
893
- description: `${APEX} — Save the iOS and/or Android app ids Apex needs to publish the Universal Links and App Links files on the workspace's links subdomain, then check the published files. Same save as Universal Links and App Links in Set up Apex. Read the ids from the repo (Xcode project, build.gradle) when you can. Returns the Associated Domains line to add to the iOS entitlements. Admin only.`,
998
+ description: `${APEX} — Save the iOS and/or Android app ids Apex needs to publish the Universal Links and App Links files on the workspace's links subdomain (plus optional App Store ID and Play / Android download URL), then check the published files. Same save as Universal Links and App Links in Set up Apex. Read the ids from the repo (Xcode project, build.gradle) when you can. Returns the Associated Domains line to add to the iOS entitlements. Admin only.`,
894
999
  schema: z.object({
895
1000
  ios: z
896
1001
  .object({
897
1002
  bundle_id: z.string().min(1).describe("e.g. com.acme.app"),
898
1003
  team_id: z.string().min(1).describe("10-character Apple Team ID."),
1004
+ app_store_id: z
1005
+ .string()
1006
+ .optional()
1007
+ .describe("Optional numeric App Store Connect ID (e.g. 6479731571)."),
899
1008
  })
900
1009
  .optional(),
901
1010
  android: z
@@ -904,7 +1013,11 @@ export const setupCatchupTools = {
904
1013
  sha256_cert_fingerprint: z
905
1014
  .string()
906
1015
  .min(1)
907
- .describe("Play app signing SHA-256 fingerprint (colons optional)."),
1016
+ .describe("SHA-256 signing fingerprint (colons optional): from Play Console → App signing, or from your own release keystore if you ship a direct APK outside Google Play."),
1017
+ play_store_url: z
1018
+ .string()
1019
+ .optional()
1020
+ .describe("Optional Google Play listing URL or direct https:// Android download / APK URL."),
908
1021
  })
909
1022
  .optional(),
910
1023
  }),
@@ -915,12 +1028,21 @@ export const setupCatchupTools = {
915
1028
  const current = await apiGet("/api/config");
916
1029
  const existing = current.mobileAppConfig ?? {};
917
1030
  const ios = args.ios
918
- ? { bundleId: args.ios.bundle_id.trim(), teamId: args.ios.team_id.trim().toUpperCase() }
1031
+ ? {
1032
+ bundleId: args.ios.bundle_id.trim(),
1033
+ teamId: args.ios.team_id.trim().toUpperCase(),
1034
+ ...(args.ios.app_store_id !== undefined
1035
+ ? { appStoreId: args.ios.app_store_id.trim().replace(/^id/i, "") || undefined }
1036
+ : {}),
1037
+ }
919
1038
  : null;
920
1039
  const android = args.android
921
1040
  ? {
922
1041
  packageName: args.android.package_name.trim(),
923
1042
  sha256CertFingerprint: args.android.sha256_cert_fingerprint.trim().toUpperCase(),
1043
+ ...(args.android.play_store_url !== undefined
1044
+ ? { playStoreUrl: args.android.play_store_url.trim() || undefined }
1045
+ : {}),
924
1046
  }
925
1047
  : null;
926
1048
  await apiPatch("/api/config", {
@@ -1016,6 +1138,14 @@ export const setupCatchupTools = {
1016
1138
  if (Object.keys(patch).length === 0)
1017
1139
  patch.smartBanner = existing;
1018
1140
  const data = await apiPatch("/api/config", patch);
1141
+ const hasAppStoreId = Boolean(typeof current.mobileAppConfig?.appStoreId === "string" &&
1142
+ current.mobileAppConfig.appStoreId.trim().length > 0);
1143
+ if (args.enabled && !hasAppStoreId) {
1144
+ return jsonResult({
1145
+ ...(typeof data === "object" && data !== null ? data : { result: data }),
1146
+ warning: "This workspace does not have an iOS App Store ID saved yet, so the Smart Banner and iPhone Get the app handoff cannot route iPhones to the App Store. Save it with set_app_platforms({ app_store_id: \"...\" }) or in Settings → Mobile apps.",
1147
+ });
1148
+ }
1019
1149
  return jsonResult(data);
1020
1150
  },
1021
1151
  },
@@ -1147,9 +1277,23 @@ export const setupCatchupTools = {
1147
1277
  },
1148
1278
  },
1149
1279
  create_apex_link: {
1150
- description: `${APEX} — Create an Apex Link (same as the Links page and Set up Apex → trackable links). Pick the placement first: paid-ad when someone pays for the clicks, social-post for an unpaid post, social-bio for the one permanent profile link, other for anywhere else (reports as a referral, and needs source naming the site, show, or community so signups credit it). A paid-ad link puts its visits in paid reporting and on the billed attribution meter, so never use it for a free post. Paid links write cpc for Google/Microsoft and paid_social for the rest — never a bare paid. Owners, admins, and Marketing seats can make links. The paid-link setup step finishes when a paid link exists — do not mark the step complete.`,
1280
+ description: `${APEX} — Create an Apex Link (same as the Links page and Set up Apex → trackable links). Pick the placement first: paid-ad when someone pays for the clicks, social-post for an unpaid post, social-bio for the one permanent profile link, other for anywhere else (reports as a referral, and needs source naming the site, show, or community so signups credit it). A paid-ad link puts its visits in paid reporting and on the billed attribution meter, so never use it for a free post. Paid links write cpc for Google/Microsoft and paid_social for the rest — never a bare paid. Per-OS routing: when the workspace has an iOS App Store ID or Android download URL saved (via set_app_platforms), Apex automatically routes iPhones without the app to the App Store (with the Get the app handoff) and Android phones to Play or the Android download URL while desktop lands on destination_url; pass ios_url / android_url to override per link, or store_routing: false to send every OS to destination_url. Owners, admins, and Marketing seats can make links. The paid-link setup step finishes when a paid link exists — do not mark the step complete.`,
1151
1281
  schema: z.object({
1152
- destinationUrl: z.string().url().describe("Where the click should land."),
1282
+ destinationUrl: z.string().url().describe("Where the click should land (desktop / default fallback)."),
1283
+ iosUrl: z
1284
+ .string()
1285
+ .url()
1286
+ .optional()
1287
+ .describe("Optional iPhone/iPad destination (e.g. App Store URL). When omitted, Apex automatically derives https://apps.apple.com/app/id<app_store_id> from the workspace's App Store ID so the iPhone Get the app handoff works."),
1288
+ androidUrl: z
1289
+ .string()
1290
+ .url()
1291
+ .optional()
1292
+ .describe("Optional Android destination (Google Play URL or direct https:// APK download URL). When omitted, Apex uses the workspace's Android store/download URL."),
1293
+ storeRouting: z
1294
+ .boolean()
1295
+ .optional()
1296
+ .describe("Set to false to disable automatic App Store / Android fallback routing and send every device to destination_url."),
1153
1297
  placement: z
1154
1298
  .enum(CREATE_LINK_PLACEMENTS)
1155
1299
  .optional()
@@ -1212,6 +1356,9 @@ export const setupCatchupTools = {
1212
1356
  const data = await apiPost("/api/mobile/links", {
1213
1357
  ...(slug ? { slug } : {}),
1214
1358
  destinationUrl: args.destinationUrl.trim(),
1359
+ ...(args.iosUrl?.trim() ? { iosFallbackUrl: args.iosUrl.trim() } : {}),
1360
+ ...(args.androidUrl?.trim() ? { androidFallbackUrl: args.androidUrl.trim() } : {}),
1361
+ ...(args.storeRouting !== undefined ? { storeRouting: args.storeRouting } : {}),
1215
1362
  title: args.name?.trim() || slug,
1216
1363
  placement,
1217
1364
  ...(placement === "other" ? { source: utm.source } : { platform: utm.source }),
@@ -1223,6 +1370,50 @@ export const setupCatchupTools = {
1223
1370
  return jsonResult(data);
1224
1371
  },
1225
1372
  },
1373
+ update_apex_link: {
1374
+ description: `${APEX} — Update destinations or title on an existing Apex Link without changing its slug or losing its click history. Pass ios_url (e.g. https://apps.apple.com/app/id<app_store_id>) to enable the iPhone Get the app handoff, android_url for Google Play or a direct APK download URL, and destination_url for desktop / default fallback. Pass null for ios_url or android_url to clear that per-OS override.`,
1375
+ schema: z.object({
1376
+ slug: z.string().min(1).describe("The link slug (e.g. meta-download or get-app)."),
1377
+ handle: z
1378
+ .string()
1379
+ .optional()
1380
+ .describe("Partner handle if updating a partner-owned link."),
1381
+ destinationUrl: z.string().url().optional().describe("Desktop / default fallback URL."),
1382
+ iosUrl: z
1383
+ .string()
1384
+ .url()
1385
+ .nullable()
1386
+ .optional()
1387
+ .describe("iOS destination URL (e.g. App Store URL), or null to clear."),
1388
+ androidUrl: z
1389
+ .string()
1390
+ .url()
1391
+ .nullable()
1392
+ .optional()
1393
+ .describe("Android destination URL (Play Store or direct https:// APK URL), or null to clear."),
1394
+ name: z.string().optional().describe("Display title for the link."),
1395
+ }),
1396
+ handler: async (args) => {
1397
+ const slug = args.slug.trim().replace(/^\/+/, "");
1398
+ const body = {};
1399
+ if (args.destinationUrl !== undefined)
1400
+ body.destinationUrl = args.destinationUrl.trim();
1401
+ if (args.iosUrl !== undefined)
1402
+ body.iosFallbackUrl = args.iosUrl === null ? null : args.iosUrl.trim();
1403
+ if (args.androidUrl !== undefined)
1404
+ body.androidFallbackUrl = args.androidUrl === null ? null : args.androidUrl.trim();
1405
+ if (args.name !== undefined)
1406
+ body.title = args.name.trim();
1407
+ if (Object.keys(body).length === 0) {
1408
+ return jsonResult(null, "Pass at least one field to update (destination_url, ios_url, android_url, or name).");
1409
+ }
1410
+ const q = args.handle?.trim()
1411
+ ? `?handle=${encodeURIComponent(args.handle.trim())}`
1412
+ : "";
1413
+ const data = await apiPatch(`/api/mobile/links/${encodeURIComponent(slug)}${q}`, body);
1414
+ return jsonResult(data);
1415
+ },
1416
+ },
1226
1417
  get_skan_schema: {
1227
1418
  description: `${APEX} — Read what Apple's SKAdNetwork conversion values (0–63) mean for this workspace's iOS app: which event is "worth it", which is "showed interest", and what Meta and Google read back as low / medium / high. \`schema\` is null until the workspace has named its values (Set up Apex → Mobile → "Say what Apple's numbers mean"). Omit mobile_app_id for the workspace's first app.`,
1228
1419
  schema: z.object({