@fload-ai/mcp 0.5.0 → 0.7.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 (44) hide show
  1. package/README.md +1 -1
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/api-client.d.ts +5 -0
  4. package/dist/api-client.d.ts.map +1 -1
  5. package/dist/api-client.js +21 -2
  6. package/dist/api-client.js.map +2 -2
  7. package/dist/bin.d.ts +1 -1
  8. package/dist/bin.d.ts.map +1 -1
  9. package/dist/bin.js +646 -711
  10. package/dist/bin.js.map +4 -4
  11. package/dist/config.d.ts +1 -2
  12. package/dist/config.d.ts.map +1 -1
  13. package/dist/index.js +567 -638
  14. package/dist/index.js.map +4 -4
  15. package/dist/rate-limiter.d.ts.map +1 -1
  16. package/dist/tools/actions.d.ts +20 -37
  17. package/dist/tools/actions.d.ts.map +1 -1
  18. package/dist/tools/ads.d.ts +8 -15
  19. package/dist/tools/ads.d.ts.map +1 -1
  20. package/dist/tools/agents.d.ts +22 -48
  21. package/dist/tools/agents.d.ts.map +1 -1
  22. package/dist/tools/analytics.d.ts +12 -34
  23. package/dist/tools/analytics.d.ts.map +1 -1
  24. package/dist/tools/apps.d.ts +8 -17
  25. package/dist/tools/apps.d.ts.map +1 -1
  26. package/dist/tools/aso.d.ts +43 -51
  27. package/dist/tools/aso.d.ts.map +1 -1
  28. package/dist/tools/chat.d.ts +7 -23
  29. package/dist/tools/chat.d.ts.map +1 -1
  30. package/dist/tools/dashboard.d.ts +2 -2
  31. package/dist/tools/dashboard.d.ts.map +1 -1
  32. package/dist/tools/index.d.ts +0 -3
  33. package/dist/tools/index.d.ts.map +1 -1
  34. package/dist/tools/index.js +563 -644
  35. package/dist/tools/index.js.map +4 -4
  36. package/dist/tools/reviews.d.ts +17 -60
  37. package/dist/tools/reviews.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/dist/tools/anomalies.d.ts +0 -107
  40. package/dist/tools/anomalies.d.ts.map +0 -1
  41. package/dist/tools/forecasting.d.ts +0 -32
  42. package/dist/tools/forecasting.d.ts.map +0 -1
  43. package/dist/tools/growth.d.ts +0 -43
  44. package/dist/tools/growth.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -27,6 +27,8 @@ var FloadApiClient = class {
27
27
  this.baseUrl = baseUrl;
28
28
  this.apiKey = apiKey;
29
29
  }
30
+ baseUrl;
31
+ apiKey;
30
32
  async request(path, options = {}) {
31
33
  const url = `${this.baseUrl}${path}`;
32
34
  const headers = {
@@ -52,8 +54,7 @@ var FloadApiClient = class {
52
54
  const searchParams = new URLSearchParams();
53
55
  if (params) {
54
56
  for (const [key, value] of Object.entries(params)) {
55
- if (value !== void 0)
56
- searchParams.set(key, String(value));
57
+ if (value !== void 0) searchParams.set(key, String(value));
57
58
  }
58
59
  }
59
60
  const query = searchParams.toString();
@@ -65,6 +66,24 @@ var FloadApiClient = class {
65
66
  body: body ? JSON.stringify(body) : void 0
66
67
  });
67
68
  }
69
+ /**
70
+ * POST that hands back the answer instead of throwing on a non-2xx status:
71
+ * for endpoints whose refusals carry a structured body (FLO-1595: the
72
+ * Actions commands answer one target with that target's own status and
73
+ * reason). `body` is null when the response is not JSON.
74
+ */
75
+ async postForAnswer(path, body) {
76
+ const response = await fetch(`${this.baseUrl}${path}`, {
77
+ method: "POST",
78
+ headers: {
79
+ Authorization: `Bearer ${this.apiKey}`,
80
+ ...body ? { "Content-Type": "application/json" } : {}
81
+ },
82
+ body: body ? JSON.stringify(body) : void 0
83
+ });
84
+ const parsed = await response.json().catch(() => null);
85
+ return { ok: response.ok, status: response.status, body: parsed };
86
+ }
68
87
  async patch(path, body) {
69
88
  return this.request(path, {
70
89
  method: "PATCH",
@@ -110,6 +129,8 @@ var RateLimiter = class {
110
129
  this.maxCalls = maxCalls;
111
130
  this.windowMs = windowMs;
112
131
  }
132
+ maxCalls;
133
+ windowMs;
113
134
  calls = /* @__PURE__ */ new Map();
114
135
  check(key) {
115
136
  const now = Date.now();
@@ -117,8 +138,8 @@ var RateLimiter = class {
117
138
  let timestamps = this.calls.get(key) || [];
118
139
  timestamps = timestamps.filter((t) => t > windowStart);
119
140
  if (timestamps.length >= this.maxCalls) {
120
- const oldestInWindow = timestamps[0];
121
- const retryAfterMs = oldestInWindow + this.windowMs - now;
141
+ const [oldestInWindow] = timestamps;
142
+ const retryAfterMs = oldestInWindow === void 0 ? Number.NaN : oldestInWindow + this.windowMs - now;
122
143
  this.calls.set(key, timestamps);
123
144
  return { allowed: false, remaining: 0, retryAfterMs };
124
145
  }
@@ -166,10 +187,8 @@ async function listApps(input, client) {
166
187
  });
167
188
  const apps = response.data ?? [];
168
189
  const filtered = input.platform ? apps.filter((app) => {
169
- if (input.platform === "ios")
170
- return !!app.appleAppId;
171
- if (input.platform === "android")
172
- return !!app.googleAppId;
190
+ if (input.platform === "ios") return !!app.appleAppId;
191
+ if (input.platform === "android") return !!app.googleAppId;
173
192
  return true;
174
193
  }) : apps;
175
194
  return {
@@ -279,6 +298,9 @@ var getReviewsSchema = z2.object({
279
298
  startDate: z2.string().optional().describe("Filter reviews from this date (ISO format: YYYY-MM-DD)"),
280
299
  endDate: z2.string().optional().describe("Filter reviews until this date (ISO format: YYYY-MM-DD)"),
281
300
  limit: z2.number().int().min(1).max(200).default(50).describe("Maximum number of reviews to return"),
301
+ cursor: z2.string().optional().describe(
302
+ "nextCursor from the previous get_reviews call, to fetch the next page with the same app and filters"
303
+ ),
282
304
  sortBy: z2.enum(["date", "rating"]).default("date").describe("Sort reviews by date or rating")
283
305
  });
284
306
  var generateReviewReplySchema = z2.object({
@@ -337,19 +359,7 @@ async function getReviews(input, client) {
337
359
  isError: true
338
360
  };
339
361
  }
340
- const params = {
341
- limit: input.limit
342
- };
343
- if (input.platform)
344
- params.platform = input.platform;
345
- if (input.rating !== void 0)
346
- params.rating = input.rating;
347
- if (input.replied !== void 0)
348
- params.responseStatus = input.replied ? "replied" : "unreplied";
349
- if (input.startDate)
350
- params.startDate = input.startDate;
351
- if (input.endDate)
352
- params.endDate = input.endDate;
362
+ const params = reviewQueryParameters(input);
353
363
  const response = await client.get(
354
364
  `/api/assets/${assetId}/reviews`,
355
365
  params
@@ -376,6 +386,8 @@ async function getReviews(input, client) {
376
386
  type: "text",
377
387
  text: formatAsJson({
378
388
  summary,
389
+ // Pass back as `cursor` to get the next page; null = last page.
390
+ nextCursor: response.data?.nextCursor ?? null,
379
391
  reviews: reviews.map((review) => ({
380
392
  id: review.id,
381
393
  appId: review.appId,
@@ -410,6 +422,19 @@ async function getReviews(input, client) {
410
422
  };
411
423
  }
412
424
  }
425
+ function reviewQueryParameters(input) {
426
+ const params = {
427
+ limit: input.limit
428
+ };
429
+ if (input.cursor) params.cursor = input.cursor;
430
+ if (input.platform) params.platform = input.platform;
431
+ if (input.rating !== void 0) params.rating = input.rating;
432
+ if (input.replied !== void 0)
433
+ params.responseStatus = input.replied ? "replied" : "unreplied";
434
+ if (input.startDate) params.startDate = input.startDate;
435
+ if (input.endDate) params.endDate = input.endDate;
436
+ return params;
437
+ }
413
438
  async function generateReviewReply(input, client) {
414
439
  try {
415
440
  const response = await client.post(
@@ -500,45 +525,140 @@ async function translateReview(input, client) {
500
525
 
501
526
  // src/tools/analytics.ts
502
527
  import { z as z3 } from "zod";
528
+ function summarize(points, change) {
529
+ const values = (Array.isArray(points) ? points : []).map((point) => point.value ?? point.total).filter((value) => typeof value === "number");
530
+ return {
531
+ value: change?.currentValue ?? null,
532
+ effectiveFromDate: change?.effectiveFromDate ?? null,
533
+ effectiveToDate: change?.effectiveToDate ?? null,
534
+ min: values.length > 0 ? Math.min(...values) : null,
535
+ max: values.length > 0 ? Math.max(...values) : null,
536
+ dataPoints: values.length
537
+ };
538
+ }
503
539
  var discoverMetricsSchema = z3.object({
504
540
  assetId: z3.string().uuid().describe("App UUID to check available metrics for")
505
541
  });
506
542
  var getMetricsSchema = z3.object({
507
543
  assetId: z3.string().uuid().describe("App UUID"),
508
- metrics: z3.array(z3.string()).min(1).describe('Metric names to query (e.g., ["proceeds", "totalDownloads"]). Use discover_metrics first to see available metrics.'),
544
+ metrics: z3.array(z3.string()).min(1).describe(
545
+ 'Metric names to query (e.g., ["proceeds", "totalDownloads"]). Use discover_metrics first to see available metrics.'
546
+ ),
509
547
  startDate: z3.string().optional().describe("Start date (YYYY-MM-DD). Defaults to 30 days ago."),
510
548
  endDate: z3.string().optional().describe("End date (YYYY-MM-DD). Defaults to today."),
511
549
  granularity: z3.enum(["daily", "weekly", "monthly"]).default("daily").describe("Data granularity"),
512
- dimension: z3.string().optional().describe('Optional dimension to break down by (e.g., "storefront" for country, "platform" for device). Use discover_dimensions to see options.'),
513
- dimensionFilter: z3.string().optional().describe('Filter to a specific dimension value (e.g., "US" when dimension is "storefront")')
550
+ dimension: z3.string().optional().describe(
551
+ 'Optional dimension to break down by (e.g., "storefront" for country, "platform" for device). Use discover_dimensions to see options.'
552
+ ),
553
+ dimensionFilter: z3.string().optional().describe(
554
+ 'Filter to a specific dimension value (e.g., "US" when dimension is "storefront")'
555
+ )
514
556
  });
515
557
  var discoverDimensionsSchema = z3.object({
516
558
  assetId: z3.string().uuid().describe("App UUID"),
517
- dimension: z3.string().optional().describe('If provided, returns the available values for this dimension (e.g., countries for "storefront")')
559
+ dimension: z3.string().optional().describe(
560
+ 'If provided, returns the available values for this dimension (e.g., countries for "storefront")'
561
+ )
518
562
  });
519
563
  var METRIC_INFO = {
520
- proceeds: { displayName: "Net Revenue (after store cut)", category: "Revenue", type: "currency" },
521
- total_revenue: { displayName: "Gross Revenue", category: "Revenue", type: "currency" },
522
- total_downloads: { displayName: "Total Downloads", category: "Downloads", type: "count" },
523
- units: { displayName: "First-time Downloads", category: "Downloads", type: "count" },
524
- redownloads: { displayName: "Re-downloads", category: "Downloads", type: "count" },
525
- page_views: { displayName: "App Store Page Views", category: "Downloads", type: "count" },
526
- impressions: { displayName: "App Store Impressions", category: "Downloads", type: "count" },
527
- sessions: { displayName: "App Sessions", category: "Engagement", type: "count" },
528
- active_devices: { displayName: "Active Devices", category: "Engagement", type: "count" },
564
+ proceeds: {
565
+ displayName: "Net Revenue (after store cut)",
566
+ category: "Revenue",
567
+ type: "currency"
568
+ },
569
+ total_revenue: {
570
+ displayName: "Gross Revenue",
571
+ category: "Revenue",
572
+ type: "currency"
573
+ },
574
+ total_downloads: {
575
+ displayName: "Total Downloads",
576
+ category: "Downloads",
577
+ type: "count"
578
+ },
579
+ units: {
580
+ displayName: "First-time Downloads",
581
+ category: "Downloads",
582
+ type: "count"
583
+ },
584
+ redownloads: {
585
+ displayName: "Re-downloads",
586
+ category: "Downloads",
587
+ type: "count"
588
+ },
589
+ page_views: {
590
+ displayName: "App Store Page Views",
591
+ category: "Downloads",
592
+ type: "count"
593
+ },
594
+ impressions: {
595
+ displayName: "App Store Impressions",
596
+ category: "Downloads",
597
+ type: "count"
598
+ },
599
+ sessions: {
600
+ displayName: "App Sessions",
601
+ category: "Engagement",
602
+ type: "count"
603
+ },
604
+ active_devices: {
605
+ displayName: "Active Devices",
606
+ category: "Engagement",
607
+ type: "count"
608
+ },
529
609
  crashes: { displayName: "Crashes", category: "Engagement", type: "count" },
530
- paying_users: { displayName: "Paying Users", category: "Engagement", type: "count" },
531
- active_subs: { displayName: "Active Subscriptions", category: "Subscriptions", type: "count" },
532
- active_trials: { displayName: "Active Trials", category: "Subscriptions", type: "count" },
533
- new_trials: { displayName: "New Trials", category: "Subscriptions", type: "count" },
534
- trial_conversion_rate: { displayName: "Trial Conversion Rate", category: "Subscriptions", type: "percentage" },
535
- subscription_retention_rate: { displayName: "Subscription Retention Rate", category: "Subscriptions", type: "percentage" },
536
- products_sold: { displayName: "Products Sold (IAP)", category: "Revenue", type: "count" },
610
+ paying_users: {
611
+ displayName: "Paying Users",
612
+ category: "Engagement",
613
+ type: "count"
614
+ },
615
+ active_subs: {
616
+ displayName: "Active Subscriptions",
617
+ category: "Subscriptions",
618
+ type: "count"
619
+ },
620
+ active_trials: {
621
+ displayName: "Active Trials",
622
+ category: "Subscriptions",
623
+ type: "count"
624
+ },
625
+ new_trials: {
626
+ displayName: "New Trials",
627
+ category: "Subscriptions",
628
+ type: "count"
629
+ },
630
+ trial_conversion_rate: {
631
+ displayName: "Trial Conversion Rate",
632
+ category: "Subscriptions",
633
+ type: "percentage"
634
+ },
635
+ subscription_retention_rate: {
636
+ displayName: "Subscription Retention Rate",
637
+ category: "Subscriptions",
638
+ type: "percentage"
639
+ },
640
+ products_sold: {
641
+ displayName: "Products Sold (IAP)",
642
+ category: "Revenue",
643
+ type: "count"
644
+ },
537
645
  ad_spend: { displayName: "Ad Spend", category: "Ads", type: "currency" },
538
- ad_impressions: { displayName: "Ad Impressions", category: "Ads", type: "count" },
646
+ ad_impressions: {
647
+ displayName: "Ad Impressions",
648
+ category: "Ads",
649
+ type: "count"
650
+ },
539
651
  ad_taps: { displayName: "Ad Taps/Clicks", category: "Ads", type: "count" },
540
- ad_installs: { displayName: "Ad-attributed Installs", category: "Ads", type: "count" },
541
- ad_conversions: { displayName: "Ad Conversions", category: "Ads", type: "count" }
652
+ ad_installs: {
653
+ displayName: "Ad-attributed Installs",
654
+ category: "Ads",
655
+ type: "count"
656
+ },
657
+ ad_conversions: {
658
+ displayName: "Ad Conversions",
659
+ category: "Ads",
660
+ type: "count"
661
+ }
542
662
  };
543
663
  var DIMENSION_INFO = {
544
664
  storefront: "Country",
@@ -572,28 +692,32 @@ async function discoverMetrics(input, client) {
572
692
  });
573
693
  const byCategory = {};
574
694
  for (const m of enriched) {
575
- if (!byCategory[m.category])
576
- byCategory[m.category] = [];
577
- byCategory[m.category].push(m);
695
+ (byCategory[m.category] ??= []).push(m);
578
696
  }
579
697
  return {
580
- content: [{
581
- type: "text",
582
- text: formatAsJson({
583
- assetId: input.assetId,
584
- totalAvailable: availableMetrics.length,
585
- metricsByCategory: byCategory,
586
- dataGroups: metricGroups,
587
- tip: 'Use the metric "name" field in get_metrics. You can query multiple metrics at once.'
588
- })
589
- }]
698
+ content: [
699
+ {
700
+ type: "text",
701
+ text: formatAsJson({
702
+ assetId: input.assetId,
703
+ totalAvailable: availableMetrics.length,
704
+ metricsByCategory: byCategory,
705
+ dataGroups: metricGroups,
706
+ tip: 'Use the metric "name" field in get_metrics. You can query multiple metrics at once.'
707
+ })
708
+ }
709
+ ]
590
710
  };
591
711
  } catch (error) {
592
- return { content: [{ type: "text", text: formatError(error) }], isError: true };
712
+ return {
713
+ content: [{ type: "text", text: formatError(error) }],
714
+ isError: true
715
+ };
593
716
  }
594
717
  }
595
718
  async function getMetrics(input, client) {
596
719
  try {
720
+ const granularity = input.granularity ?? "daily";
597
721
  const endDate = input.endDate || (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
598
722
  const startDate = input.startDate || (() => {
599
723
  const d = /* @__PURE__ */ new Date();
@@ -604,60 +728,53 @@ async function getMetrics(input, client) {
604
728
  metrics: input.metrics.join(","),
605
729
  fromDate: startDate,
606
730
  toDate: endDate,
607
- granularity: input.granularity
731
+ granularity
608
732
  };
609
- if (input.dimension)
610
- params.dimension = input.dimension;
733
+ if (input.dimension) params.dimension = input.dimension;
611
734
  if (input.dimensionFilter && input.dimension) {
612
735
  params[`filter.${input.dimension}`] = input.dimensionFilter;
613
736
  }
614
- const response = await client.get(
615
- `/api/assets/${input.assetId}/metrics/timeseries`,
616
- params
617
- );
737
+ const path = `/api/assets/${input.assetId}/metrics/timeseries`;
738
+ const response = await client.get(path, params);
739
+ const summaryResponse = input.granularity === "daily" ? response : await client.get(path, {
740
+ ...params,
741
+ granularity: "daily"
742
+ });
618
743
  const data = response.data ?? {};
619
- const changes = response.changes ?? {};
744
+ const changes = summaryResponse.changes ?? {};
620
745
  const meta = response.meta ?? {};
621
746
  const summaries = {};
622
- for (const [metricName, timeseries] of Object.entries(data)) {
623
- const points = timeseries;
624
- if (!Array.isArray(points) || points.length === 0) {
625
- summaries[metricName] = { total: 0, average: 0, min: 0, max: 0, dataPoints: 0 };
626
- continue;
627
- }
628
- const values = points.map((p) => p.value);
629
- const total = values.reduce((s, v) => s + v, 0);
630
- summaries[metricName] = {
631
- total: Math.round(total * 100) / 100,
632
- average: Math.round(total / values.length * 100) / 100,
633
- min: Math.min(...values),
634
- max: Math.max(...values),
635
- dataPoints: values.length
636
- };
747
+ for (const [metricName, points] of Object.entries(data)) {
748
+ summaries[metricName] = summarize(points, changes[metricName]);
637
749
  }
638
750
  const info = METRIC_INFO;
639
751
  return {
640
- content: [{
641
- type: "text",
642
- text: formatAsJson({
643
- assetId: input.assetId,
644
- dateRange: { start: startDate, end: endDate },
645
- granularity: input.granularity,
646
- dimension: input.dimension || null,
647
- metrics: Object.keys(data).map((name) => ({
648
- name,
649
- displayName: info[name]?.displayName || name,
650
- type: info[name]?.type || "count",
651
- summary: summaries[name],
652
- change: changes[name] || null
653
- })),
654
- timeseries: data,
655
- meta
656
- })
657
- }]
752
+ content: [
753
+ {
754
+ type: "text",
755
+ text: formatAsJson({
756
+ assetId: input.assetId,
757
+ dateRange: { start: startDate, end: endDate },
758
+ granularity,
759
+ dimension: input.dimension || null,
760
+ metrics: Object.keys(data).map((name) => ({
761
+ name,
762
+ displayName: info[name]?.displayName || name,
763
+ type: info[name]?.type || "count",
764
+ summary: summaries[name],
765
+ change: changes[name] || null
766
+ })),
767
+ timeseries: data,
768
+ meta
769
+ })
770
+ }
771
+ ]
658
772
  };
659
773
  } catch (error) {
660
- return { content: [{ type: "text", text: formatError(error) }], isError: true };
774
+ return {
775
+ content: [{ type: "text", text: formatError(error) }],
776
+ isError: true
777
+ };
661
778
  }
662
779
  }
663
780
  async function discoverDimensions(input, client) {
@@ -667,15 +784,17 @@ async function discoverDimensions(input, client) {
667
784
  `/api/assets/${input.assetId}/metrics/dimensions/${input.dimension}/values`
668
785
  );
669
786
  return {
670
- content: [{
671
- type: "text",
672
- text: formatAsJson({
673
- assetId: input.assetId,
674
- dimension: input.dimension,
675
- displayName: DIMENSION_INFO[input.dimension] || input.dimension,
676
- values: response2.data ?? response2
677
- })
678
- }]
787
+ content: [
788
+ {
789
+ type: "text",
790
+ text: formatAsJson({
791
+ assetId: input.assetId,
792
+ dimension: input.dimension,
793
+ displayName: DIMENSION_INFO[input.dimension] || input.dimension,
794
+ values: response2.data ?? response2
795
+ })
796
+ }
797
+ ]
679
798
  };
680
799
  }
681
800
  const response = await client.get(`/api/assets/${input.assetId}/metrics/dimensions`);
@@ -688,17 +807,22 @@ async function discoverDimensions(input, client) {
688
807
  return { name: id, displayName: dim.label ?? DIMENSION_INFO[id] ?? id };
689
808
  });
690
809
  return {
691
- content: [{
692
- type: "text",
693
- text: formatAsJson({
694
- assetId: input.assetId,
695
- dimensions: enriched,
696
- tip: 'Use dimension name in get_metrics "dimension" param. Use discover_dimensions with a specific dimension to see available values.'
697
- })
698
- }]
810
+ content: [
811
+ {
812
+ type: "text",
813
+ text: formatAsJson({
814
+ assetId: input.assetId,
815
+ dimensions: enriched,
816
+ tip: 'Use dimension name in get_metrics "dimension" param. Use discover_dimensions with a specific dimension to see available values.'
817
+ })
818
+ }
819
+ ]
699
820
  };
700
821
  } catch (error) {
701
- return { content: [{ type: "text", text: formatError(error) }], isError: true };
822
+ return {
823
+ content: [{ type: "text", text: formatError(error) }],
824
+ isError: true
825
+ };
702
826
  }
703
827
  }
704
828
 
@@ -707,25 +831,10 @@ import { z as z4 } from "zod";
707
831
  function asRecord(value) {
708
832
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
709
833
  }
710
- var AGENT_TYPES = [
711
- "review",
712
- "monitoring",
713
- "forecasting",
714
- "growth",
715
- "aso",
716
- "ads",
717
- "product",
718
- "submission_review"
719
- ];
834
+ var AGENT_TYPES = ["review", "aso"];
720
835
  var AGENT_DESCRIPTIONS = {
721
836
  review: "AI-powered review management \u2014 drafts and sends replies to app store reviews",
722
- monitoring: "Anomaly detection \u2014 monitors metrics for unusual changes in downloads, revenue, etc.",
723
- forecasting: "Revenue and metric forecasting \u2014 generates forward-looking projections",
724
- growth: "Growth audit \u2014 analyzes app performance and provides growth scoring",
725
- aso: "App Store Optimization \u2014 listing optimization suggestions for better visibility",
726
- ads: "Ad campaign analysis \u2014 performance tracking and optimization recommendations",
727
- product: "Product agent \u2014 automated app installation testing via BrowserStack",
728
- submission_review: "Submission review \u2014 GitHub-based review workflow for app submissions"
837
+ aso: "App Store Optimization \u2014 listing optimization suggestions for better visibility"
729
838
  };
730
839
  var listAgentsSchema = z4.object({});
731
840
  var getAgentDetailsSchema = z4.object({
@@ -738,23 +847,25 @@ var getAgentRunHistorySchema = z4.object({
738
847
  limit: z4.number().int().min(1).max(100).default(20).describe("Maximum number of runs to return")
739
848
  });
740
849
  var triggerAgentRunSchema = z4.object({
741
- agentId: z4.string().describe("The agent ID to trigger a run for"),
850
+ agentId: z4.string().describe("The agent ID to trigger a run for (the `id` from list_agents)"),
742
851
  assetId: z4.string().uuid().optional().describe("Optional app UUID to run the agent against")
743
852
  });
744
853
  var pauseAgentSchema = z4.object({
745
- agentId: z4.string().describe("The agent ID to pause")
854
+ agentId: z4.string().describe("The agent ID to pause (the `id` from list_agents)")
746
855
  });
747
856
  var resumeAgentSchema = z4.object({
748
- agentId: z4.string().describe("The agent ID to resume")
857
+ agentId: z4.string().describe("The agent ID to resume (the `id` from list_agents)")
749
858
  });
750
859
  var getAgentActivitySchema = z4.object({
751
- agentId: z4.string().describe("The agent ID to get activity for")
860
+ agentId: z4.string().describe("The agent ID to get activity for (the `id` from list_agents)")
752
861
  });
753
862
  async function listAgents(_input, client) {
754
863
  try {
755
864
  let apiAgents = null;
756
865
  try {
757
- const response = await client.get("/api/agents");
866
+ const response = await client.get(
867
+ "/api/agents"
868
+ );
758
869
  apiAgents = Array.isArray(response) ? response : response.data ?? response.agents ?? null;
759
870
  } catch {
760
871
  }
@@ -803,8 +914,7 @@ async function getAgentDetails(input, client) {
803
914
  try {
804
915
  try {
805
916
  const params = {};
806
- if (input.assetId)
807
- params.assetId = input.assetId;
917
+ if (input.assetId) params.assetId = input.assetId;
808
918
  const response2 = await client.get(`/api/agents/by-type/${input.agentType}`, params);
809
919
  if (response2.agent) {
810
920
  return {
@@ -851,8 +961,7 @@ async function getAgentRunHistory(input, client) {
851
961
  let agentId;
852
962
  try {
853
963
  const byTypeParams = {};
854
- if (input.assetId)
855
- byTypeParams.assetId = input.assetId;
964
+ if (input.assetId) byTypeParams.assetId = input.assetId;
856
965
  const byType = await client.get(
857
966
  `/api/agents/by-type/${input.agentType}`,
858
967
  byTypeParams
@@ -1005,188 +1114,23 @@ async function getAgentActivity(input, client) {
1005
1114
  }
1006
1115
  }
1007
1116
 
1008
- // src/tools/anomalies.ts
1009
- import { z as z5 } from "zod";
1010
- var getAnomaliesSchema = z5.object({
1011
- assetId: z5.string().uuid().optional().describe("Filter anomalies by app UUID"),
1012
- severity: z5.enum(["low", "medium", "high", "critical"]).optional().describe("Filter by severity level"),
1013
- type: z5.enum(["surge", "decline"]).optional().describe("Filter by anomaly type"),
1014
- status: z5.enum(["new", "viewed", "acknowledged", "dismissed"]).optional().describe("Filter by status"),
1015
- metricName: z5.string().optional().describe('Filter by metric name (e.g., "proceeds", "units")'),
1016
- fromDate: z5.string().optional().describe("Filter anomalies from this date (YYYY-MM-DD)"),
1017
- toDate: z5.string().optional().describe("Filter anomalies until this date (YYYY-MM-DD)"),
1018
- excludeDismissed: z5.boolean().default(true).describe("Exclude dismissed anomalies (default: true)"),
1019
- limit: z5.number().int().min(1).max(100).default(50).describe("Maximum number of anomalies to return")
1020
- });
1021
- var getAnomalyDetailSchema = z5.object({
1022
- id: z5.string().uuid().describe("The anomaly UUID to get details for")
1023
- });
1024
- var acknowledgeAnomalySchema = z5.object({
1025
- id: z5.string().uuid().describe("The anomaly UUID to acknowledge")
1026
- });
1027
- var dismissAnomalySchema = z5.object({
1028
- id: z5.string().uuid().describe("The anomaly UUID to dismiss")
1029
- });
1030
- async function getAnomalies(input, client) {
1031
- try {
1032
- const params = {
1033
- limit: input.limit
1034
- };
1035
- if (input.assetId)
1036
- params.assetId = input.assetId;
1037
- if (input.severity)
1038
- params.severity = input.severity;
1039
- if (input.type)
1040
- params.type = input.type;
1041
- if (input.status)
1042
- params.status = input.status;
1043
- if (input.metricName)
1044
- params.metricName = input.metricName;
1045
- if (input.fromDate)
1046
- params.fromDate = input.fromDate;
1047
- if (input.toDate)
1048
- params.toDate = input.toDate;
1049
- const response = await client.get(
1050
- "/api/anomalies",
1051
- params
1052
- );
1053
- let anomalies = response.data ?? response.anomalies ?? [];
1054
- if (input.excludeDismissed && !input.status) {
1055
- anomalies = anomalies.filter((a) => a.status !== "dismissed");
1056
- }
1057
- return {
1058
- content: [
1059
- {
1060
- type: "text",
1061
- text: formatAsJson({
1062
- total: anomalies.length,
1063
- anomalies: anomalies.map((anomaly) => ({
1064
- id: anomaly.id,
1065
- assetId: anomaly.assetId,
1066
- assetName: anomaly.assetName,
1067
- assetIcon: anomaly.assetIcon,
1068
- anomalyDate: anomaly.anomalyDate,
1069
- metricName: anomaly.metricName,
1070
- sourceType: anomaly.sourceType,
1071
- type: anomaly.type,
1072
- severity: anomaly.severity,
1073
- actualValue: parseFloat(String(anomaly.actualValue || "0")),
1074
- expectedValue: parseFloat(String(anomaly.expectedValue || "0")),
1075
- deviationPercent: parseFloat(
1076
- String(anomaly.deviationPercent || "0")
1077
- ),
1078
- confidence: parseFloat(String(anomaly.confidence || "0")),
1079
- explanation: anomaly.explanation,
1080
- suggestedActions: anomaly.suggestedActions,
1081
- status: anomaly.status,
1082
- detectedAt: anomaly.detectedAt
1083
- }))
1084
- })
1085
- }
1086
- ]
1087
- };
1088
- } catch (error) {
1089
- return {
1090
- content: [
1091
- {
1092
- type: "text",
1093
- text: formatError(error)
1094
- }
1095
- ],
1096
- isError: true
1097
- };
1098
- }
1099
- }
1100
- async function getAnomalyDetail(input, client) {
1101
- try {
1102
- const response = await client.get(`/api/anomalies/${input.id}`);
1103
- return {
1104
- content: [
1105
- {
1106
- type: "text",
1107
- text: formatAsJson(response)
1108
- }
1109
- ]
1110
- };
1111
- } catch (error) {
1112
- return {
1113
- content: [
1114
- {
1115
- type: "text",
1116
- text: formatError(error)
1117
- }
1118
- ],
1119
- isError: true
1120
- };
1121
- }
1122
- }
1123
- async function acknowledgeAnomaly(input, client) {
1124
- try {
1125
- const response = await client.patch(`/api/anomalies/${input.id}/acknowledge`);
1126
- return {
1127
- content: [
1128
- {
1129
- type: "text",
1130
- text: formatAsJson(response)
1131
- }
1132
- ]
1133
- };
1134
- } catch (error) {
1135
- return {
1136
- content: [
1137
- {
1138
- type: "text",
1139
- text: formatError(error)
1140
- }
1141
- ],
1142
- isError: true
1143
- };
1144
- }
1145
- }
1146
- async function dismissAnomaly(input, client) {
1147
- try {
1148
- const response = await client.patch(`/api/anomalies/${input.id}/dismiss`);
1149
- return {
1150
- content: [
1151
- {
1152
- type: "text",
1153
- text: formatAsJson(response)
1154
- }
1155
- ]
1156
- };
1157
- } catch (error) {
1158
- return {
1159
- content: [
1160
- {
1161
- type: "text",
1162
- text: formatError(error)
1163
- }
1164
- ],
1165
- isError: true
1166
- };
1167
- }
1168
- }
1169
-
1170
1117
  // src/tools/ads.ts
1171
- import { z as z6 } from "zod";
1172
- var getAdsPerformanceSchema = z6.object({
1173
- assetId: z6.string().uuid().optional().describe("Filter by app UUID"),
1174
- platform: z6.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
1175
- fromDate: z6.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
1176
- toDate: z6.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
1177
- limit: z6.number().int().min(1).max(100).default(50).describe("Maximum number of campaigns to return")
1118
+ import { z as z5 } from "zod";
1119
+ var getAdsPerformanceSchema = z5.object({
1120
+ assetId: z5.string().uuid().optional().describe("Filter by app UUID"),
1121
+ platform: z5.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
1122
+ fromDate: z5.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
1123
+ toDate: z5.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
1124
+ limit: z5.number().int().min(1).max(100).default(50).describe("Maximum number of campaigns to return")
1178
1125
  });
1179
1126
  async function getAdsPerformance(input, client) {
1180
1127
  try {
1181
1128
  const params = {};
1182
- if (input.assetId)
1183
- params.assetId = input.assetId;
1184
- if (input.fromDate)
1185
- params.from = input.fromDate;
1186
- if (input.toDate)
1187
- params.to = input.toDate;
1129
+ if (input.assetId) params.assetId = input.assetId;
1130
+ if (input.fromDate) params.from = input.fromDate;
1131
+ if (input.toDate) params.to = input.toDate;
1188
1132
  const response = await client.get(
1189
- "/api/ads-agent/campaigns",
1133
+ "/api/ads/campaigns",
1190
1134
  params
1191
1135
  );
1192
1136
  let campaigns = response.data ?? response.campaigns ?? [];
@@ -1200,6 +1144,12 @@ async function getAdsPerformance(input, client) {
1200
1144
  type: "text",
1201
1145
  text: formatAsJson({
1202
1146
  total: campaigns.length,
1147
+ // The server couldn't read the metrics: null spend is unknown,
1148
+ // never "no spend".
1149
+ ...response.metricsUnavailable ? {
1150
+ metricsUnavailable: true,
1151
+ note: "The ads metrics could not be read right now, so spend, impressions, taps and installs are unknown (null), not zero. Try again later."
1152
+ } : {},
1203
1153
  campaigns: campaigns.map((campaign) => ({
1204
1154
  id: campaign.id,
1205
1155
  assetId: campaign.assetId,
@@ -1236,114 +1186,19 @@ async function getAdsPerformance(input, client) {
1236
1186
  }
1237
1187
  }
1238
1188
 
1239
- // src/tools/growth.ts
1240
- import { z as z7 } from "zod";
1241
- var getGrowthAuditSchema = z7.object({
1242
- assetId: z7.string().uuid().describe("App UUID to audit")
1243
- });
1244
- var getGrowthScoreSchema = z7.object({
1245
- assetId: z7.string().uuid().describe("App UUID to score")
1246
- });
1247
- async function getGrowthAudit(input, client) {
1248
- try {
1249
- const response = await client.get(`/api/growth/audit/${input.assetId}`);
1250
- return {
1251
- content: [
1252
- {
1253
- type: "text",
1254
- text: formatAsJson(response.data || response)
1255
- }
1256
- ]
1257
- };
1258
- } catch (error) {
1259
- return {
1260
- content: [
1261
- {
1262
- type: "text",
1263
- text: formatError(error)
1264
- }
1265
- ],
1266
- isError: true
1267
- };
1268
- }
1269
- }
1270
- async function getGrowthScore(input, client) {
1271
- try {
1272
- const response = await client.get(`/api/growth/score/${input.assetId}`);
1273
- return {
1274
- content: [
1275
- {
1276
- type: "text",
1277
- text: formatAsJson(response.data || response)
1278
- }
1279
- ]
1280
- };
1281
- } catch (error) {
1282
- return {
1283
- content: [
1284
- {
1285
- type: "text",
1286
- text: formatError(error)
1287
- }
1288
- ],
1289
- isError: true
1290
- };
1291
- }
1292
- }
1293
-
1294
- // src/tools/forecasting.ts
1295
- import { z as z8 } from "zod";
1296
- var getForecastsSchema = z8.object({
1297
- assetId: z8.string().uuid().describe("App UUID to get forecasts for"),
1298
- metric: z8.enum(["proceeds", "total_revenue", "total_downloads", "active_subs", "new_trials"]).describe("The metric to forecast"),
1299
- forecastWeeks: z8.number().int().min(4).max(156).optional().describe("Weeks to forecast forward (default 104)"),
1300
- historicalWeeks: z8.number().int().min(12).max(156).optional().describe("Weeks of history to base the forecast on (default 104)")
1301
- });
1302
- async function getForecasts(input, client) {
1303
- try {
1304
- const response = await client.get("/api/forecasting/forecast", {
1305
- assetId: input.assetId,
1306
- metricName: input.metric,
1307
- forecastWeeks: input.forecastWeeks,
1308
- historicalWeeks: input.historicalWeeks
1309
- });
1310
- return {
1311
- content: [
1312
- {
1313
- type: "text",
1314
- text: formatAsJson(response.data || response)
1315
- }
1316
- ]
1317
- };
1318
- } catch (error) {
1319
- return {
1320
- content: [
1321
- {
1322
- type: "text",
1323
- text: formatError(error)
1324
- }
1325
- ],
1326
- isError: true
1327
- };
1328
- }
1329
- }
1330
-
1331
1189
  // src/tools/dashboard.ts
1332
- import { z as z9 } from "zod";
1190
+ import { z as z6 } from "zod";
1333
1191
  function parseDashboardNumber(value) {
1334
- if (value === null || value === void 0 || value === "")
1335
- return null;
1192
+ if (value === null || value === void 0 || value === "") return null;
1336
1193
  const parsed = typeof value === "number" ? value : Number.parseFloat(value);
1337
1194
  return Number.isFinite(parsed) ? parsed : null;
1338
1195
  }
1339
1196
  function getSidebarAssets(response) {
1340
- if (!response)
1341
- return [];
1342
- if (Array.isArray(response))
1343
- return response;
1197
+ if (!response) return [];
1198
+ if (Array.isArray(response)) return response;
1344
1199
  return response.data ?? [];
1345
1200
  }
1346
- var getDashboardOverviewSchema = z9.object({});
1201
+ var getDashboardOverviewSchema = z6.object({});
1347
1202
  async function getDashboardOverview(_input, client) {
1348
1203
  try {
1349
1204
  const overviewPromise = client.get("/api/dashboard/overview-metrics").catch(() => null);
@@ -1398,152 +1253,224 @@ async function getDashboardOverview(_input, client) {
1398
1253
  }
1399
1254
 
1400
1255
  // src/tools/actions.ts
1401
- import { z as z10 } from "zod";
1402
- function asRecord2(value) {
1403
- return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1404
- }
1405
- var listPendingActionsSchema = z10.object({
1406
- assetId: z10.string().uuid().optional().describe("Filter by app UUID"),
1407
- limit: z10.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
1256
+ import { randomUUID } from "node:crypto";
1257
+ import { z as z7 } from "zod";
1258
+ var listPendingActionsSchema = z7.object({
1259
+ assetId: z7.string().uuid().optional().describe("Filter by app UUID"),
1260
+ view: z7.enum(["open", "queued"]).default("open").describe(
1261
+ "open (default): items waiting on the user. queued: approved work Fload is sending or checking in the store (an item being checked offers check_now)."
1262
+ ),
1263
+ limit: z7.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
1408
1264
  });
1409
- var approveActionSchema = z10.object({
1410
- actionId: z10.string().describe("The pending action ID to approve")
1265
+ var approveActionSchema = z7.object({
1266
+ actionId: z7.string().describe("The inbox item ID to approve (from list_pending_actions)")
1411
1267
  });
1412
- var rejectActionSchema = z10.object({
1413
- actionId: z10.string().describe("The draft reply ID to reject/delete")
1268
+ var rejectActionSchema = z7.object({
1269
+ actionId: z7.string().describe("The inbox item ID to reject (from list_pending_actions)"),
1270
+ reason: z7.string().trim().min(1).max(1e3).optional().describe(
1271
+ "Why, in the user's words. Kept with the rejection so the agents do not propose the same thing again."
1272
+ )
1414
1273
  });
1274
+ var checkActionNowSchema = z7.object({
1275
+ actionId: z7.string().describe(
1276
+ 'The inbox item ID to check now (from list_pending_actions with view "queued", or an approve_action result; its commands include check_now)'
1277
+ )
1278
+ });
1279
+ function commandFor(kind, intent) {
1280
+ if (kind === "notice")
1281
+ return intent === "approve" ? "acknowledge" : "dismiss";
1282
+ return intent;
1283
+ }
1284
+ function toolText(payload, isError = false) {
1285
+ return {
1286
+ content: [{ type: "text", text: formatAsJson(payload) }],
1287
+ ...isError ? { isError: true } : {}
1288
+ };
1289
+ }
1290
+ function toolError(error) {
1291
+ return {
1292
+ content: [{ type: "text", text: formatError(error) }],
1293
+ isError: true
1294
+ };
1295
+ }
1415
1296
  async function listPendingActions(input, client) {
1416
1297
  try {
1417
- const params = {
1418
- limit: input.limit
1419
- };
1420
1298
  const response = await client.get(
1421
- "/api/pending-actions",
1422
- params
1299
+ "/api/actions/items",
1300
+ { view: input.view ?? "open", assetId: input.assetId, limit: input.limit }
1423
1301
  );
1424
- let actions = response.data ?? response.actions ?? [];
1425
- if (input.assetId) {
1426
- actions = actions.filter(
1427
- (action) => action.assetId === input.assetId
1428
- );
1429
- }
1430
- return {
1431
- content: [
1432
- {
1433
- type: "text",
1434
- text: formatAsJson({
1435
- total: actions.length,
1436
- actions
1437
- })
1438
- }
1439
- ]
1440
- };
1302
+ const actions = response.items ?? [];
1303
+ return toolText({
1304
+ total: actions.length,
1305
+ actions,
1306
+ hasMore: Boolean(response.nextCursor)
1307
+ });
1441
1308
  } catch (error) {
1442
- return {
1443
- content: [
1444
- {
1445
- type: "text",
1446
- text: formatError(error)
1309
+ return toolError(error);
1310
+ }
1311
+ }
1312
+ async function commandItem(client, itemId, intent, reason) {
1313
+ const detail = await client.get(
1314
+ `/api/actions/items/${encodeURIComponent(itemId)}`
1315
+ );
1316
+ const item = detail.item;
1317
+ if (!item) throw new Error("Action not found");
1318
+ const command = commandFor(item.kind, intent);
1319
+ const answer = await client.postForAnswer(
1320
+ "/api/actions/commands",
1321
+ {
1322
+ command,
1323
+ idempotencyKey: `mcp:${command}:${item.id}:${randomUUID()}`,
1324
+ targets: [
1325
+ {
1326
+ itemId: item.id,
1327
+ ...command === "approve" && item.currentRevisionId ? { revisionId: item.currentRevisionId } : {}
1447
1328
  }
1448
1329
  ],
1449
- isError: true
1450
- };
1451
- }
1330
+ ...command === "reject" && reason ? { reason } : {}
1331
+ }
1332
+ );
1333
+ const result = answer.body?.results?.[0];
1334
+ if (!result)
1335
+ throw new Error(
1336
+ answer.ok ? "Fload returned no result for the command." : "Fload rejected the request. Please check access and try again."
1337
+ );
1338
+ return {
1339
+ command,
1340
+ result: {
1341
+ ...result,
1342
+ error: result.error ? publicMcpErrorMessage(
1343
+ result.error,
1344
+ "Fload could not apply this change."
1345
+ ) : void 0
1346
+ }
1347
+ };
1452
1348
  }
1453
1349
  async function approveAction(input, client) {
1454
1350
  try {
1455
- const response = await client.post(
1456
- `/api/pending-actions/${input.actionId}/approve`,
1457
- {}
1351
+ const { command, result } = await commandItem(
1352
+ client,
1353
+ input.actionId,
1354
+ "approve"
1355
+ );
1356
+ const applied = result?.result === "applied" || result?.result === "replayed";
1357
+ return toolText(
1358
+ {
1359
+ success: applied,
1360
+ actionId: input.actionId,
1361
+ command,
1362
+ result: result?.result ?? "unknown",
1363
+ ...result?.error ? { error: result.error } : {},
1364
+ message: applied ? command === "acknowledge" ? "Acknowledged." : "Approved. Fload delivers it after a short undo window; the inbox shows where it is." : result?.error ?? "The approval could not be recorded.",
1365
+ item: result?.item
1366
+ },
1367
+ !applied
1458
1368
  );
1459
- return {
1460
- content: [
1461
- {
1462
- type: "text",
1463
- text: formatAsJson({
1464
- success: true,
1465
- actionId: input.actionId,
1466
- status: "approved",
1467
- message: "Reply has been approved and queued for sending",
1468
- ...asRecord2(response.data)
1469
- })
1470
- }
1471
- ]
1472
- };
1473
1369
  } catch (error) {
1474
- return {
1475
- content: [
1476
- {
1477
- type: "text",
1478
- text: formatError(error)
1479
- }
1480
- ],
1481
- isError: true
1482
- };
1370
+ return toolError(error);
1483
1371
  }
1484
1372
  }
1485
1373
  async function rejectAction(input, client) {
1486
1374
  try {
1487
- const response = await client.post(
1488
- `/api/pending-actions/${input.actionId}/reject`
1375
+ const { command, result } = await commandItem(
1376
+ client,
1377
+ input.actionId,
1378
+ "reject",
1379
+ input.reason
1380
+ );
1381
+ const applied = result?.result === "applied" || result?.result === "replayed";
1382
+ return toolText(
1383
+ {
1384
+ success: applied,
1385
+ actionId: input.actionId,
1386
+ command,
1387
+ result: result?.result ?? "unknown",
1388
+ ...result?.error ? { error: result.error } : {},
1389
+ message: applied ? command === "dismiss" ? "Dismissed." : "Rejected. Nothing was sent." : result?.error ?? "The rejection could not be recorded.",
1390
+ item: result?.item
1391
+ },
1392
+ !applied
1489
1393
  );
1490
- return {
1491
- content: [
1492
- {
1493
- type: "text",
1494
- text: formatAsJson({
1495
- success: true,
1496
- actionId: input.actionId,
1497
- status: "rejected",
1498
- message: "Draft reply has been rejected and removed",
1499
- ...asRecord2(response.data)
1500
- })
1501
- }
1502
- ]
1503
- };
1504
1394
  } catch (error) {
1505
- return {
1506
- content: [
1507
- {
1508
- type: "text",
1509
- text: formatError(error)
1510
- }
1511
- ],
1512
- isError: true
1513
- };
1395
+ return toolError(error);
1396
+ }
1397
+ }
1398
+ async function checkActionNow(input, client) {
1399
+ try {
1400
+ const answer = await client.postForAnswer(
1401
+ "/api/actions/commands",
1402
+ {
1403
+ command: "check_now",
1404
+ idempotencyKey: `mcp:check_now:${input.actionId}:${randomUUID()}`,
1405
+ targets: [{ itemId: input.actionId }]
1406
+ }
1407
+ );
1408
+ const result = answer.body?.results?.[0];
1409
+ const applied = result?.result === "applied" || result?.result === "replayed";
1410
+ const error = result?.error ? publicMcpErrorMessage(result.error, "Fload could not check it now.") : void 0;
1411
+ return toolText(
1412
+ {
1413
+ success: applied,
1414
+ actionId: input.actionId,
1415
+ command: "check_now",
1416
+ result: result?.result ?? "unknown",
1417
+ ...error ? { error } : {},
1418
+ message: applied ? "Fload is checking the store now; the item updates as soon as the store shows the change." : error ?? (answer.ok ? "Fload returned no result for the command." : "Fload rejected the request. Please check access and try again."),
1419
+ item: result?.item
1420
+ },
1421
+ !applied
1422
+ );
1423
+ } catch (error) {
1424
+ return toolError(error);
1514
1425
  }
1515
1426
  }
1516
1427
 
1517
1428
  // src/tools/aso.ts
1518
- import { z as z11 } from "zod";
1519
- var getAsoSummarySchema = z11.object({
1520
- assetId: z11.string().uuid().describe("App UUID to get ASO summary for")
1429
+ import { z as z8 } from "zod";
1430
+ var getAsoSummarySchema = z8.object({
1431
+ assetId: z8.string().uuid().describe("App UUID to get ASO summary for")
1521
1432
  });
1522
- var getAsoRecommendationsSchema = z11.object({
1523
- assetId: z11.string().uuid().describe("App UUID to get ASO recommendations for")
1433
+ var getAsoRecommendationsSchema = z8.object({
1434
+ assetId: z8.string().uuid().describe("App UUID to get ASO recommendations for")
1524
1435
  });
1525
- var getAsoKeywordsSchema = z11.object({
1526
- assetId: z11.string().uuid().describe("App UUID to get keyword intelligence for"),
1527
- locale: z11.string().optional().describe('Locale code to filter keywords (e.g., "en-US", "de-DE"). Returns all locales if omitted.')
1436
+ var getAsoKeywordsSchema = z8.object({
1437
+ assetId: z8.string().uuid().describe("App UUID to get keyword intelligence for"),
1438
+ locale: z8.string().optional().describe(
1439
+ 'Locale code to filter keywords (e.g., "en-US", "de-DE"). Returns all locales if omitted.'
1440
+ )
1528
1441
  });
1529
- var getAsoExperimentsSchema = z11.object({
1530
- assetId: z11.string().uuid().describe("App UUID to list ASO experiments for"),
1531
- status: z11.enum(["proposed", "approved", "applied", "measuring", "completed", "reverted"]).optional().describe("Filter experiments by status"),
1532
- limit: z11.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1533
- cursor: z11.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
1442
+ var getAsoExperimentsSchema = z8.object({
1443
+ assetId: z8.string().uuid().describe("App UUID to list ASO experiments for"),
1444
+ status: z8.enum([
1445
+ "proposed",
1446
+ "approved",
1447
+ "applied",
1448
+ "measuring",
1449
+ "completed",
1450
+ "reverted"
1451
+ ]).optional().describe("Filter experiments by status"),
1452
+ limit: z8.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1453
+ cursor: z8.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
1534
1454
  });
1535
- var getAsoLocaleSnapshotsSchema = z11.object({
1536
- assetId: z11.string().uuid().describe("App UUID to get locale snapshots for"),
1537
- store: z11.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1538
- locale: z11.string().optional().describe('Filter to a single locale (e.g. "en-US"). Returns all locales if omitted.'),
1539
- limit: z11.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1455
+ var getAsoLocaleSnapshotsSchema = z8.object({
1456
+ assetId: z8.string().uuid().describe("App UUID to get locale snapshots for"),
1457
+ store: z8.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1458
+ locale: z8.string().optional().describe(
1459
+ 'Filter to a single locale (e.g. "en-US"). Returns all locales if omitted.'
1460
+ ),
1461
+ view: z8.enum(["latest", "history"]).default("latest").describe(
1462
+ '"latest" (default) = newest snapshot per (locale, type); "history" = raw revisions newest first'
1463
+ ),
1464
+ limit: z8.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1540
1465
  });
1541
- var triggerAsoAnalysisSchema = z11.object({
1542
- assetId: z11.string().uuid().describe("App UUID to trigger ASO analysis for")
1466
+ var triggerAsoAnalysisSchema = z8.object({
1467
+ assetId: z8.string().uuid().describe("App UUID to trigger ASO analysis for")
1543
1468
  });
1544
1469
  async function getAsoSummary(input, client) {
1545
1470
  try {
1546
- const response = await client.get(`/api/assets/${input.assetId}/aso/summary`);
1471
+ const response = await client.get(
1472
+ `/api/assets/${input.assetId}/aso/summary`
1473
+ );
1547
1474
  return {
1548
1475
  content: [
1549
1476
  {
@@ -1566,7 +1493,9 @@ async function getAsoSummary(input, client) {
1566
1493
  }
1567
1494
  async function getAsoRecommendations(input, client) {
1568
1495
  try {
1569
- const response = await client.get(`/api/assets/${input.assetId}/aso/recommendations`);
1496
+ const response = await client.get(
1497
+ `/api/assets/${input.assetId}/aso/recommendations`
1498
+ );
1570
1499
  return {
1571
1500
  content: [
1572
1501
  {
@@ -1590,9 +1519,11 @@ async function getAsoRecommendations(input, client) {
1590
1519
  async function getAsoKeywords(input, client) {
1591
1520
  try {
1592
1521
  const params = {};
1593
- if (input.locale)
1594
- params.locale = input.locale;
1595
- const response = await client.get(`/api/assets/${input.assetId}/aso/keyword-intelligence`, params);
1522
+ if (input.locale) params.locale = input.locale;
1523
+ const response = await client.get(
1524
+ `/api/assets/${input.assetId}/aso/keyword-intelligence`,
1525
+ params
1526
+ );
1596
1527
  return {
1597
1528
  content: [
1598
1529
  {
@@ -1619,9 +1550,11 @@ async function getAsoExperiments(input, client) {
1619
1550
  limit: input.limit,
1620
1551
  cursor: input.cursor
1621
1552
  };
1622
- if (input.status)
1623
- params.status = input.status;
1624
- const response = await client.get(`/api/assets/${input.assetId}/aso/experiments`, params);
1553
+ if (input.status) params.status = input.status;
1554
+ const response = await client.get(
1555
+ `/api/assets/${input.assetId}/aso/experiments`,
1556
+ params
1557
+ );
1625
1558
  return {
1626
1559
  content: [
1627
1560
  {
@@ -1649,6 +1582,7 @@ async function getAsoLocaleSnapshots(input, client) {
1649
1582
  {
1650
1583
  store: input.store,
1651
1584
  locale: input.locale,
1585
+ view: input.view,
1652
1586
  limit: input.limit
1653
1587
  }
1654
1588
  );
@@ -1698,20 +1632,40 @@ async function triggerAsoAnalysis(input, client) {
1698
1632
  };
1699
1633
  }
1700
1634
  }
1635
+ var getAsoEvidenceSchema = z8.object({ assetId: z8.string().uuid() });
1636
+ async function getAsoEvidence(input, client) {
1637
+ try {
1638
+ const response = await client.get(
1639
+ `/api/assets/${input.assetId}/aso/methodology`
1640
+ );
1641
+ return {
1642
+ content: [{ type: "text", text: formatAsJson(response) }]
1643
+ };
1644
+ } catch (error) {
1645
+ return {
1646
+ content: [{ type: "text", text: formatError(error) }],
1647
+ isError: true
1648
+ };
1649
+ }
1650
+ }
1701
1651
 
1702
1652
  // src/tools/chat.ts
1703
- import { randomUUID } from "node:crypto";
1704
- import { z as z12 } from "zod";
1705
- var listConversationsSchema = z12.object({
1706
- limit: z12.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
1653
+ import { randomUUID as randomUUID2 } from "node:crypto";
1654
+ import { z as z9 } from "zod";
1655
+ var listConversationsSchema = z9.object({
1656
+ limit: z9.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
1707
1657
  });
1708
- var getConversationMessagesSchema = z12.object({
1709
- conversationId: z12.string().uuid().describe("The conversation UUID to get messages for")
1658
+ var getConversationMessagesSchema = z9.object({
1659
+ conversationId: z9.string().uuid().describe("The conversation UUID to get messages for")
1710
1660
  });
1711
- var sendChatMessageSchema = z12.object({
1712
- message: z12.string().describe("The message to send to the AI chat"),
1713
- conversationId: z12.string().uuid().optional().describe("Existing conversation UUID to continue. Starts a new conversation if omitted."),
1714
- agentType: z12.string().optional().describe("Agent type to use for the conversation (e.g., review, monitoring, forecasting)")
1661
+ var sendChatMessageSchema = z9.object({
1662
+ message: z9.string().describe("The message to send to the AI chat"),
1663
+ conversationId: z9.string().uuid().optional().describe(
1664
+ "Existing conversation UUID to continue. Starts a new conversation if omitted."
1665
+ ),
1666
+ agentType: z9.string().optional().describe(
1667
+ "Agent type to use for the conversation (e.g., review, monitoring)"
1668
+ )
1715
1669
  });
1716
1670
  async function listConversations(input, client) {
1717
1671
  try {
@@ -1744,7 +1698,9 @@ async function listConversations(input, client) {
1744
1698
  }
1745
1699
  async function getConversationMessages(input, client) {
1746
1700
  try {
1747
- const response = await client.get(`/api/chat/messages/${input.conversationId}`);
1701
+ const response = await client.get(
1702
+ `/api/chat/messages/${input.conversationId}`
1703
+ );
1748
1704
  const messages = response.data || response.messages || response;
1749
1705
  return {
1750
1706
  content: [
@@ -1774,11 +1730,9 @@ function parseUiMessageStream(raw) {
1774
1730
  let reply = "";
1775
1731
  const toolsUsed = [];
1776
1732
  for (const line of raw.split("\n")) {
1777
- if (!line.startsWith("data:"))
1778
- continue;
1733
+ if (!line.startsWith("data:")) continue;
1779
1734
  const payload = line.slice(5).trim();
1780
- if (!payload || payload === "[DONE]")
1781
- continue;
1735
+ if (!payload || payload === "[DONE]") continue;
1782
1736
  try {
1783
1737
  const event = JSON.parse(payload);
1784
1738
  if (event.type === "text-delta") {
@@ -1793,7 +1747,7 @@ function parseUiMessageStream(raw) {
1793
1747
  }
1794
1748
  async function sendChatMessage(input, client) {
1795
1749
  try {
1796
- const conversationId = input.conversationId ?? randomUUID();
1750
+ const conversationId = input.conversationId ?? randomUUID2();
1797
1751
  let priorMessages = [];
1798
1752
  if (input.conversationId) {
1799
1753
  const history = await client.get(`/api/chat/messages/${input.conversationId}`, { limit: 1e3 });
@@ -1801,8 +1755,7 @@ async function sendChatMessage(input, client) {
1801
1755
  const textParts = (message.parts ?? []).filter(
1802
1756
  (part) => part.type === "text" && typeof part.text === "string"
1803
1757
  );
1804
- if (textParts.length === 0)
1805
- continue;
1758
+ if (textParts.length === 0) continue;
1806
1759
  priorMessages.push({
1807
1760
  id: message.id,
1808
1761
  role: message.role,
@@ -1816,7 +1769,7 @@ async function sendChatMessage(input, client) {
1816
1769
  messages: [
1817
1770
  ...priorMessages,
1818
1771
  {
1819
- id: randomUUID(),
1772
+ id: randomUUID2(),
1820
1773
  role: "user",
1821
1774
  parts: [{ type: "text", text: input.message }]
1822
1775
  }
@@ -1888,7 +1841,7 @@ function registerTools(server, client, options = {}) {
1888
1841
  {
1889
1842
  title,
1890
1843
  description,
1891
- inputSchema: schema.shape,
1844
+ inputSchema: schema,
1892
1845
  annotations: { title, ...annotations }
1893
1846
  },
1894
1847
  wrapTool(handler)
@@ -1945,7 +1898,7 @@ function registerTools(server, client, options = {}) {
1945
1898
  tool(
1946
1899
  "discover_metrics",
1947
1900
  "Discover available metrics",
1948
- "Discover what metrics are available for an app. Returns all available metrics organized by category (revenue, downloads, subscriptions, engagement, ads). Always call this first before querying metrics to know what data exists.",
1901
+ "Discover what metrics are available for an app. Returns all available metrics organized by category (revenue, downloads, subscriptions, engagement, ads). Use it before get_metrics when you don't yet know which metric names this app has data for.",
1949
1902
  discoverMetricsSchema,
1950
1903
  discoverMetrics,
1951
1904
  { readOnlyHint: true, openWorldHint: false }
@@ -1953,7 +1906,7 @@ function registerTools(server, client, options = {}) {
1953
1906
  tool(
1954
1907
  "get_metrics",
1955
1908
  "Get metrics",
1956
- "Query metric timeseries data for an app. Supports 30+ metrics (proceeds, totalDownloads, activeSubs, sessions, crashes, adSpend, etc.). Can query multiple metrics at once. Supports dimensional breakdowns (by country, platform, campaign). Use discover_metrics first to see available metrics.",
1909
+ "Query metric timeseries data for an app. Supports 30+ metrics (proceeds, totalDownloads, activeSubs, sessions, crashes, adSpend, adAvgCPA, etc.). Can query multiple metrics at once. Supports dimensional breakdowns (by country, platform, campaign). Each metric's summary.value is its value over the period, aggregated the right way for that metric: summed for flows like downloads, the latest value for levels like active subscriptions, and total over total for ratios like CPA. It covers summary.effectiveFromDate to summary.effectiveToDate: the requested days, less recent days whose data is not complete yet. Quote summary.value with that range rather than adding up the points. Use discover_metrics first to see available metrics.",
1957
1910
  getMetricsSchema,
1958
1911
  getMetrics,
1959
1912
  { readOnlyHint: true, openWorldHint: false }
@@ -1969,7 +1922,7 @@ function registerTools(server, client, options = {}) {
1969
1922
  tool(
1970
1923
  "list_agents",
1971
1924
  "List agents",
1972
- "List all available AI agents in the Fload platform with their current status. Returns agent types (review, monitoring, forecasting, growth, aso, ads, product, submission_review) and configuration status.",
1925
+ "List the AI agents activated in the user's organization, with their status. Each entry's `id` is the agentId that trigger_agent_run, pause_agent, resume_agent and get_agent_activity take. Only activated agents are listed; if an agent type is missing, it has not been activated for this organization (the user activates it from the Agents page in Fload). Entries without an `id` mean the live list could not be loaded.",
1973
1926
  listAgentsSchema,
1974
1927
  listAgents,
1975
1928
  { readOnlyHint: true, openWorldHint: false }
@@ -1977,7 +1930,7 @@ function registerTools(server, client, options = {}) {
1977
1930
  tool(
1978
1931
  "get_agent_details",
1979
1932
  "Get agent details",
1980
- "Get detailed configuration and status for a specific agent type. For the review agent, returns per-asset settings (mode, tone, custom instructions). For the product agent, returns latest run details.",
1933
+ "Get detailed configuration and status for a specific agent type. For the review agent, returns per-asset settings (mode, tone, custom instructions).",
1981
1934
  getAgentDetailsSchema,
1982
1935
  getAgentDetails,
1983
1936
  { readOnlyHint: true, openWorldHint: false }
@@ -1985,7 +1938,7 @@ function registerTools(server, client, options = {}) {
1985
1938
  tool(
1986
1939
  "get_agent_run_history",
1987
1940
  "Get agent run history",
1988
- "Get run history for a specific agent type. Currently available for the product agent (BrowserStack app installation runs). Returns run status, timing, and error details.",
1941
+ "Get run history for a specific agent type. Returns run status, timing, and error details.",
1989
1942
  getAgentRunHistorySchema,
1990
1943
  getAgentRunHistory,
1991
1944
  { readOnlyHint: true, openWorldHint: false }
@@ -1993,7 +1946,7 @@ function registerTools(server, client, options = {}) {
1993
1946
  tool(
1994
1947
  "trigger_agent_run",
1995
1948
  "Trigger agent run",
1996
- "Trigger a manual run for an agent. Optionally specify an asset (app) to run the agent against. Returns the triggered run details. Reversible in the sense that agent runs can be paused or dismissed.",
1949
+ "Trigger a manual run for an agent. Take the agentId from list_agents (the `id` of an activated agent). Optionally specify an asset (app) to run the agent against. Returns the triggered run details. Reversible in the sense that agent runs can be paused or dismissed.",
1997
1950
  triggerAgentRunSchema,
1998
1951
  triggerAgentRun,
1999
1952
  { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
@@ -2001,59 +1954,37 @@ function registerTools(server, client, options = {}) {
2001
1954
  tool(
2002
1955
  "pause_agent",
2003
1956
  "Pause agent",
2004
- "Pause a running agent. The agent will stop processing until resumed. Reversible via resume_agent.",
1957
+ "Pause a running agent. Take the agentId from list_agents (the `id` of an activated agent). The agent will stop processing until resumed. Reversible via resume_agent.",
2005
1958
  pauseAgentSchema,
2006
1959
  pauseAgent,
2007
- { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
1960
+ {
1961
+ readOnlyHint: false,
1962
+ destructiveHint: false,
1963
+ idempotentHint: true,
1964
+ openWorldHint: false
1965
+ }
2008
1966
  );
2009
1967
  tool(
2010
1968
  "resume_agent",
2011
1969
  "Resume agent",
2012
- "Resume a paused agent. The agent will continue processing from where it left off. Reversible via pause_agent.",
1970
+ "Resume a paused agent. Take the agentId from list_agents (the `id` of an activated agent). The agent will continue processing from where it left off. Reversible via pause_agent.",
2013
1971
  resumeAgentSchema,
2014
1972
  resumeAgent,
2015
- { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
1973
+ {
1974
+ readOnlyHint: false,
1975
+ destructiveHint: false,
1976
+ idempotentHint: true,
1977
+ openWorldHint: false
1978
+ }
2016
1979
  );
2017
1980
  tool(
2018
1981
  "get_agent_activity",
2019
1982
  "Get agent activity",
2020
- "Get the recent activity log for an agent. Returns a chronological list of actions the agent has taken, including timestamps, event types, and details.",
1983
+ "Get the recent activity log for an agent. Take the agentId from list_agents (the `id` of an activated agent). Returns a chronological list of actions the agent has taken, including timestamps, event types, and details.",
2021
1984
  getAgentActivitySchema,
2022
1985
  getAgentActivity,
2023
1986
  { readOnlyHint: true, openWorldHint: false }
2024
1987
  );
2025
- tool(
2026
- "get_anomalies",
2027
- "Get anomalies",
2028
- "Get detected anomalies (unusual metric changes) for your apps. Filter by app, severity (low/medium/high/critical), type (surge/decline), status, metric name, and date range. Returns actual vs expected values, deviation percentage, confidence, and suggested actions.",
2029
- getAnomaliesSchema,
2030
- getAnomalies,
2031
- { readOnlyHint: true, openWorldHint: false }
2032
- );
2033
- tool(
2034
- "get_anomaly_detail",
2035
- "Get anomaly detail",
2036
- "Get full detail for a single anomaly including chart data. Returns the anomaly metadata, actual vs expected values, and historical metric data points for visualization.",
2037
- getAnomalyDetailSchema,
2038
- getAnomalyDetail,
2039
- { readOnlyHint: true, openWorldHint: false }
2040
- );
2041
- tool(
2042
- "acknowledge_anomaly",
2043
- "Acknowledge anomaly",
2044
- 'Mark an anomaly as acknowledged. This updates the anomaly status from "new" to "acknowledged", indicating it has been reviewed but not dismissed. Reversible \u2014 anomaly can be reset or dismissed later.',
2045
- acknowledgeAnomalySchema,
2046
- acknowledgeAnomaly,
2047
- { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
2048
- );
2049
- tool(
2050
- "dismiss_anomaly",
2051
- "Dismiss anomaly",
2052
- 'Dismiss an anomaly. This updates the anomaly status to "dismissed", removing it from active alerts. Dismissed anomalies are excluded from queries by default. Soft state change \u2014 the anomaly row is preserved and can be un-dismissed later.',
2053
- dismissAnomalySchema,
2054
- dismissAnomaly,
2055
- { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
2056
- );
2057
1988
  tool(
2058
1989
  "get_ads_performance",
2059
1990
  "Get ads performance",
@@ -2062,34 +1993,10 @@ function registerTools(server, client, options = {}) {
2062
1993
  getAdsPerformance,
2063
1994
  { readOnlyHint: true, openWorldHint: false }
2064
1995
  );
2065
- tool(
2066
- "get_growth_audit",
2067
- "Get growth audit",
2068
- "Get a comprehensive growth audit for an app. Synthesizes data from review sentiment analysis, recent anomalies, valuation trends, and connector health into an actionable growth assessment.",
2069
- getGrowthAuditSchema,
2070
- getGrowthAudit,
2071
- { readOnlyHint: true, openWorldHint: false }
2072
- );
2073
- tool(
2074
- "get_growth_score",
2075
- "Get growth score",
2076
- "Get a calculated growth score (0-100) and grade (A-F) for an app. The score is based on app store rating, valuation trend, recent anomalies, review sentiment, and data connector health. Includes a breakdown of scoring factors.",
2077
- getGrowthScoreSchema,
2078
- getGrowthScore,
2079
- { readOnlyHint: true, openWorldHint: false }
2080
- );
2081
- tool(
2082
- "get_forecasts",
2083
- "Get forecasts",
2084
- "Get a statistical forecast for an app metric (proceeds, total_revenue, total_downloads, active_subs, or new_trials). Returns weekly historical values plus a forward projection with confidence bounds.",
2085
- getForecastsSchema,
2086
- getForecasts,
2087
- { readOnlyHint: true, openWorldHint: false }
2088
- );
2089
1996
  tool(
2090
1997
  "get_dashboard_overview",
2091
1998
  "Get dashboard overview",
2092
- "Get an aggregated dashboard overview for the organization. Returns portfolio summary (apps, valuations, ratings), data connector health status, and alerts (recent anomalies, pending review drafts).",
1999
+ "Get an aggregated dashboard overview for the organization. Returns portfolio summary (apps, valuations, ratings), data connector health status, and alerts (pending review drafts).",
2093
2000
  getDashboardOverviewSchema,
2094
2001
  getDashboardOverview,
2095
2002
  { readOnlyHint: true, openWorldHint: false }
@@ -2097,7 +2004,7 @@ function registerTools(server, client, options = {}) {
2097
2004
  tool(
2098
2005
  "list_pending_actions",
2099
2006
  "List pending actions",
2100
- "List pending actions awaiting approval. Currently shows AI-generated review draft replies that have not been sent yet. Includes the original review context and the drafted reply. Filter by app.",
2007
+ 'List the inbox items waiting on the user: agent proposals to approve (review replies, listing changes, Apple Search Ads changes, plans) and notices to act on. Each item carries its kind, title, status, inbox bucket, the app, and the commands it accepts. Filter by app. view "queued" lists approved work Fload is sending or checking in the store instead.',
2101
2008
  listPendingActionsSchema,
2102
2009
  listPendingActions,
2103
2010
  { readOnlyHint: true, openWorldHint: false }
@@ -2105,7 +2012,7 @@ function registerTools(server, client, options = {}) {
2105
2012
  tool(
2106
2013
  "approve_action",
2107
2014
  "Approve pending action",
2108
- "Approve a pending action (e.g., a review draft reply). Approving a review reply publishes it to the store \u2014 treat as destructive (publicly visible, cannot be silently undone). Optionally edit the reply text before approving.",
2015
+ "Approve an inbox item (actionId from list_pending_actions); a notice is acknowledged instead. Approving a review reply or a listing change publishes it to the store after a short undo window \u2014 treat as destructive (publicly visible, cannot be silently undone).",
2109
2016
  approveActionSchema,
2110
2017
  approveAction,
2111
2018
  { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
@@ -2113,11 +2020,19 @@ function registerTools(server, client, options = {}) {
2113
2020
  tool(
2114
2021
  "reject_action",
2115
2022
  "Reject pending action",
2116
- "Reject a pending action (e.g., delete a review draft reply). The draft will be permanently removed. Destructive \u2014 not recoverable without regenerating the draft.",
2023
+ "Reject an inbox item (actionId from list_pending_actions); a notice is dismissed instead. Nothing is sent to the store. Pass the user's reason when they gave one: it is kept with the rejection so the agents do not propose the same thing again.",
2117
2024
  rejectActionSchema,
2118
2025
  rejectAction,
2119
2026
  { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
2120
2027
  );
2028
+ tool(
2029
+ "check_action_now",
2030
+ "Check a change in the store now",
2031
+ 'For an inbox item Fload is reading back from the store (status verifying, its commands include check_now; list them with list_pending_actions view "queued"): read the store again now instead of at the next scheduled check. The item concludes as soon as the store shows the change. Nothing is written to the store. At most once every 30 seconds per item.',
2032
+ checkActionNowSchema,
2033
+ checkActionNow,
2034
+ { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
2035
+ );
2121
2036
  tool(
2122
2037
  "get_aso_summary",
2123
2038
  "Get ASO summary",
@@ -2134,6 +2049,14 @@ function registerTools(server, client, options = {}) {
2134
2049
  getAsoRecommendations,
2135
2050
  { readOnlyHint: true, openWorldHint: false }
2136
2051
  );
2052
+ tool(
2053
+ "get_aso_evidence",
2054
+ "Get ASO decisions and evidence",
2055
+ "Read ASO methodology assessments, per-object decisions, source evidence, limitations, ranking power, localization readiness and test plans. Records are newest first; historical approvals are not current execution permission. A priority score never overrides a blocked decision or the prohibition on competitor names in all metadata.",
2056
+ getAsoEvidenceSchema,
2057
+ getAsoEvidence,
2058
+ { readOnlyHint: true, openWorldHint: false }
2059
+ );
2137
2060
  tool(
2138
2061
  "get_aso_keywords",
2139
2062
  "Get ASO keywords",
@@ -2153,7 +2076,7 @@ function registerTools(server, client, options = {}) {
2153
2076
  tool(
2154
2077
  "get_aso_locale_snapshots",
2155
2078
  "Get ASO locale snapshots",
2156
- "Get current App Store and Google Play listing snapshots across all locales for an app. Returns the live title, subtitle, keywords, description, and promotional text for each locale. Useful for auditing localized metadata consistency.",
2079
+ 'Get current App Store and Google Play listing snapshots across all locales for an app. Returns the live title, subtitle, keywords, description, and promotional text for each locale \u2014 by default the latest snapshot per locale and type; pass view "history" for raw revisions newest first. Useful for auditing localized metadata consistency.',
2157
2080
  getAsoLocaleSnapshotsSchema,
2158
2081
  getAsoLocaleSnapshots,
2159
2082
  { readOnlyHint: true, openWorldHint: false }
@@ -2185,7 +2108,7 @@ function registerTools(server, client, options = {}) {
2185
2108
  tool(
2186
2109
  "send_chat_message",
2187
2110
  "Send chat message",
2188
- "Send a message to the Fload AI chat assistant. Starts a new conversation if no conversationId is provided, or continues an existing one. Optionally specify an agentType to route to a specialized agent (review, monitoring, forecasting, etc.). Adds a message to your chat history \u2014 not publicly visible.",
2111
+ "Send a message to the Fload AI chat assistant. Starts a new conversation if no conversationId is provided, or continues an existing one. Optionally specify an agentType to route to a specialized agent (review, aso). Adds a message to your chat history \u2014 not publicly visible.",
2189
2112
  sendChatMessageSchema,
2190
2113
  sendChatMessage,
2191
2114
  { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
@@ -2205,20 +2128,26 @@ async function createMcpServer(_config, client) {
2205
2128
  }
2206
2129
 
2207
2130
  // src/config.ts
2208
- import "dotenv/config";
2209
2131
  import { readFileSync, existsSync } from "fs";
2210
2132
  import { homedir } from "os";
2211
2133
  import { join } from "path";
2212
- function loadConfig() {
2213
- const apiKey = process.env.FLOAD_API_KEY;
2214
- const apiUrl = process.env.FLOAD_API_URL || "https://api.fload.com";
2134
+ import { z as z10 } from "zod";
2135
+ var ConfigFileSchema = z10.object({
2136
+ apiKey: z10.string().optional().catch(void 0),
2137
+ apiUrl: z10.string().optional().catch(void 0)
2138
+ });
2139
+ function loadConfig(env = process.env) {
2140
+ const apiKey = env.FLOAD_API_KEY;
2141
+ const apiUrl = env.FLOAD_API_URL || "https://api.fload.com";
2215
2142
  if (apiKey) {
2216
2143
  return { apiKey, apiUrl };
2217
2144
  }
2218
2145
  const configPath = join(homedir(), ".fload", "config.json");
2219
2146
  if (existsSync(configPath)) {
2220
2147
  try {
2221
- const configData = JSON.parse(readFileSync(configPath, "utf-8"));
2148
+ const configData = ConfigFileSchema.parse(
2149
+ JSON.parse(readFileSync(configPath, "utf-8"))
2150
+ );
2222
2151
  if (configData.apiKey) {
2223
2152
  return {
2224
2153
  apiKey: configData.apiKey,