@fload-ai/mcp 0.6.0 → 0.8.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 +747 -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 +668 -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 +27 -33
  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 +666 -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
@@ -4,6 +4,8 @@ var RateLimiter = class {
4
4
  this.maxCalls = maxCalls;
5
5
  this.windowMs = windowMs;
6
6
  }
7
+ maxCalls;
8
+ windowMs;
7
9
  calls = /* @__PURE__ */ new Map();
8
10
  check(key) {
9
11
  const now = Date.now();
@@ -11,8 +13,8 @@ var RateLimiter = class {
11
13
  let timestamps = this.calls.get(key) || [];
12
14
  timestamps = timestamps.filter((t) => t > windowStart);
13
15
  if (timestamps.length >= this.maxCalls) {
14
- const oldestInWindow = timestamps[0];
15
- const retryAfterMs = oldestInWindow + this.windowMs - now;
16
+ const [oldestInWindow] = timestamps;
17
+ const retryAfterMs = oldestInWindow === void 0 ? Number.NaN : oldestInWindow + this.windowMs - now;
16
18
  this.calls.set(key, timestamps);
17
19
  return { allowed: false, remaining: 0, retryAfterMs };
18
20
  }
@@ -60,10 +62,8 @@ async function listApps(input, client) {
60
62
  });
61
63
  const apps = response.data ?? [];
62
64
  const filtered = input.platform ? apps.filter((app) => {
63
- if (input.platform === "ios")
64
- return !!app.appleAppId;
65
- if (input.platform === "android")
66
- return !!app.googleAppId;
65
+ if (input.platform === "ios") return !!app.appleAppId;
66
+ if (input.platform === "android") return !!app.googleAppId;
67
67
  return true;
68
68
  }) : apps;
69
69
  return {
@@ -173,6 +173,9 @@ var getReviewsSchema = z2.object({
173
173
  startDate: z2.string().optional().describe("Filter reviews from this date (ISO format: YYYY-MM-DD)"),
174
174
  endDate: z2.string().optional().describe("Filter reviews until this date (ISO format: YYYY-MM-DD)"),
175
175
  limit: z2.number().int().min(1).max(200).default(50).describe("Maximum number of reviews to return"),
176
+ cursor: z2.string().optional().describe(
177
+ "nextCursor from the previous get_reviews call, to fetch the next page with the same app and filters"
178
+ ),
176
179
  sortBy: z2.enum(["date", "rating"]).default("date").describe("Sort reviews by date or rating")
177
180
  });
178
181
  var generateReviewReplySchema = z2.object({
@@ -231,19 +234,7 @@ async function getReviews(input, client) {
231
234
  isError: true
232
235
  };
233
236
  }
234
- const params = {
235
- limit: input.limit
236
- };
237
- if (input.platform)
238
- params.platform = input.platform;
239
- if (input.rating !== void 0)
240
- params.rating = input.rating;
241
- if (input.replied !== void 0)
242
- params.responseStatus = input.replied ? "replied" : "unreplied";
243
- if (input.startDate)
244
- params.startDate = input.startDate;
245
- if (input.endDate)
246
- params.endDate = input.endDate;
237
+ const params = reviewQueryParameters(input);
247
238
  const response = await client.get(
248
239
  `/api/assets/${assetId}/reviews`,
249
240
  params
@@ -270,6 +261,8 @@ async function getReviews(input, client) {
270
261
  type: "text",
271
262
  text: formatAsJson({
272
263
  summary,
264
+ // Pass back as `cursor` to get the next page; null = last page.
265
+ nextCursor: response.data?.nextCursor ?? null,
273
266
  reviews: reviews.map((review) => ({
274
267
  id: review.id,
275
268
  appId: review.appId,
@@ -304,6 +297,19 @@ async function getReviews(input, client) {
304
297
  };
305
298
  }
306
299
  }
300
+ function reviewQueryParameters(input) {
301
+ const params = {
302
+ limit: input.limit
303
+ };
304
+ if (input.cursor) params.cursor = input.cursor;
305
+ if (input.platform) params.platform = input.platform;
306
+ if (input.rating !== void 0) params.rating = input.rating;
307
+ if (input.replied !== void 0)
308
+ params.responseStatus = input.replied ? "replied" : "unreplied";
309
+ if (input.startDate) params.startDate = input.startDate;
310
+ if (input.endDate) params.endDate = input.endDate;
311
+ return params;
312
+ }
307
313
  async function generateReviewReply(input, client) {
308
314
  try {
309
315
  const response = await client.post(
@@ -394,45 +400,140 @@ async function translateReview(input, client) {
394
400
 
395
401
  // src/tools/analytics.ts
396
402
  import { z as z3 } from "zod";
403
+ function summarize(points, change) {
404
+ const values = (Array.isArray(points) ? points : []).map((point) => point.value ?? point.total).filter((value) => typeof value === "number");
405
+ return {
406
+ value: change?.currentValue ?? null,
407
+ effectiveFromDate: change?.effectiveFromDate ?? null,
408
+ effectiveToDate: change?.effectiveToDate ?? null,
409
+ min: values.length > 0 ? Math.min(...values) : null,
410
+ max: values.length > 0 ? Math.max(...values) : null,
411
+ dataPoints: values.length
412
+ };
413
+ }
397
414
  var discoverMetricsSchema = z3.object({
398
415
  assetId: z3.string().uuid().describe("App UUID to check available metrics for")
399
416
  });
400
417
  var getMetricsSchema = z3.object({
401
418
  assetId: z3.string().uuid().describe("App UUID"),
402
- metrics: z3.array(z3.string()).min(1).describe('Metric names to query (e.g., ["proceeds", "totalDownloads"]). Use discover_metrics first to see available metrics.'),
419
+ metrics: z3.array(z3.string()).min(1).describe(
420
+ 'Metric names to query (e.g., ["proceeds", "totalDownloads"]). Use discover_metrics first to see available metrics.'
421
+ ),
403
422
  startDate: z3.string().optional().describe("Start date (YYYY-MM-DD). Defaults to 30 days ago."),
404
423
  endDate: z3.string().optional().describe("End date (YYYY-MM-DD). Defaults to today."),
405
424
  granularity: z3.enum(["daily", "weekly", "monthly"]).default("daily").describe("Data granularity"),
406
- 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.'),
407
- dimensionFilter: z3.string().optional().describe('Filter to a specific dimension value (e.g., "US" when dimension is "storefront")')
425
+ dimension: z3.string().optional().describe(
426
+ 'Optional dimension to break down by (e.g., "storefront" for country, "platform" for device). Use discover_dimensions to see options.'
427
+ ),
428
+ dimensionFilter: z3.string().optional().describe(
429
+ 'Filter to a specific dimension value (e.g., "US" when dimension is "storefront")'
430
+ )
408
431
  });
409
432
  var discoverDimensionsSchema = z3.object({
410
433
  assetId: z3.string().uuid().describe("App UUID"),
411
- dimension: z3.string().optional().describe('If provided, returns the available values for this dimension (e.g., countries for "storefront")')
434
+ dimension: z3.string().optional().describe(
435
+ 'If provided, returns the available values for this dimension (e.g., countries for "storefront")'
436
+ )
412
437
  });
413
438
  var METRIC_INFO = {
414
- proceeds: { displayName: "Net Revenue (after store cut)", category: "Revenue", type: "currency" },
415
- total_revenue: { displayName: "Gross Revenue", category: "Revenue", type: "currency" },
416
- total_downloads: { displayName: "Total Downloads", category: "Downloads", type: "count" },
417
- units: { displayName: "First-time Downloads", category: "Downloads", type: "count" },
418
- redownloads: { displayName: "Re-downloads", category: "Downloads", type: "count" },
419
- page_views: { displayName: "App Store Page Views", category: "Downloads", type: "count" },
420
- impressions: { displayName: "App Store Impressions", category: "Downloads", type: "count" },
421
- sessions: { displayName: "App Sessions", category: "Engagement", type: "count" },
422
- active_devices: { displayName: "Active Devices", category: "Engagement", type: "count" },
439
+ proceeds: {
440
+ displayName: "Net Revenue (after store cut)",
441
+ category: "Revenue",
442
+ type: "currency"
443
+ },
444
+ total_revenue: {
445
+ displayName: "Gross Revenue",
446
+ category: "Revenue",
447
+ type: "currency"
448
+ },
449
+ total_downloads: {
450
+ displayName: "Total Downloads",
451
+ category: "Downloads",
452
+ type: "count"
453
+ },
454
+ units: {
455
+ displayName: "First-time Downloads",
456
+ category: "Downloads",
457
+ type: "count"
458
+ },
459
+ redownloads: {
460
+ displayName: "Re-downloads",
461
+ category: "Downloads",
462
+ type: "count"
463
+ },
464
+ page_views: {
465
+ displayName: "App Store Page Views",
466
+ category: "Downloads",
467
+ type: "count"
468
+ },
469
+ impressions: {
470
+ displayName: "App Store Impressions",
471
+ category: "Downloads",
472
+ type: "count"
473
+ },
474
+ sessions: {
475
+ displayName: "App Sessions",
476
+ category: "Engagement",
477
+ type: "count"
478
+ },
479
+ active_devices: {
480
+ displayName: "Active Devices",
481
+ category: "Engagement",
482
+ type: "count"
483
+ },
423
484
  crashes: { displayName: "Crashes", category: "Engagement", type: "count" },
424
- paying_users: { displayName: "Paying Users", category: "Engagement", type: "count" },
425
- active_subs: { displayName: "Active Subscriptions", category: "Subscriptions", type: "count" },
426
- active_trials: { displayName: "Active Trials", category: "Subscriptions", type: "count" },
427
- new_trials: { displayName: "New Trials", category: "Subscriptions", type: "count" },
428
- trial_conversion_rate: { displayName: "Trial Conversion Rate", category: "Subscriptions", type: "percentage" },
429
- subscription_retention_rate: { displayName: "Subscription Retention Rate", category: "Subscriptions", type: "percentage" },
430
- products_sold: { displayName: "Products Sold (IAP)", category: "Revenue", type: "count" },
485
+ paying_users: {
486
+ displayName: "Paying Users",
487
+ category: "Engagement",
488
+ type: "count"
489
+ },
490
+ active_subs: {
491
+ displayName: "Active Subscriptions",
492
+ category: "Subscriptions",
493
+ type: "count"
494
+ },
495
+ active_trials: {
496
+ displayName: "Active Trials",
497
+ category: "Subscriptions",
498
+ type: "count"
499
+ },
500
+ new_trials: {
501
+ displayName: "New Trials",
502
+ category: "Subscriptions",
503
+ type: "count"
504
+ },
505
+ trial_conversion_rate: {
506
+ displayName: "Trial Conversion Rate",
507
+ category: "Subscriptions",
508
+ type: "percentage"
509
+ },
510
+ subscription_retention_rate: {
511
+ displayName: "Subscription Retention Rate",
512
+ category: "Subscriptions",
513
+ type: "percentage"
514
+ },
515
+ products_sold: {
516
+ displayName: "Products Sold (IAP)",
517
+ category: "Revenue",
518
+ type: "count"
519
+ },
431
520
  ad_spend: { displayName: "Ad Spend", category: "Ads", type: "currency" },
432
- ad_impressions: { displayName: "Ad Impressions", category: "Ads", type: "count" },
521
+ ad_impressions: {
522
+ displayName: "Ad Impressions",
523
+ category: "Ads",
524
+ type: "count"
525
+ },
433
526
  ad_taps: { displayName: "Ad Taps/Clicks", category: "Ads", type: "count" },
434
- ad_installs: { displayName: "Ad-attributed Installs", category: "Ads", type: "count" },
435
- ad_conversions: { displayName: "Ad Conversions", category: "Ads", type: "count" }
527
+ ad_installs: {
528
+ displayName: "Ad-attributed Installs",
529
+ category: "Ads",
530
+ type: "count"
531
+ },
532
+ ad_conversions: {
533
+ displayName: "Ad Conversions",
534
+ category: "Ads",
535
+ type: "count"
536
+ }
436
537
  };
437
538
  var DIMENSION_INFO = {
438
539
  storefront: "Country",
@@ -466,28 +567,32 @@ async function discoverMetrics(input, client) {
466
567
  });
467
568
  const byCategory = {};
468
569
  for (const m of enriched) {
469
- if (!byCategory[m.category])
470
- byCategory[m.category] = [];
471
- byCategory[m.category].push(m);
570
+ (byCategory[m.category] ??= []).push(m);
472
571
  }
473
572
  return {
474
- content: [{
475
- type: "text",
476
- text: formatAsJson({
477
- assetId: input.assetId,
478
- totalAvailable: availableMetrics.length,
479
- metricsByCategory: byCategory,
480
- dataGroups: metricGroups,
481
- tip: 'Use the metric "name" field in get_metrics. You can query multiple metrics at once.'
482
- })
483
- }]
573
+ content: [
574
+ {
575
+ type: "text",
576
+ text: formatAsJson({
577
+ assetId: input.assetId,
578
+ totalAvailable: availableMetrics.length,
579
+ metricsByCategory: byCategory,
580
+ dataGroups: metricGroups,
581
+ tip: 'Use the metric "name" field in get_metrics. You can query multiple metrics at once.'
582
+ })
583
+ }
584
+ ]
484
585
  };
485
586
  } catch (error) {
486
- return { content: [{ type: "text", text: formatError(error) }], isError: true };
587
+ return {
588
+ content: [{ type: "text", text: formatError(error) }],
589
+ isError: true
590
+ };
487
591
  }
488
592
  }
489
593
  async function getMetrics(input, client) {
490
594
  try {
595
+ const granularity = input.granularity ?? "daily";
491
596
  const endDate = input.endDate || (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
492
597
  const startDate = input.startDate || (() => {
493
598
  const d = /* @__PURE__ */ new Date();
@@ -498,60 +603,53 @@ async function getMetrics(input, client) {
498
603
  metrics: input.metrics.join(","),
499
604
  fromDate: startDate,
500
605
  toDate: endDate,
501
- granularity: input.granularity
606
+ granularity
502
607
  };
503
- if (input.dimension)
504
- params.dimension = input.dimension;
608
+ if (input.dimension) params.dimension = input.dimension;
505
609
  if (input.dimensionFilter && input.dimension) {
506
610
  params[`filter.${input.dimension}`] = input.dimensionFilter;
507
611
  }
508
- const response = await client.get(
509
- `/api/assets/${input.assetId}/metrics/timeseries`,
510
- params
511
- );
612
+ const path = `/api/assets/${input.assetId}/metrics/timeseries`;
613
+ const response = await client.get(path, params);
614
+ const summaryResponse = input.granularity === "daily" ? response : await client.get(path, {
615
+ ...params,
616
+ granularity: "daily"
617
+ });
512
618
  const data = response.data ?? {};
513
- const changes = response.changes ?? {};
619
+ const changes = summaryResponse.changes ?? {};
514
620
  const meta = response.meta ?? {};
515
621
  const summaries = {};
516
- for (const [metricName, timeseries] of Object.entries(data)) {
517
- const points = timeseries;
518
- if (!Array.isArray(points) || points.length === 0) {
519
- summaries[metricName] = { total: 0, average: 0, min: 0, max: 0, dataPoints: 0 };
520
- continue;
521
- }
522
- const values = points.map((p) => p.value);
523
- const total = values.reduce((s, v) => s + v, 0);
524
- summaries[metricName] = {
525
- total: Math.round(total * 100) / 100,
526
- average: Math.round(total / values.length * 100) / 100,
527
- min: Math.min(...values),
528
- max: Math.max(...values),
529
- dataPoints: values.length
530
- };
622
+ for (const [metricName, points] of Object.entries(data)) {
623
+ summaries[metricName] = summarize(points, changes[metricName]);
531
624
  }
532
625
  const info = METRIC_INFO;
533
626
  return {
534
- content: [{
535
- type: "text",
536
- text: formatAsJson({
537
- assetId: input.assetId,
538
- dateRange: { start: startDate, end: endDate },
539
- granularity: input.granularity,
540
- dimension: input.dimension || null,
541
- metrics: Object.keys(data).map((name) => ({
542
- name,
543
- displayName: info[name]?.displayName || name,
544
- type: info[name]?.type || "count",
545
- summary: summaries[name],
546
- change: changes[name] || null
547
- })),
548
- timeseries: data,
549
- meta
550
- })
551
- }]
627
+ content: [
628
+ {
629
+ type: "text",
630
+ text: formatAsJson({
631
+ assetId: input.assetId,
632
+ dateRange: { start: startDate, end: endDate },
633
+ granularity,
634
+ dimension: input.dimension || null,
635
+ metrics: Object.keys(data).map((name) => ({
636
+ name,
637
+ displayName: info[name]?.displayName || name,
638
+ type: info[name]?.type || "count",
639
+ summary: summaries[name],
640
+ change: changes[name] || null
641
+ })),
642
+ timeseries: data,
643
+ meta
644
+ })
645
+ }
646
+ ]
552
647
  };
553
648
  } catch (error) {
554
- return { content: [{ type: "text", text: formatError(error) }], isError: true };
649
+ return {
650
+ content: [{ type: "text", text: formatError(error) }],
651
+ isError: true
652
+ };
555
653
  }
556
654
  }
557
655
  async function discoverDimensions(input, client) {
@@ -561,15 +659,17 @@ async function discoverDimensions(input, client) {
561
659
  `/api/assets/${input.assetId}/metrics/dimensions/${input.dimension}/values`
562
660
  );
563
661
  return {
564
- content: [{
565
- type: "text",
566
- text: formatAsJson({
567
- assetId: input.assetId,
568
- dimension: input.dimension,
569
- displayName: DIMENSION_INFO[input.dimension] || input.dimension,
570
- values: response2.data ?? response2
571
- })
572
- }]
662
+ content: [
663
+ {
664
+ type: "text",
665
+ text: formatAsJson({
666
+ assetId: input.assetId,
667
+ dimension: input.dimension,
668
+ displayName: DIMENSION_INFO[input.dimension] || input.dimension,
669
+ values: response2.data ?? response2
670
+ })
671
+ }
672
+ ]
573
673
  };
574
674
  }
575
675
  const response = await client.get(`/api/assets/${input.assetId}/metrics/dimensions`);
@@ -582,17 +682,22 @@ async function discoverDimensions(input, client) {
582
682
  return { name: id, displayName: dim.label ?? DIMENSION_INFO[id] ?? id };
583
683
  });
584
684
  return {
585
- content: [{
586
- type: "text",
587
- text: formatAsJson({
588
- assetId: input.assetId,
589
- dimensions: enriched,
590
- tip: 'Use dimension name in get_metrics "dimension" param. Use discover_dimensions with a specific dimension to see available values.'
591
- })
592
- }]
685
+ content: [
686
+ {
687
+ type: "text",
688
+ text: formatAsJson({
689
+ assetId: input.assetId,
690
+ dimensions: enriched,
691
+ tip: 'Use dimension name in get_metrics "dimension" param. Use discover_dimensions with a specific dimension to see available values.'
692
+ })
693
+ }
694
+ ]
593
695
  };
594
696
  } catch (error) {
595
- return { content: [{ type: "text", text: formatError(error) }], isError: true };
697
+ return {
698
+ content: [{ type: "text", text: formatError(error) }],
699
+ isError: true
700
+ };
596
701
  }
597
702
  }
598
703
 
@@ -601,25 +706,10 @@ import { z as z4 } from "zod";
601
706
  function asRecord(value) {
602
707
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
603
708
  }
604
- var AGENT_TYPES = [
605
- "review",
606
- "monitoring",
607
- "forecasting",
608
- "growth",
609
- "aso",
610
- "ads",
611
- "product",
612
- "submission_review"
613
- ];
709
+ var AGENT_TYPES = ["review", "aso"];
614
710
  var AGENT_DESCRIPTIONS = {
615
711
  review: "AI-powered review management \u2014 drafts and sends replies to app store reviews",
616
- monitoring: "Anomaly detection \u2014 monitors metrics for unusual changes in downloads, revenue, etc.",
617
- forecasting: "Revenue and metric forecasting \u2014 generates forward-looking projections",
618
- growth: "Growth audit \u2014 analyzes app performance and provides growth scoring",
619
- aso: "App Store Optimization \u2014 listing optimization suggestions for better visibility",
620
- ads: "Ad campaign analysis \u2014 performance tracking and optimization recommendations",
621
- product: "Product agent \u2014 automated app installation testing via BrowserStack",
622
- submission_review: "Submission review \u2014 GitHub-based review workflow for app submissions"
712
+ aso: "App Store Optimization \u2014 listing optimization suggestions for better visibility"
623
713
  };
624
714
  var listAgentsSchema = z4.object({});
625
715
  var getAgentDetailsSchema = z4.object({
@@ -632,23 +722,25 @@ var getAgentRunHistorySchema = z4.object({
632
722
  limit: z4.number().int().min(1).max(100).default(20).describe("Maximum number of runs to return")
633
723
  });
634
724
  var triggerAgentRunSchema = z4.object({
635
- agentId: z4.string().describe("The agent ID to trigger a run for"),
725
+ agentId: z4.string().describe("The agent ID to trigger a run for (the `id` from list_agents)"),
636
726
  assetId: z4.string().uuid().optional().describe("Optional app UUID to run the agent against")
637
727
  });
638
728
  var pauseAgentSchema = z4.object({
639
- agentId: z4.string().describe("The agent ID to pause")
729
+ agentId: z4.string().describe("The agent ID to pause (the `id` from list_agents)")
640
730
  });
641
731
  var resumeAgentSchema = z4.object({
642
- agentId: z4.string().describe("The agent ID to resume")
732
+ agentId: z4.string().describe("The agent ID to resume (the `id` from list_agents)")
643
733
  });
644
734
  var getAgentActivitySchema = z4.object({
645
- agentId: z4.string().describe("The agent ID to get activity for")
735
+ agentId: z4.string().describe("The agent ID to get activity for (the `id` from list_agents)")
646
736
  });
647
737
  async function listAgents(_input, client) {
648
738
  try {
649
739
  let apiAgents = null;
650
740
  try {
651
- const response = await client.get("/api/agents");
741
+ const response = await client.get(
742
+ "/api/agents"
743
+ );
652
744
  apiAgents = Array.isArray(response) ? response : response.data ?? response.agents ?? null;
653
745
  } catch {
654
746
  }
@@ -697,8 +789,7 @@ async function getAgentDetails(input, client) {
697
789
  try {
698
790
  try {
699
791
  const params = {};
700
- if (input.assetId)
701
- params.assetId = input.assetId;
792
+ if (input.assetId) params.assetId = input.assetId;
702
793
  const response2 = await client.get(`/api/agents/by-type/${input.agentType}`, params);
703
794
  if (response2.agent) {
704
795
  return {
@@ -745,8 +836,7 @@ async function getAgentRunHistory(input, client) {
745
836
  let agentId;
746
837
  try {
747
838
  const byTypeParams = {};
748
- if (input.assetId)
749
- byTypeParams.assetId = input.assetId;
839
+ if (input.assetId) byTypeParams.assetId = input.assetId;
750
840
  const byType = await client.get(
751
841
  `/api/agents/by-type/${input.agentType}`,
752
842
  byTypeParams
@@ -899,188 +989,23 @@ async function getAgentActivity(input, client) {
899
989
  }
900
990
  }
901
991
 
902
- // src/tools/anomalies.ts
903
- import { z as z5 } from "zod";
904
- var getAnomaliesSchema = z5.object({
905
- assetId: z5.string().uuid().optional().describe("Filter anomalies by app UUID"),
906
- severity: z5.enum(["low", "medium", "high", "critical"]).optional().describe("Filter by severity level"),
907
- type: z5.enum(["surge", "decline"]).optional().describe("Filter by anomaly type"),
908
- status: z5.enum(["new", "viewed", "acknowledged", "dismissed"]).optional().describe("Filter by status"),
909
- metricName: z5.string().optional().describe('Filter by metric name (e.g., "proceeds", "units")'),
910
- fromDate: z5.string().optional().describe("Filter anomalies from this date (YYYY-MM-DD)"),
911
- toDate: z5.string().optional().describe("Filter anomalies until this date (YYYY-MM-DD)"),
912
- excludeDismissed: z5.boolean().default(true).describe("Exclude dismissed anomalies (default: true)"),
913
- limit: z5.number().int().min(1).max(100).default(50).describe("Maximum number of anomalies to return")
914
- });
915
- var getAnomalyDetailSchema = z5.object({
916
- id: z5.string().uuid().describe("The anomaly UUID to get details for")
917
- });
918
- var acknowledgeAnomalySchema = z5.object({
919
- id: z5.string().uuid().describe("The anomaly UUID to acknowledge")
920
- });
921
- var dismissAnomalySchema = z5.object({
922
- id: z5.string().uuid().describe("The anomaly UUID to dismiss")
923
- });
924
- async function getAnomalies(input, client) {
925
- try {
926
- const params = {
927
- limit: input.limit
928
- };
929
- if (input.assetId)
930
- params.assetId = input.assetId;
931
- if (input.severity)
932
- params.severity = input.severity;
933
- if (input.type)
934
- params.type = input.type;
935
- if (input.status)
936
- params.status = input.status;
937
- if (input.metricName)
938
- params.metricName = input.metricName;
939
- if (input.fromDate)
940
- params.fromDate = input.fromDate;
941
- if (input.toDate)
942
- params.toDate = input.toDate;
943
- const response = await client.get(
944
- "/api/anomalies",
945
- params
946
- );
947
- let anomalies = response.data ?? response.anomalies ?? [];
948
- if (input.excludeDismissed && !input.status) {
949
- anomalies = anomalies.filter((a) => a.status !== "dismissed");
950
- }
951
- return {
952
- content: [
953
- {
954
- type: "text",
955
- text: formatAsJson({
956
- total: anomalies.length,
957
- anomalies: anomalies.map((anomaly) => ({
958
- id: anomaly.id,
959
- assetId: anomaly.assetId,
960
- assetName: anomaly.assetName,
961
- assetIcon: anomaly.assetIcon,
962
- anomalyDate: anomaly.anomalyDate,
963
- metricName: anomaly.metricName,
964
- sourceType: anomaly.sourceType,
965
- type: anomaly.type,
966
- severity: anomaly.severity,
967
- actualValue: parseFloat(String(anomaly.actualValue || "0")),
968
- expectedValue: parseFloat(String(anomaly.expectedValue || "0")),
969
- deviationPercent: parseFloat(
970
- String(anomaly.deviationPercent || "0")
971
- ),
972
- confidence: parseFloat(String(anomaly.confidence || "0")),
973
- explanation: anomaly.explanation,
974
- suggestedActions: anomaly.suggestedActions,
975
- status: anomaly.status,
976
- detectedAt: anomaly.detectedAt
977
- }))
978
- })
979
- }
980
- ]
981
- };
982
- } catch (error) {
983
- return {
984
- content: [
985
- {
986
- type: "text",
987
- text: formatError(error)
988
- }
989
- ],
990
- isError: true
991
- };
992
- }
993
- }
994
- async function getAnomalyDetail(input, client) {
995
- try {
996
- const response = await client.get(`/api/anomalies/${input.id}`);
997
- return {
998
- content: [
999
- {
1000
- type: "text",
1001
- text: formatAsJson(response)
1002
- }
1003
- ]
1004
- };
1005
- } catch (error) {
1006
- return {
1007
- content: [
1008
- {
1009
- type: "text",
1010
- text: formatError(error)
1011
- }
1012
- ],
1013
- isError: true
1014
- };
1015
- }
1016
- }
1017
- async function acknowledgeAnomaly(input, client) {
1018
- try {
1019
- const response = await client.patch(`/api/anomalies/${input.id}/acknowledge`);
1020
- return {
1021
- content: [
1022
- {
1023
- type: "text",
1024
- text: formatAsJson(response)
1025
- }
1026
- ]
1027
- };
1028
- } catch (error) {
1029
- return {
1030
- content: [
1031
- {
1032
- type: "text",
1033
- text: formatError(error)
1034
- }
1035
- ],
1036
- isError: true
1037
- };
1038
- }
1039
- }
1040
- async function dismissAnomaly(input, client) {
1041
- try {
1042
- const response = await client.patch(`/api/anomalies/${input.id}/dismiss`);
1043
- return {
1044
- content: [
1045
- {
1046
- type: "text",
1047
- text: formatAsJson(response)
1048
- }
1049
- ]
1050
- };
1051
- } catch (error) {
1052
- return {
1053
- content: [
1054
- {
1055
- type: "text",
1056
- text: formatError(error)
1057
- }
1058
- ],
1059
- isError: true
1060
- };
1061
- }
1062
- }
1063
-
1064
992
  // src/tools/ads.ts
1065
- import { z as z6 } from "zod";
1066
- var getAdsPerformanceSchema = z6.object({
1067
- assetId: z6.string().uuid().optional().describe("Filter by app UUID"),
1068
- platform: z6.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
1069
- fromDate: z6.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
1070
- toDate: z6.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
1071
- limit: z6.number().int().min(1).max(100).default(50).describe("Maximum number of campaigns to return")
993
+ import { z as z5 } from "zod";
994
+ var getAdsPerformanceSchema = z5.object({
995
+ assetId: z5.string().uuid().optional().describe("Filter by app UUID"),
996
+ platform: z5.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
997
+ fromDate: z5.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
998
+ toDate: z5.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
999
+ limit: z5.number().int().min(1).max(100).default(50).describe("Maximum number of campaigns to return")
1072
1000
  });
1073
1001
  async function getAdsPerformance(input, client) {
1074
1002
  try {
1075
1003
  const params = {};
1076
- if (input.assetId)
1077
- params.assetId = input.assetId;
1078
- if (input.fromDate)
1079
- params.from = input.fromDate;
1080
- if (input.toDate)
1081
- params.to = input.toDate;
1004
+ if (input.assetId) params.assetId = input.assetId;
1005
+ if (input.fromDate) params.from = input.fromDate;
1006
+ if (input.toDate) params.to = input.toDate;
1082
1007
  const response = await client.get(
1083
- "/api/ads-agent/campaigns",
1008
+ "/api/ads/campaigns",
1084
1009
  params
1085
1010
  );
1086
1011
  let campaigns = response.data ?? response.campaigns ?? [];
@@ -1094,6 +1019,12 @@ async function getAdsPerformance(input, client) {
1094
1019
  type: "text",
1095
1020
  text: formatAsJson({
1096
1021
  total: campaigns.length,
1022
+ // The server couldn't read the metrics: null spend is unknown,
1023
+ // never "no spend".
1024
+ ...response.metricsUnavailable ? {
1025
+ metricsUnavailable: true,
1026
+ note: "The ads metrics could not be read right now, so spend, impressions, taps and installs are unknown (null), not zero. Try again later."
1027
+ } : {},
1097
1028
  campaigns: campaigns.map((campaign) => ({
1098
1029
  id: campaign.id,
1099
1030
  assetId: campaign.assetId,
@@ -1130,114 +1061,19 @@ async function getAdsPerformance(input, client) {
1130
1061
  }
1131
1062
  }
1132
1063
 
1133
- // src/tools/growth.ts
1134
- import { z as z7 } from "zod";
1135
- var getGrowthAuditSchema = z7.object({
1136
- assetId: z7.string().uuid().describe("App UUID to audit")
1137
- });
1138
- var getGrowthScoreSchema = z7.object({
1139
- assetId: z7.string().uuid().describe("App UUID to score")
1140
- });
1141
- async function getGrowthAudit(input, client) {
1142
- try {
1143
- const response = await client.get(`/api/growth/audit/${input.assetId}`);
1144
- return {
1145
- content: [
1146
- {
1147
- type: "text",
1148
- text: formatAsJson(response.data || response)
1149
- }
1150
- ]
1151
- };
1152
- } catch (error) {
1153
- return {
1154
- content: [
1155
- {
1156
- type: "text",
1157
- text: formatError(error)
1158
- }
1159
- ],
1160
- isError: true
1161
- };
1162
- }
1163
- }
1164
- async function getGrowthScore(input, client) {
1165
- try {
1166
- const response = await client.get(`/api/growth/score/${input.assetId}`);
1167
- return {
1168
- content: [
1169
- {
1170
- type: "text",
1171
- text: formatAsJson(response.data || response)
1172
- }
1173
- ]
1174
- };
1175
- } catch (error) {
1176
- return {
1177
- content: [
1178
- {
1179
- type: "text",
1180
- text: formatError(error)
1181
- }
1182
- ],
1183
- isError: true
1184
- };
1185
- }
1186
- }
1187
-
1188
- // src/tools/forecasting.ts
1189
- import { z as z8 } from "zod";
1190
- var getForecastsSchema = z8.object({
1191
- assetId: z8.string().uuid().describe("App UUID to get forecasts for"),
1192
- metric: z8.enum(["proceeds", "total_revenue", "total_downloads", "active_subs", "new_trials"]).describe("The metric to forecast"),
1193
- forecastWeeks: z8.number().int().min(4).max(156).optional().describe("Weeks to forecast forward (default 104)"),
1194
- historicalWeeks: z8.number().int().min(12).max(156).optional().describe("Weeks of history to base the forecast on (default 104)")
1195
- });
1196
- async function getForecasts(input, client) {
1197
- try {
1198
- const response = await client.get("/api/forecasting/forecast", {
1199
- assetId: input.assetId,
1200
- metricName: input.metric,
1201
- forecastWeeks: input.forecastWeeks,
1202
- historicalWeeks: input.historicalWeeks
1203
- });
1204
- return {
1205
- content: [
1206
- {
1207
- type: "text",
1208
- text: formatAsJson(response.data || response)
1209
- }
1210
- ]
1211
- };
1212
- } catch (error) {
1213
- return {
1214
- content: [
1215
- {
1216
- type: "text",
1217
- text: formatError(error)
1218
- }
1219
- ],
1220
- isError: true
1221
- };
1222
- }
1223
- }
1224
-
1225
1064
  // src/tools/dashboard.ts
1226
- import { z as z9 } from "zod";
1065
+ import { z as z6 } from "zod";
1227
1066
  function parseDashboardNumber(value) {
1228
- if (value === null || value === void 0 || value === "")
1229
- return null;
1067
+ if (value === null || value === void 0 || value === "") return null;
1230
1068
  const parsed = typeof value === "number" ? value : Number.parseFloat(value);
1231
1069
  return Number.isFinite(parsed) ? parsed : null;
1232
1070
  }
1233
1071
  function getSidebarAssets(response) {
1234
- if (!response)
1235
- return [];
1236
- if (Array.isArray(response))
1237
- return response;
1072
+ if (!response) return [];
1073
+ if (Array.isArray(response)) return response;
1238
1074
  return response.data ?? [];
1239
1075
  }
1240
- var getDashboardOverviewSchema = z9.object({});
1076
+ var getDashboardOverviewSchema = z6.object({});
1241
1077
  async function getDashboardOverview(_input, client) {
1242
1078
  try {
1243
1079
  const overviewPromise = client.get("/api/dashboard/overview-metrics").catch(() => null);
@@ -1292,152 +1128,342 @@ async function getDashboardOverview(_input, client) {
1292
1128
  }
1293
1129
 
1294
1130
  // src/tools/actions.ts
1295
- import { z as z10 } from "zod";
1296
- function asRecord2(value) {
1297
- return value && typeof value === "object" && !Array.isArray(value) ? value : {};
1131
+ import { randomUUID } from "node:crypto";
1132
+ import { z as z7 } from "zod";
1133
+
1134
+ // src/public-errors.ts
1135
+ var INTERNAL_ERROR_PATTERNS = [
1136
+ /\b(stack|trace|at\s+[\w.$<>]+\s*\()/i,
1137
+ /\b(sql|postgres|drizzle|database|constraint|duplicate key|violates|relation)\b/i,
1138
+ /\b(fetch|undici|socket|ECONNRESET|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|HTTP\s+\d{3})\b/i,
1139
+ /\b(token|secret|api[_-]?key|authorization|bearer|cookie|password)\b/i,
1140
+ /\b[a-z0-9]+_(secret|token|key)\b/i,
1141
+ /\b(secret|token|key)[_-][a-z0-9]+\b/i,
1142
+ /\b(scrap|browser|patchright|playwright|chromium|page\.|locator|selector)\b/i,
1143
+ /\b(redis|bullmq|queue|job id|worker)\b/i
1144
+ ];
1145
+ function looksInternal(message) {
1146
+ return INTERNAL_ERROR_PATTERNS.some((pattern) => pattern.test(message));
1147
+ }
1148
+ function publicMcpErrorMessage(message, fallbackMessage = "Fload could not complete the request. Please try again.") {
1149
+ const raw = message instanceof Error ? message.message : typeof message === "string" ? message : "";
1150
+ const normalized = raw.replace(/\s+/g, " ").trim();
1151
+ if (!normalized || normalized.length > 180 || looksInternal(normalized)) {
1152
+ return fallbackMessage;
1153
+ }
1154
+ return normalized;
1298
1155
  }
1299
- var listPendingActionsSchema = z10.object({
1300
- assetId: z10.string().uuid().optional().describe("Filter by app UUID"),
1301
- limit: z10.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
1156
+
1157
+ // src/tools/actions.ts
1158
+ var listPendingActionsSchema = z7.object({
1159
+ assetId: z7.string().uuid().optional().describe("Filter by app UUID"),
1160
+ view: z7.enum(["open", "queued"]).default("open").describe(
1161
+ "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)."
1162
+ ),
1163
+ limit: z7.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
1302
1164
  });
1303
- var approveActionSchema = z10.object({
1304
- actionId: z10.string().describe("The pending action ID to approve")
1165
+ var approveActionSchema = z7.object({
1166
+ actionId: z7.string().describe("The inbox item ID to approve (from list_pending_actions)")
1305
1167
  });
1306
- var rejectActionSchema = z10.object({
1307
- actionId: z10.string().describe("The draft reply ID to reject/delete")
1168
+ var rejectActionSchema = z7.object({
1169
+ actionId: z7.string().describe("The inbox item ID to reject (from list_pending_actions)"),
1170
+ reason: z7.string().trim().min(1).max(1e3).optional().describe(
1171
+ "Why, in the user's words. Kept with the rejection so the agents do not propose the same thing again."
1172
+ )
1308
1173
  });
1174
+ var checkActionNowSchema = z7.object({
1175
+ actionId: z7.string().describe(
1176
+ 'The inbox item ID to check now (from list_pending_actions with view "queued", or an approve_action result; its commands include check_now)'
1177
+ )
1178
+ });
1179
+ var renameCustomPageActionSchema = z7.object({
1180
+ actionId: z7.string().describe(
1181
+ 'The inbox item ID of the "Create custom product page" request (from list_pending_actions; it failed because App Store Connect already has a page of that name, or it waits for approval)'
1182
+ ),
1183
+ name: z7.string().trim().min(1).max(100).describe(
1184
+ "The new page name: at most 100 characters (UTF-16 units), not its current name, not a page the app already has"
1185
+ )
1186
+ });
1187
+ function commandFor(kind, intent) {
1188
+ if (kind === "notice")
1189
+ return intent === "approve" ? "acknowledge" : "dismiss";
1190
+ return intent;
1191
+ }
1192
+ function toolText(payload, isError = false) {
1193
+ return {
1194
+ content: [{ type: "text", text: formatAsJson(payload) }],
1195
+ ...isError ? { isError: true } : {}
1196
+ };
1197
+ }
1198
+ function toolError(error) {
1199
+ return {
1200
+ content: [{ type: "text", text: formatError(error) }],
1201
+ isError: true
1202
+ };
1203
+ }
1309
1204
  async function listPendingActions(input, client) {
1310
1205
  try {
1311
- const params = {
1312
- limit: input.limit
1313
- };
1314
1206
  const response = await client.get(
1315
- "/api/pending-actions",
1316
- params
1207
+ "/api/actions/items",
1208
+ { view: input.view ?? "open", assetId: input.assetId, limit: input.limit }
1317
1209
  );
1318
- let actions = response.data ?? response.actions ?? [];
1319
- if (input.assetId) {
1320
- actions = actions.filter(
1321
- (action) => action.assetId === input.assetId
1322
- );
1323
- }
1324
- return {
1325
- content: [
1326
- {
1327
- type: "text",
1328
- text: formatAsJson({
1329
- total: actions.length,
1330
- actions
1331
- })
1332
- }
1333
- ]
1334
- };
1210
+ const actions = response.items ?? [];
1211
+ return toolText({
1212
+ total: actions.length,
1213
+ actions,
1214
+ hasMore: Boolean(response.nextCursor)
1215
+ });
1335
1216
  } catch (error) {
1336
- return {
1337
- content: [
1338
- {
1339
- type: "text",
1340
- text: formatError(error)
1217
+ return toolError(error);
1218
+ }
1219
+ }
1220
+ async function commandItem(client, itemId, intent, reason) {
1221
+ const detail = await client.get(
1222
+ `/api/actions/items/${encodeURIComponent(itemId)}`
1223
+ );
1224
+ const item = detail.item;
1225
+ if (!item) throw new Error("Action not found");
1226
+ const command = commandFor(item.kind, intent);
1227
+ const answer = await client.postForAnswer(
1228
+ "/api/actions/commands",
1229
+ {
1230
+ command,
1231
+ idempotencyKey: `mcp:${command}:${item.id}:${randomUUID()}`,
1232
+ targets: [
1233
+ {
1234
+ itemId: item.id,
1235
+ ...command === "approve" && item.currentRevisionId ? { revisionId: item.currentRevisionId } : {}
1341
1236
  }
1342
1237
  ],
1343
- isError: true
1344
- };
1345
- }
1238
+ ...command === "reject" && reason ? { reason } : {}
1239
+ }
1240
+ );
1241
+ const result = answer.body?.results?.[0];
1242
+ if (!result)
1243
+ throw new Error(
1244
+ answer.ok ? "Fload returned no result for the command." : "Fload rejected the request. Please check access and try again."
1245
+ );
1246
+ return {
1247
+ command,
1248
+ result: {
1249
+ ...result,
1250
+ error: result.error ? publicMcpErrorMessage(
1251
+ result.error,
1252
+ "Fload could not apply this change."
1253
+ ) : void 0
1254
+ }
1255
+ };
1346
1256
  }
1347
1257
  async function approveAction(input, client) {
1348
1258
  try {
1349
- const response = await client.post(
1350
- `/api/pending-actions/${input.actionId}/approve`,
1351
- {}
1259
+ const { command, result } = await commandItem(
1260
+ client,
1261
+ input.actionId,
1262
+ "approve"
1263
+ );
1264
+ const applied2 = result?.result === "applied" || result?.result === "replayed";
1265
+ return toolText(
1266
+ {
1267
+ success: applied2,
1268
+ actionId: input.actionId,
1269
+ command,
1270
+ result: result?.result ?? "unknown",
1271
+ ...result?.error ? { error: result.error } : {},
1272
+ message: applied2 ? 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.",
1273
+ item: result?.item
1274
+ },
1275
+ !applied2
1352
1276
  );
1353
- return {
1354
- content: [
1355
- {
1356
- type: "text",
1357
- text: formatAsJson({
1358
- success: true,
1359
- actionId: input.actionId,
1360
- status: "approved",
1361
- message: "Reply has been approved and queued for sending",
1362
- ...asRecord2(response.data)
1363
- })
1364
- }
1365
- ]
1366
- };
1367
1277
  } catch (error) {
1368
- return {
1369
- content: [
1370
- {
1371
- type: "text",
1372
- text: formatError(error)
1373
- }
1374
- ],
1375
- isError: true
1376
- };
1278
+ return toolError(error);
1377
1279
  }
1378
1280
  }
1379
1281
  async function rejectAction(input, client) {
1380
1282
  try {
1381
- const response = await client.post(
1382
- `/api/pending-actions/${input.actionId}/reject`
1283
+ const { command, result } = await commandItem(
1284
+ client,
1285
+ input.actionId,
1286
+ "reject",
1287
+ input.reason
1288
+ );
1289
+ const applied2 = result?.result === "applied" || result?.result === "replayed";
1290
+ return toolText(
1291
+ {
1292
+ success: applied2,
1293
+ actionId: input.actionId,
1294
+ command,
1295
+ result: result?.result ?? "unknown",
1296
+ ...result?.error ? { error: result.error } : {},
1297
+ message: applied2 ? command === "dismiss" ? "Dismissed." : "Rejected. Nothing was sent." : result?.error ?? "The rejection could not be recorded.",
1298
+ item: result?.item
1299
+ },
1300
+ !applied2
1383
1301
  );
1384
- return {
1385
- content: [
1386
- {
1387
- type: "text",
1388
- text: formatAsJson({
1389
- success: true,
1390
- actionId: input.actionId,
1391
- status: "rejected",
1392
- message: "Draft reply has been rejected and removed",
1393
- ...asRecord2(response.data)
1394
- })
1395
- }
1396
- ]
1397
- };
1398
1302
  } catch (error) {
1399
- return {
1400
- content: [
1401
- {
1402
- type: "text",
1403
- text: formatError(error)
1404
- }
1405
- ],
1406
- isError: true
1407
- };
1303
+ return toolError(error);
1304
+ }
1305
+ }
1306
+ async function checkActionNow(input, client) {
1307
+ try {
1308
+ const answer = await client.postForAnswer(
1309
+ "/api/actions/commands",
1310
+ {
1311
+ command: "check_now",
1312
+ idempotencyKey: `mcp:check_now:${input.actionId}:${randomUUID()}`,
1313
+ targets: [{ itemId: input.actionId }]
1314
+ }
1315
+ );
1316
+ const result = answer.body?.results?.[0];
1317
+ const applied2 = result?.result === "applied" || result?.result === "replayed";
1318
+ const error = result?.error ? publicMcpErrorMessage(result.error, "Fload could not check it now.") : void 0;
1319
+ return toolText(
1320
+ {
1321
+ success: applied2,
1322
+ actionId: input.actionId,
1323
+ command: "check_now",
1324
+ result: result?.result ?? "unknown",
1325
+ ...error ? { error } : {},
1326
+ message: applied2 ? "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."),
1327
+ item: result?.item
1328
+ },
1329
+ !applied2
1330
+ );
1331
+ } catch (error) {
1332
+ return toolError(error);
1333
+ }
1334
+ }
1335
+ var applied = (result) => result?.result === "applied" || result?.result === "replayed";
1336
+ async function sendItemCommand(client, body) {
1337
+ const { command, itemId, revisionId, ...extra } = body;
1338
+ const answer = await client.postForAnswer(
1339
+ "/api/actions/commands",
1340
+ {
1341
+ command,
1342
+ idempotencyKey: `mcp:${command}:${itemId}:${randomUUID()}`,
1343
+ targets: [{ itemId, ...revisionId ? { revisionId } : {} }],
1344
+ ...extra
1345
+ }
1346
+ );
1347
+ const result = answer.body?.results?.[0];
1348
+ if (applied(result)) return { result, refusal: null };
1349
+ const said = result?.error ?? answer.body?.message;
1350
+ return {
1351
+ result,
1352
+ refusal: publicMcpErrorMessage(
1353
+ said,
1354
+ answer.ok ? "Fload returned no result for the command." : "Fload rejected the request. Please check access and try again."
1355
+ )
1356
+ };
1357
+ }
1358
+ function renameAnswer(input, outcome, item) {
1359
+ const success = outcome.renamed && outcome.approved;
1360
+ return toolText(
1361
+ {
1362
+ success,
1363
+ actionId: input.actionId,
1364
+ ...outcome,
1365
+ ...item === void 0 ? {} : { item }
1366
+ },
1367
+ !success
1368
+ );
1369
+ }
1370
+ async function renameCustomPageAction(input, client) {
1371
+ try {
1372
+ const name = input.name.trim();
1373
+ const detail = await client.get(
1374
+ `/api/actions/items/${encodeURIComponent(input.actionId)}`
1375
+ );
1376
+ const item = detail.item;
1377
+ if (!item || item.kind !== "asc_custom_product_page" || !item.subjectKey?.startsWith("asc-cpp:"))
1378
+ return renameAnswer(input, {
1379
+ renamed: false,
1380
+ approved: false,
1381
+ message: "This item is not a request to create a custom product page."
1382
+ });
1383
+ const edit = await sendItemCommand(client, {
1384
+ command: "edit",
1385
+ itemId: item.id,
1386
+ revisionId: item.currentRevisionId,
1387
+ pageName: name
1388
+ });
1389
+ if (edit.refusal)
1390
+ return renameAnswer(input, {
1391
+ renamed: false,
1392
+ approved: false,
1393
+ message: edit.refusal
1394
+ });
1395
+ const renamed = edit.result?.item;
1396
+ const approve = await sendItemCommand(client, {
1397
+ command: "approve",
1398
+ itemId: item.id,
1399
+ revisionId: renamed?.currentRevisionId ?? null
1400
+ });
1401
+ return renameAnswer(
1402
+ input,
1403
+ approve.refusal ? {
1404
+ renamed: true,
1405
+ approved: false,
1406
+ // The server's own refusal, as it said it.
1407
+ message: approve.refusal,
1408
+ next: `The page is renamed to \u201C${name}\u201D and waits for approval (approve_action).`
1409
+ } : {
1410
+ renamed: true,
1411
+ approved: true,
1412
+ message: `Renamed to \u201C${name}\u201D and approved. Fload creates the page after a short undo window; the inbox shows where it is.`
1413
+ },
1414
+ approve.result?.item ?? renamed
1415
+ );
1416
+ } catch (error) {
1417
+ return toolError(error);
1408
1418
  }
1409
1419
  }
1410
1420
 
1411
1421
  // src/tools/aso.ts
1412
- import { z as z11 } from "zod";
1413
- var getAsoSummarySchema = z11.object({
1414
- assetId: z11.string().uuid().describe("App UUID to get ASO summary for")
1422
+ import { z as z8 } from "zod";
1423
+ var getAsoSummarySchema = z8.object({
1424
+ assetId: z8.string().uuid().describe("App UUID to get ASO summary for")
1415
1425
  });
1416
- var getAsoRecommendationsSchema = z11.object({
1417
- assetId: z11.string().uuid().describe("App UUID to get ASO recommendations for")
1426
+ var getAsoRecommendationsSchema = z8.object({
1427
+ assetId: z8.string().uuid().describe("App UUID to get ASO recommendations for")
1418
1428
  });
1419
- var getAsoKeywordsSchema = z11.object({
1420
- assetId: z11.string().uuid().describe("App UUID to get keyword intelligence for"),
1421
- locale: z11.string().optional().describe('Locale code to filter keywords (e.g., "en-US", "de-DE"). Returns all locales if omitted.')
1429
+ var getAsoKeywordsSchema = z8.object({
1430
+ assetId: z8.string().uuid().describe("App UUID to get keyword intelligence for"),
1431
+ locale: z8.string().optional().describe(
1432
+ 'Locale code to filter keywords (e.g., "en-US", "de-DE"). Returns all locales if omitted.'
1433
+ )
1422
1434
  });
1423
- var getAsoExperimentsSchema = z11.object({
1424
- assetId: z11.string().uuid().describe("App UUID to list ASO experiments for"),
1425
- status: z11.enum(["proposed", "approved", "applied", "measuring", "completed", "reverted"]).optional().describe("Filter experiments by status"),
1426
- limit: z11.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1427
- cursor: z11.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
1435
+ var getAsoExperimentsSchema = z8.object({
1436
+ assetId: z8.string().uuid().describe("App UUID to list ASO experiments for"),
1437
+ status: z8.enum([
1438
+ "proposed",
1439
+ "approved",
1440
+ "applied",
1441
+ "measuring",
1442
+ "completed",
1443
+ "reverted"
1444
+ ]).optional().describe("Filter experiments by status"),
1445
+ limit: z8.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1446
+ cursor: z8.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
1428
1447
  });
1429
- var getAsoLocaleSnapshotsSchema = z11.object({
1430
- assetId: z11.string().uuid().describe("App UUID to get locale snapshots for"),
1431
- store: z11.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1432
- locale: z11.string().optional().describe('Filter to a single locale (e.g. "en-US"). Returns all locales if omitted.'),
1433
- limit: z11.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1448
+ var getAsoLocaleSnapshotsSchema = z8.object({
1449
+ assetId: z8.string().uuid().describe("App UUID to get locale snapshots for"),
1450
+ store: z8.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1451
+ locale: z8.string().optional().describe(
1452
+ 'Filter to a single locale (e.g. "en-US"). Returns all locales if omitted.'
1453
+ ),
1454
+ view: z8.enum(["latest", "history"]).default("latest").describe(
1455
+ '"latest" (default) = newest snapshot per (locale, type); "history" = raw revisions newest first'
1456
+ ),
1457
+ limit: z8.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1434
1458
  });
1435
- var triggerAsoAnalysisSchema = z11.object({
1436
- assetId: z11.string().uuid().describe("App UUID to trigger ASO analysis for")
1459
+ var triggerAsoAnalysisSchema = z8.object({
1460
+ assetId: z8.string().uuid().describe("App UUID to trigger ASO analysis for")
1437
1461
  });
1438
1462
  async function getAsoSummary(input, client) {
1439
1463
  try {
1440
- const response = await client.get(`/api/assets/${input.assetId}/aso/summary`);
1464
+ const response = await client.get(
1465
+ `/api/assets/${input.assetId}/aso/summary`
1466
+ );
1441
1467
  return {
1442
1468
  content: [
1443
1469
  {
@@ -1460,7 +1486,9 @@ async function getAsoSummary(input, client) {
1460
1486
  }
1461
1487
  async function getAsoRecommendations(input, client) {
1462
1488
  try {
1463
- const response = await client.get(`/api/assets/${input.assetId}/aso/recommendations`);
1489
+ const response = await client.get(
1490
+ `/api/assets/${input.assetId}/aso/recommendations`
1491
+ );
1464
1492
  return {
1465
1493
  content: [
1466
1494
  {
@@ -1484,9 +1512,11 @@ async function getAsoRecommendations(input, client) {
1484
1512
  async function getAsoKeywords(input, client) {
1485
1513
  try {
1486
1514
  const params = {};
1487
- if (input.locale)
1488
- params.locale = input.locale;
1489
- const response = await client.get(`/api/assets/${input.assetId}/aso/keyword-intelligence`, params);
1515
+ if (input.locale) params.locale = input.locale;
1516
+ const response = await client.get(
1517
+ `/api/assets/${input.assetId}/aso/keyword-intelligence`,
1518
+ params
1519
+ );
1490
1520
  return {
1491
1521
  content: [
1492
1522
  {
@@ -1513,9 +1543,11 @@ async function getAsoExperiments(input, client) {
1513
1543
  limit: input.limit,
1514
1544
  cursor: input.cursor
1515
1545
  };
1516
- if (input.status)
1517
- params.status = input.status;
1518
- const response = await client.get(`/api/assets/${input.assetId}/aso/experiments`, params);
1546
+ if (input.status) params.status = input.status;
1547
+ const response = await client.get(
1548
+ `/api/assets/${input.assetId}/aso/experiments`,
1549
+ params
1550
+ );
1519
1551
  return {
1520
1552
  content: [
1521
1553
  {
@@ -1543,6 +1575,7 @@ async function getAsoLocaleSnapshots(input, client) {
1543
1575
  {
1544
1576
  store: input.store,
1545
1577
  locale: input.locale,
1578
+ view: input.view,
1546
1579
  limit: input.limit
1547
1580
  }
1548
1581
  );
@@ -1592,20 +1625,40 @@ async function triggerAsoAnalysis(input, client) {
1592
1625
  };
1593
1626
  }
1594
1627
  }
1628
+ var getAsoEvidenceSchema = z8.object({ assetId: z8.string().uuid() });
1629
+ async function getAsoEvidence(input, client) {
1630
+ try {
1631
+ const response = await client.get(
1632
+ `/api/assets/${input.assetId}/aso/methodology`
1633
+ );
1634
+ return {
1635
+ content: [{ type: "text", text: formatAsJson(response) }]
1636
+ };
1637
+ } catch (error) {
1638
+ return {
1639
+ content: [{ type: "text", text: formatError(error) }],
1640
+ isError: true
1641
+ };
1642
+ }
1643
+ }
1595
1644
 
1596
1645
  // src/tools/chat.ts
1597
- import { randomUUID } from "node:crypto";
1598
- import { z as z12 } from "zod";
1599
- var listConversationsSchema = z12.object({
1600
- limit: z12.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
1646
+ import { randomUUID as randomUUID2 } from "node:crypto";
1647
+ import { z as z9 } from "zod";
1648
+ var listConversationsSchema = z9.object({
1649
+ limit: z9.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
1601
1650
  });
1602
- var getConversationMessagesSchema = z12.object({
1603
- conversationId: z12.string().uuid().describe("The conversation UUID to get messages for")
1651
+ var getConversationMessagesSchema = z9.object({
1652
+ conversationId: z9.string().uuid().describe("The conversation UUID to get messages for")
1604
1653
  });
1605
- var sendChatMessageSchema = z12.object({
1606
- message: z12.string().describe("The message to send to the AI chat"),
1607
- conversationId: z12.string().uuid().optional().describe("Existing conversation UUID to continue. Starts a new conversation if omitted."),
1608
- agentType: z12.string().optional().describe("Agent type to use for the conversation (e.g., review, monitoring, forecasting)")
1654
+ var sendChatMessageSchema = z9.object({
1655
+ message: z9.string().describe("The message to send to the AI chat"),
1656
+ conversationId: z9.string().uuid().optional().describe(
1657
+ "Existing conversation UUID to continue. Starts a new conversation if omitted."
1658
+ ),
1659
+ agentType: z9.string().optional().describe(
1660
+ "Agent type to use for the conversation (e.g., review, monitoring)"
1661
+ )
1609
1662
  });
1610
1663
  async function listConversations(input, client) {
1611
1664
  try {
@@ -1638,7 +1691,9 @@ async function listConversations(input, client) {
1638
1691
  }
1639
1692
  async function getConversationMessages(input, client) {
1640
1693
  try {
1641
- const response = await client.get(`/api/chat/messages/${input.conversationId}`);
1694
+ const response = await client.get(
1695
+ `/api/chat/messages/${input.conversationId}`
1696
+ );
1642
1697
  const messages = response.data || response.messages || response;
1643
1698
  return {
1644
1699
  content: [
@@ -1668,11 +1723,9 @@ function parseUiMessageStream(raw) {
1668
1723
  let reply = "";
1669
1724
  const toolsUsed = [];
1670
1725
  for (const line of raw.split("\n")) {
1671
- if (!line.startsWith("data:"))
1672
- continue;
1726
+ if (!line.startsWith("data:")) continue;
1673
1727
  const payload = line.slice(5).trim();
1674
- if (!payload || payload === "[DONE]")
1675
- continue;
1728
+ if (!payload || payload === "[DONE]") continue;
1676
1729
  try {
1677
1730
  const event = JSON.parse(payload);
1678
1731
  if (event.type === "text-delta") {
@@ -1687,7 +1740,7 @@ function parseUiMessageStream(raw) {
1687
1740
  }
1688
1741
  async function sendChatMessage(input, client) {
1689
1742
  try {
1690
- const conversationId = input.conversationId ?? randomUUID();
1743
+ const conversationId = input.conversationId ?? randomUUID2();
1691
1744
  let priorMessages = [];
1692
1745
  if (input.conversationId) {
1693
1746
  const history = await client.get(`/api/chat/messages/${input.conversationId}`, { limit: 1e3 });
@@ -1695,8 +1748,7 @@ async function sendChatMessage(input, client) {
1695
1748
  const textParts = (message.parts ?? []).filter(
1696
1749
  (part) => part.type === "text" && typeof part.text === "string"
1697
1750
  );
1698
- if (textParts.length === 0)
1699
- continue;
1751
+ if (textParts.length === 0) continue;
1700
1752
  priorMessages.push({
1701
1753
  id: message.id,
1702
1754
  role: message.role,
@@ -1710,7 +1762,7 @@ async function sendChatMessage(input, client) {
1710
1762
  messages: [
1711
1763
  ...priorMessages,
1712
1764
  {
1713
- id: randomUUID(),
1765
+ id: randomUUID2(),
1714
1766
  role: "user",
1715
1767
  parts: [{ type: "text", text: input.message }]
1716
1768
  }
@@ -1782,7 +1834,7 @@ function registerTools(server, client, options = {}) {
1782
1834
  {
1783
1835
  title,
1784
1836
  description,
1785
- inputSchema: schema.shape,
1837
+ inputSchema: schema,
1786
1838
  annotations: { title, ...annotations }
1787
1839
  },
1788
1840
  wrapTool(handler)
@@ -1839,7 +1891,7 @@ function registerTools(server, client, options = {}) {
1839
1891
  tool(
1840
1892
  "discover_metrics",
1841
1893
  "Discover available metrics",
1842
- "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.",
1894
+ "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.",
1843
1895
  discoverMetricsSchema,
1844
1896
  discoverMetrics,
1845
1897
  { readOnlyHint: true, openWorldHint: false }
@@ -1847,7 +1899,7 @@ function registerTools(server, client, options = {}) {
1847
1899
  tool(
1848
1900
  "get_metrics",
1849
1901
  "Get metrics",
1850
- "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.",
1902
+ "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.",
1851
1903
  getMetricsSchema,
1852
1904
  getMetrics,
1853
1905
  { readOnlyHint: true, openWorldHint: false }
@@ -1863,7 +1915,7 @@ function registerTools(server, client, options = {}) {
1863
1915
  tool(
1864
1916
  "list_agents",
1865
1917
  "List agents",
1866
- "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.",
1918
+ "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.",
1867
1919
  listAgentsSchema,
1868
1920
  listAgents,
1869
1921
  { readOnlyHint: true, openWorldHint: false }
@@ -1871,7 +1923,7 @@ function registerTools(server, client, options = {}) {
1871
1923
  tool(
1872
1924
  "get_agent_details",
1873
1925
  "Get agent details",
1874
- "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.",
1926
+ "Get detailed configuration and status for a specific agent type. For the review agent, returns per-asset settings (mode, tone, custom instructions).",
1875
1927
  getAgentDetailsSchema,
1876
1928
  getAgentDetails,
1877
1929
  { readOnlyHint: true, openWorldHint: false }
@@ -1879,7 +1931,7 @@ function registerTools(server, client, options = {}) {
1879
1931
  tool(
1880
1932
  "get_agent_run_history",
1881
1933
  "Get agent run history",
1882
- "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.",
1934
+ "Get run history for a specific agent type. Returns run status, timing, and error details.",
1883
1935
  getAgentRunHistorySchema,
1884
1936
  getAgentRunHistory,
1885
1937
  { readOnlyHint: true, openWorldHint: false }
@@ -1887,7 +1939,7 @@ function registerTools(server, client, options = {}) {
1887
1939
  tool(
1888
1940
  "trigger_agent_run",
1889
1941
  "Trigger agent run",
1890
- "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.",
1942
+ "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.",
1891
1943
  triggerAgentRunSchema,
1892
1944
  triggerAgentRun,
1893
1945
  { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
@@ -1895,59 +1947,37 @@ function registerTools(server, client, options = {}) {
1895
1947
  tool(
1896
1948
  "pause_agent",
1897
1949
  "Pause agent",
1898
- "Pause a running agent. The agent will stop processing until resumed. Reversible via resume_agent.",
1950
+ "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.",
1899
1951
  pauseAgentSchema,
1900
1952
  pauseAgent,
1901
- { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
1953
+ {
1954
+ readOnlyHint: false,
1955
+ destructiveHint: false,
1956
+ idempotentHint: true,
1957
+ openWorldHint: false
1958
+ }
1902
1959
  );
1903
1960
  tool(
1904
1961
  "resume_agent",
1905
1962
  "Resume agent",
1906
- "Resume a paused agent. The agent will continue processing from where it left off. Reversible via pause_agent.",
1963
+ "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.",
1907
1964
  resumeAgentSchema,
1908
1965
  resumeAgent,
1909
- { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
1966
+ {
1967
+ readOnlyHint: false,
1968
+ destructiveHint: false,
1969
+ idempotentHint: true,
1970
+ openWorldHint: false
1971
+ }
1910
1972
  );
1911
1973
  tool(
1912
1974
  "get_agent_activity",
1913
1975
  "Get agent activity",
1914
- "Get the recent activity log for an agent. Returns a chronological list of actions the agent has taken, including timestamps, event types, and details.",
1976
+ "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.",
1915
1977
  getAgentActivitySchema,
1916
1978
  getAgentActivity,
1917
1979
  { readOnlyHint: true, openWorldHint: false }
1918
1980
  );
1919
- tool(
1920
- "get_anomalies",
1921
- "Get anomalies",
1922
- "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.",
1923
- getAnomaliesSchema,
1924
- getAnomalies,
1925
- { readOnlyHint: true, openWorldHint: false }
1926
- );
1927
- tool(
1928
- "get_anomaly_detail",
1929
- "Get anomaly detail",
1930
- "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.",
1931
- getAnomalyDetailSchema,
1932
- getAnomalyDetail,
1933
- { readOnlyHint: true, openWorldHint: false }
1934
- );
1935
- tool(
1936
- "acknowledge_anomaly",
1937
- "Acknowledge anomaly",
1938
- '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.',
1939
- acknowledgeAnomalySchema,
1940
- acknowledgeAnomaly,
1941
- { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
1942
- );
1943
- tool(
1944
- "dismiss_anomaly",
1945
- "Dismiss anomaly",
1946
- '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.',
1947
- dismissAnomalySchema,
1948
- dismissAnomaly,
1949
- { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
1950
- );
1951
1981
  tool(
1952
1982
  "get_ads_performance",
1953
1983
  "Get ads performance",
@@ -1956,34 +1986,10 @@ function registerTools(server, client, options = {}) {
1956
1986
  getAdsPerformance,
1957
1987
  { readOnlyHint: true, openWorldHint: false }
1958
1988
  );
1959
- tool(
1960
- "get_growth_audit",
1961
- "Get growth audit",
1962
- "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.",
1963
- getGrowthAuditSchema,
1964
- getGrowthAudit,
1965
- { readOnlyHint: true, openWorldHint: false }
1966
- );
1967
- tool(
1968
- "get_growth_score",
1969
- "Get growth score",
1970
- "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.",
1971
- getGrowthScoreSchema,
1972
- getGrowthScore,
1973
- { readOnlyHint: true, openWorldHint: false }
1974
- );
1975
- tool(
1976
- "get_forecasts",
1977
- "Get forecasts",
1978
- "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.",
1979
- getForecastsSchema,
1980
- getForecasts,
1981
- { readOnlyHint: true, openWorldHint: false }
1982
- );
1983
1989
  tool(
1984
1990
  "get_dashboard_overview",
1985
1991
  "Get dashboard overview",
1986
- "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).",
1992
+ "Get an aggregated dashboard overview for the organization. Returns portfolio summary (apps, valuations, ratings), data connector health status, and alerts (pending review drafts).",
1987
1993
  getDashboardOverviewSchema,
1988
1994
  getDashboardOverview,
1989
1995
  { readOnlyHint: true, openWorldHint: false }
@@ -1991,7 +1997,7 @@ function registerTools(server, client, options = {}) {
1991
1997
  tool(
1992
1998
  "list_pending_actions",
1993
1999
  "List pending actions",
1994
- "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.",
2000
+ '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.',
1995
2001
  listPendingActionsSchema,
1996
2002
  listPendingActions,
1997
2003
  { readOnlyHint: true, openWorldHint: false }
@@ -1999,7 +2005,7 @@ function registerTools(server, client, options = {}) {
1999
2005
  tool(
2000
2006
  "approve_action",
2001
2007
  "Approve pending action",
2002
- "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.",
2008
+ "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).",
2003
2009
  approveActionSchema,
2004
2010
  approveAction,
2005
2011
  { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
@@ -2007,11 +2013,27 @@ function registerTools(server, client, options = {}) {
2007
2013
  tool(
2008
2014
  "reject_action",
2009
2015
  "Reject pending action",
2010
- "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.",
2016
+ "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.",
2011
2017
  rejectActionSchema,
2012
2018
  rejectAction,
2013
2019
  { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
2014
2020
  );
2021
+ tool(
2022
+ "check_action_now",
2023
+ "Check a change in the store now",
2024
+ '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.',
2025
+ checkActionNowSchema,
2026
+ checkActionNow,
2027
+ { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
2028
+ );
2029
+ tool(
2030
+ "rename_custom_page_action",
2031
+ "Rename a custom product page request and send it",
2032
+ 'For a "Create custom product page" inbox item (actionId from list_pending_actions) that App Store Connect refused because the app already has a page of that name, or one still waiting for approval: rename it (name: at most 100 characters, not its current name, not a page the app already has) and approve it again on the same item. Fload then creates the page under the new name after a short undo window. Treat as destructive: it creates a page in App Store Connect. If the approve is refused, the item keeps its new name and waits for approval.',
2033
+ renameCustomPageActionSchema,
2034
+ renameCustomPageAction,
2035
+ { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
2036
+ );
2015
2037
  tool(
2016
2038
  "get_aso_summary",
2017
2039
  "Get ASO summary",
@@ -2028,6 +2050,14 @@ function registerTools(server, client, options = {}) {
2028
2050
  getAsoRecommendations,
2029
2051
  { readOnlyHint: true, openWorldHint: false }
2030
2052
  );
2053
+ tool(
2054
+ "get_aso_evidence",
2055
+ "Get ASO decisions and evidence",
2056
+ "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.",
2057
+ getAsoEvidenceSchema,
2058
+ getAsoEvidence,
2059
+ { readOnlyHint: true, openWorldHint: false }
2060
+ );
2031
2061
  tool(
2032
2062
  "get_aso_keywords",
2033
2063
  "Get ASO keywords",
@@ -2047,7 +2077,7 @@ function registerTools(server, client, options = {}) {
2047
2077
  tool(
2048
2078
  "get_aso_locale_snapshots",
2049
2079
  "Get ASO locale snapshots",
2050
- "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.",
2080
+ '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.',
2051
2081
  getAsoLocaleSnapshotsSchema,
2052
2082
  getAsoLocaleSnapshots,
2053
2083
  { readOnlyHint: true, openWorldHint: false }
@@ -2079,23 +2109,21 @@ function registerTools(server, client, options = {}) {
2079
2109
  tool(
2080
2110
  "send_chat_message",
2081
2111
  "Send chat message",
2082
- "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.",
2112
+ "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.",
2083
2113
  sendChatMessageSchema,
2084
2114
  sendChatMessage,
2085
2115
  { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
2086
2116
  );
2087
2117
  }
2088
2118
  export {
2089
- acknowledgeAnomaly,
2090
- acknowledgeAnomalySchema,
2091
2119
  approveAction,
2092
2120
  approveActionSchema,
2121
+ checkActionNow,
2122
+ checkActionNowSchema,
2093
2123
  discoverDimensions,
2094
2124
  discoverDimensionsSchema,
2095
2125
  discoverMetrics,
2096
2126
  discoverMetricsSchema,
2097
- dismissAnomaly,
2098
- dismissAnomalySchema,
2099
2127
  generateReviewReply,
2100
2128
  generateReviewReplySchema,
2101
2129
  getAdsPerformance,
@@ -2106,12 +2134,10 @@ export {
2106
2134
  getAgentDetailsSchema,
2107
2135
  getAgentRunHistory,
2108
2136
  getAgentRunHistorySchema,
2109
- getAnomalies,
2110
- getAnomaliesSchema,
2111
- getAnomalyDetail,
2112
- getAnomalyDetailSchema,
2113
2137
  getAppDetails,
2114
2138
  getAppDetailsSchema,
2139
+ getAsoEvidence,
2140
+ getAsoEvidenceSchema,
2115
2141
  getAsoExperiments,
2116
2142
  getAsoExperimentsSchema,
2117
2143
  getAsoKeywords,
@@ -2126,12 +2152,6 @@ export {
2126
2152
  getConversationMessagesSchema,
2127
2153
  getDashboardOverview,
2128
2154
  getDashboardOverviewSchema,
2129
- getForecasts,
2130
- getForecastsSchema,
2131
- getGrowthAudit,
2132
- getGrowthAuditSchema,
2133
- getGrowthScore,
2134
- getGrowthScoreSchema,
2135
2155
  getMetrics,
2136
2156
  getMetricsSchema,
2137
2157
  getReviews,
@@ -2150,6 +2170,8 @@ export {
2150
2170
  registerTools,
2151
2171
  rejectAction,
2152
2172
  rejectActionSchema,
2173
+ renameCustomPageAction,
2174
+ renameCustomPageActionSchema,
2153
2175
  resumeAgent,
2154
2176
  resumeAgentSchema,
2155
2177
  sendChatMessage,