@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
@@ -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,249 @@ 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
+ function commandFor(kind, intent) {
1180
+ if (kind === "notice")
1181
+ return intent === "approve" ? "acknowledge" : "dismiss";
1182
+ return intent;
1183
+ }
1184
+ function toolText(payload, isError = false) {
1185
+ return {
1186
+ content: [{ type: "text", text: formatAsJson(payload) }],
1187
+ ...isError ? { isError: true } : {}
1188
+ };
1189
+ }
1190
+ function toolError(error) {
1191
+ return {
1192
+ content: [{ type: "text", text: formatError(error) }],
1193
+ isError: true
1194
+ };
1195
+ }
1309
1196
  async function listPendingActions(input, client) {
1310
1197
  try {
1311
- const params = {
1312
- limit: input.limit
1313
- };
1314
1198
  const response = await client.get(
1315
- "/api/pending-actions",
1316
- params
1199
+ "/api/actions/items",
1200
+ { view: input.view ?? "open", assetId: input.assetId, limit: input.limit }
1317
1201
  );
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
- };
1202
+ const actions = response.items ?? [];
1203
+ return toolText({
1204
+ total: actions.length,
1205
+ actions,
1206
+ hasMore: Boolean(response.nextCursor)
1207
+ });
1335
1208
  } catch (error) {
1336
- return {
1337
- content: [
1338
- {
1339
- type: "text",
1340
- text: formatError(error)
1209
+ return toolError(error);
1210
+ }
1211
+ }
1212
+ async function commandItem(client, itemId, intent, reason) {
1213
+ const detail = await client.get(
1214
+ `/api/actions/items/${encodeURIComponent(itemId)}`
1215
+ );
1216
+ const item = detail.item;
1217
+ if (!item) throw new Error("Action not found");
1218
+ const command = commandFor(item.kind, intent);
1219
+ const answer = await client.postForAnswer(
1220
+ "/api/actions/commands",
1221
+ {
1222
+ command,
1223
+ idempotencyKey: `mcp:${command}:${item.id}:${randomUUID()}`,
1224
+ targets: [
1225
+ {
1226
+ itemId: item.id,
1227
+ ...command === "approve" && item.currentRevisionId ? { revisionId: item.currentRevisionId } : {}
1341
1228
  }
1342
1229
  ],
1343
- isError: true
1344
- };
1345
- }
1230
+ ...command === "reject" && reason ? { reason } : {}
1231
+ }
1232
+ );
1233
+ const result = answer.body?.results?.[0];
1234
+ if (!result)
1235
+ throw new Error(
1236
+ answer.ok ? "Fload returned no result for the command." : "Fload rejected the request. Please check access and try again."
1237
+ );
1238
+ return {
1239
+ command,
1240
+ result: {
1241
+ ...result,
1242
+ error: result.error ? publicMcpErrorMessage(
1243
+ result.error,
1244
+ "Fload could not apply this change."
1245
+ ) : void 0
1246
+ }
1247
+ };
1346
1248
  }
1347
1249
  async function approveAction(input, client) {
1348
1250
  try {
1349
- const response = await client.post(
1350
- `/api/pending-actions/${input.actionId}/approve`,
1351
- {}
1251
+ const { command, result } = await commandItem(
1252
+ client,
1253
+ input.actionId,
1254
+ "approve"
1255
+ );
1256
+ const applied = result?.result === "applied" || result?.result === "replayed";
1257
+ return toolText(
1258
+ {
1259
+ success: applied,
1260
+ actionId: input.actionId,
1261
+ command,
1262
+ result: result?.result ?? "unknown",
1263
+ ...result?.error ? { error: result.error } : {},
1264
+ 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.",
1265
+ item: result?.item
1266
+ },
1267
+ !applied
1352
1268
  );
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
1269
  } catch (error) {
1368
- return {
1369
- content: [
1370
- {
1371
- type: "text",
1372
- text: formatError(error)
1373
- }
1374
- ],
1375
- isError: true
1376
- };
1270
+ return toolError(error);
1377
1271
  }
1378
1272
  }
1379
1273
  async function rejectAction(input, client) {
1380
1274
  try {
1381
- const response = await client.post(
1382
- `/api/pending-actions/${input.actionId}/reject`
1275
+ const { command, result } = await commandItem(
1276
+ client,
1277
+ input.actionId,
1278
+ "reject",
1279
+ input.reason
1280
+ );
1281
+ const applied = result?.result === "applied" || result?.result === "replayed";
1282
+ return toolText(
1283
+ {
1284
+ success: applied,
1285
+ actionId: input.actionId,
1286
+ command,
1287
+ result: result?.result ?? "unknown",
1288
+ ...result?.error ? { error: result.error } : {},
1289
+ message: applied ? command === "dismiss" ? "Dismissed." : "Rejected. Nothing was sent." : result?.error ?? "The rejection could not be recorded.",
1290
+ item: result?.item
1291
+ },
1292
+ !applied
1383
1293
  );
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
1294
  } catch (error) {
1399
- return {
1400
- content: [
1401
- {
1402
- type: "text",
1403
- text: formatError(error)
1404
- }
1405
- ],
1406
- isError: true
1407
- };
1295
+ return toolError(error);
1296
+ }
1297
+ }
1298
+ async function checkActionNow(input, client) {
1299
+ try {
1300
+ const answer = await client.postForAnswer(
1301
+ "/api/actions/commands",
1302
+ {
1303
+ command: "check_now",
1304
+ idempotencyKey: `mcp:check_now:${input.actionId}:${randomUUID()}`,
1305
+ targets: [{ itemId: input.actionId }]
1306
+ }
1307
+ );
1308
+ const result = answer.body?.results?.[0];
1309
+ const applied = result?.result === "applied" || result?.result === "replayed";
1310
+ const error = result?.error ? publicMcpErrorMessage(result.error, "Fload could not check it now.") : void 0;
1311
+ return toolText(
1312
+ {
1313
+ success: applied,
1314
+ actionId: input.actionId,
1315
+ command: "check_now",
1316
+ result: result?.result ?? "unknown",
1317
+ ...error ? { error } : {},
1318
+ 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."),
1319
+ item: result?.item
1320
+ },
1321
+ !applied
1322
+ );
1323
+ } catch (error) {
1324
+ return toolError(error);
1408
1325
  }
1409
1326
  }
1410
1327
 
1411
1328
  // 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")
1329
+ import { z as z8 } from "zod";
1330
+ var getAsoSummarySchema = z8.object({
1331
+ assetId: z8.string().uuid().describe("App UUID to get ASO summary for")
1415
1332
  });
1416
- var getAsoRecommendationsSchema = z11.object({
1417
- assetId: z11.string().uuid().describe("App UUID to get ASO recommendations for")
1333
+ var getAsoRecommendationsSchema = z8.object({
1334
+ assetId: z8.string().uuid().describe("App UUID to get ASO recommendations for")
1418
1335
  });
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.')
1336
+ var getAsoKeywordsSchema = z8.object({
1337
+ assetId: z8.string().uuid().describe("App UUID to get keyword intelligence for"),
1338
+ locale: z8.string().optional().describe(
1339
+ 'Locale code to filter keywords (e.g., "en-US", "de-DE"). Returns all locales if omitted.'
1340
+ )
1422
1341
  });
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)")
1342
+ var getAsoExperimentsSchema = z8.object({
1343
+ assetId: z8.string().uuid().describe("App UUID to list ASO experiments for"),
1344
+ status: z8.enum([
1345
+ "proposed",
1346
+ "approved",
1347
+ "applied",
1348
+ "measuring",
1349
+ "completed",
1350
+ "reverted"
1351
+ ]).optional().describe("Filter experiments by status"),
1352
+ limit: z8.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1353
+ cursor: z8.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
1428
1354
  });
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)")
1355
+ var getAsoLocaleSnapshotsSchema = z8.object({
1356
+ assetId: z8.string().uuid().describe("App UUID to get locale snapshots for"),
1357
+ store: z8.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1358
+ locale: z8.string().optional().describe(
1359
+ 'Filter to a single locale (e.g. "en-US"). Returns all locales if omitted.'
1360
+ ),
1361
+ view: z8.enum(["latest", "history"]).default("latest").describe(
1362
+ '"latest" (default) = newest snapshot per (locale, type); "history" = raw revisions newest first'
1363
+ ),
1364
+ limit: z8.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1434
1365
  });
1435
- var triggerAsoAnalysisSchema = z11.object({
1436
- assetId: z11.string().uuid().describe("App UUID to trigger ASO analysis for")
1366
+ var triggerAsoAnalysisSchema = z8.object({
1367
+ assetId: z8.string().uuid().describe("App UUID to trigger ASO analysis for")
1437
1368
  });
1438
1369
  async function getAsoSummary(input, client) {
1439
1370
  try {
1440
- const response = await client.get(`/api/assets/${input.assetId}/aso/summary`);
1371
+ const response = await client.get(
1372
+ `/api/assets/${input.assetId}/aso/summary`
1373
+ );
1441
1374
  return {
1442
1375
  content: [
1443
1376
  {
@@ -1460,7 +1393,9 @@ async function getAsoSummary(input, client) {
1460
1393
  }
1461
1394
  async function getAsoRecommendations(input, client) {
1462
1395
  try {
1463
- const response = await client.get(`/api/assets/${input.assetId}/aso/recommendations`);
1396
+ const response = await client.get(
1397
+ `/api/assets/${input.assetId}/aso/recommendations`
1398
+ );
1464
1399
  return {
1465
1400
  content: [
1466
1401
  {
@@ -1484,9 +1419,11 @@ async function getAsoRecommendations(input, client) {
1484
1419
  async function getAsoKeywords(input, client) {
1485
1420
  try {
1486
1421
  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);
1422
+ if (input.locale) params.locale = input.locale;
1423
+ const response = await client.get(
1424
+ `/api/assets/${input.assetId}/aso/keyword-intelligence`,
1425
+ params
1426
+ );
1490
1427
  return {
1491
1428
  content: [
1492
1429
  {
@@ -1513,9 +1450,11 @@ async function getAsoExperiments(input, client) {
1513
1450
  limit: input.limit,
1514
1451
  cursor: input.cursor
1515
1452
  };
1516
- if (input.status)
1517
- params.status = input.status;
1518
- const response = await client.get(`/api/assets/${input.assetId}/aso/experiments`, params);
1453
+ if (input.status) params.status = input.status;
1454
+ const response = await client.get(
1455
+ `/api/assets/${input.assetId}/aso/experiments`,
1456
+ params
1457
+ );
1519
1458
  return {
1520
1459
  content: [
1521
1460
  {
@@ -1543,6 +1482,7 @@ async function getAsoLocaleSnapshots(input, client) {
1543
1482
  {
1544
1483
  store: input.store,
1545
1484
  locale: input.locale,
1485
+ view: input.view,
1546
1486
  limit: input.limit
1547
1487
  }
1548
1488
  );
@@ -1592,20 +1532,40 @@ async function triggerAsoAnalysis(input, client) {
1592
1532
  };
1593
1533
  }
1594
1534
  }
1535
+ var getAsoEvidenceSchema = z8.object({ assetId: z8.string().uuid() });
1536
+ async function getAsoEvidence(input, client) {
1537
+ try {
1538
+ const response = await client.get(
1539
+ `/api/assets/${input.assetId}/aso/methodology`
1540
+ );
1541
+ return {
1542
+ content: [{ type: "text", text: formatAsJson(response) }]
1543
+ };
1544
+ } catch (error) {
1545
+ return {
1546
+ content: [{ type: "text", text: formatError(error) }],
1547
+ isError: true
1548
+ };
1549
+ }
1550
+ }
1595
1551
 
1596
1552
  // 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")
1553
+ import { randomUUID as randomUUID2 } from "node:crypto";
1554
+ import { z as z9 } from "zod";
1555
+ var listConversationsSchema = z9.object({
1556
+ limit: z9.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
1601
1557
  });
1602
- var getConversationMessagesSchema = z12.object({
1603
- conversationId: z12.string().uuid().describe("The conversation UUID to get messages for")
1558
+ var getConversationMessagesSchema = z9.object({
1559
+ conversationId: z9.string().uuid().describe("The conversation UUID to get messages for")
1604
1560
  });
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)")
1561
+ var sendChatMessageSchema = z9.object({
1562
+ message: z9.string().describe("The message to send to the AI chat"),
1563
+ conversationId: z9.string().uuid().optional().describe(
1564
+ "Existing conversation UUID to continue. Starts a new conversation if omitted."
1565
+ ),
1566
+ agentType: z9.string().optional().describe(
1567
+ "Agent type to use for the conversation (e.g., review, monitoring)"
1568
+ )
1609
1569
  });
1610
1570
  async function listConversations(input, client) {
1611
1571
  try {
@@ -1638,7 +1598,9 @@ async function listConversations(input, client) {
1638
1598
  }
1639
1599
  async function getConversationMessages(input, client) {
1640
1600
  try {
1641
- const response = await client.get(`/api/chat/messages/${input.conversationId}`);
1601
+ const response = await client.get(
1602
+ `/api/chat/messages/${input.conversationId}`
1603
+ );
1642
1604
  const messages = response.data || response.messages || response;
1643
1605
  return {
1644
1606
  content: [
@@ -1668,11 +1630,9 @@ function parseUiMessageStream(raw) {
1668
1630
  let reply = "";
1669
1631
  const toolsUsed = [];
1670
1632
  for (const line of raw.split("\n")) {
1671
- if (!line.startsWith("data:"))
1672
- continue;
1633
+ if (!line.startsWith("data:")) continue;
1673
1634
  const payload = line.slice(5).trim();
1674
- if (!payload || payload === "[DONE]")
1675
- continue;
1635
+ if (!payload || payload === "[DONE]") continue;
1676
1636
  try {
1677
1637
  const event = JSON.parse(payload);
1678
1638
  if (event.type === "text-delta") {
@@ -1687,7 +1647,7 @@ function parseUiMessageStream(raw) {
1687
1647
  }
1688
1648
  async function sendChatMessage(input, client) {
1689
1649
  try {
1690
- const conversationId = input.conversationId ?? randomUUID();
1650
+ const conversationId = input.conversationId ?? randomUUID2();
1691
1651
  let priorMessages = [];
1692
1652
  if (input.conversationId) {
1693
1653
  const history = await client.get(`/api/chat/messages/${input.conversationId}`, { limit: 1e3 });
@@ -1695,8 +1655,7 @@ async function sendChatMessage(input, client) {
1695
1655
  const textParts = (message.parts ?? []).filter(
1696
1656
  (part) => part.type === "text" && typeof part.text === "string"
1697
1657
  );
1698
- if (textParts.length === 0)
1699
- continue;
1658
+ if (textParts.length === 0) continue;
1700
1659
  priorMessages.push({
1701
1660
  id: message.id,
1702
1661
  role: message.role,
@@ -1710,7 +1669,7 @@ async function sendChatMessage(input, client) {
1710
1669
  messages: [
1711
1670
  ...priorMessages,
1712
1671
  {
1713
- id: randomUUID(),
1672
+ id: randomUUID2(),
1714
1673
  role: "user",
1715
1674
  parts: [{ type: "text", text: input.message }]
1716
1675
  }
@@ -1782,7 +1741,7 @@ function registerTools(server, client, options = {}) {
1782
1741
  {
1783
1742
  title,
1784
1743
  description,
1785
- inputSchema: schema.shape,
1744
+ inputSchema: schema,
1786
1745
  annotations: { title, ...annotations }
1787
1746
  },
1788
1747
  wrapTool(handler)
@@ -1839,7 +1798,7 @@ function registerTools(server, client, options = {}) {
1839
1798
  tool(
1840
1799
  "discover_metrics",
1841
1800
  "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.",
1801
+ "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
1802
  discoverMetricsSchema,
1844
1803
  discoverMetrics,
1845
1804
  { readOnlyHint: true, openWorldHint: false }
@@ -1847,7 +1806,7 @@ function registerTools(server, client, options = {}) {
1847
1806
  tool(
1848
1807
  "get_metrics",
1849
1808
  "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.",
1809
+ "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
1810
  getMetricsSchema,
1852
1811
  getMetrics,
1853
1812
  { readOnlyHint: true, openWorldHint: false }
@@ -1863,7 +1822,7 @@ function registerTools(server, client, options = {}) {
1863
1822
  tool(
1864
1823
  "list_agents",
1865
1824
  "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.",
1825
+ "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
1826
  listAgentsSchema,
1868
1827
  listAgents,
1869
1828
  { readOnlyHint: true, openWorldHint: false }
@@ -1871,7 +1830,7 @@ function registerTools(server, client, options = {}) {
1871
1830
  tool(
1872
1831
  "get_agent_details",
1873
1832
  "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.",
1833
+ "Get detailed configuration and status for a specific agent type. For the review agent, returns per-asset settings (mode, tone, custom instructions).",
1875
1834
  getAgentDetailsSchema,
1876
1835
  getAgentDetails,
1877
1836
  { readOnlyHint: true, openWorldHint: false }
@@ -1879,7 +1838,7 @@ function registerTools(server, client, options = {}) {
1879
1838
  tool(
1880
1839
  "get_agent_run_history",
1881
1840
  "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.",
1841
+ "Get run history for a specific agent type. Returns run status, timing, and error details.",
1883
1842
  getAgentRunHistorySchema,
1884
1843
  getAgentRunHistory,
1885
1844
  { readOnlyHint: true, openWorldHint: false }
@@ -1887,7 +1846,7 @@ function registerTools(server, client, options = {}) {
1887
1846
  tool(
1888
1847
  "trigger_agent_run",
1889
1848
  "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.",
1849
+ "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
1850
  triggerAgentRunSchema,
1892
1851
  triggerAgentRun,
1893
1852
  { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
@@ -1895,59 +1854,37 @@ function registerTools(server, client, options = {}) {
1895
1854
  tool(
1896
1855
  "pause_agent",
1897
1856
  "Pause agent",
1898
- "Pause a running agent. The agent will stop processing until resumed. Reversible via resume_agent.",
1857
+ "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
1858
  pauseAgentSchema,
1900
1859
  pauseAgent,
1901
- { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
1860
+ {
1861
+ readOnlyHint: false,
1862
+ destructiveHint: false,
1863
+ idempotentHint: true,
1864
+ openWorldHint: false
1865
+ }
1902
1866
  );
1903
1867
  tool(
1904
1868
  "resume_agent",
1905
1869
  "Resume agent",
1906
- "Resume a paused agent. The agent will continue processing from where it left off. Reversible via pause_agent.",
1870
+ "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
1871
  resumeAgentSchema,
1908
1872
  resumeAgent,
1909
- { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false }
1873
+ {
1874
+ readOnlyHint: false,
1875
+ destructiveHint: false,
1876
+ idempotentHint: true,
1877
+ openWorldHint: false
1878
+ }
1910
1879
  );
1911
1880
  tool(
1912
1881
  "get_agent_activity",
1913
1882
  "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.",
1883
+ "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
1884
  getAgentActivitySchema,
1916
1885
  getAgentActivity,
1917
1886
  { readOnlyHint: true, openWorldHint: false }
1918
1887
  );
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
1888
  tool(
1952
1889
  "get_ads_performance",
1953
1890
  "Get ads performance",
@@ -1956,34 +1893,10 @@ function registerTools(server, client, options = {}) {
1956
1893
  getAdsPerformance,
1957
1894
  { readOnlyHint: true, openWorldHint: false }
1958
1895
  );
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
1896
  tool(
1984
1897
  "get_dashboard_overview",
1985
1898
  "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).",
1899
+ "Get an aggregated dashboard overview for the organization. Returns portfolio summary (apps, valuations, ratings), data connector health status, and alerts (pending review drafts).",
1987
1900
  getDashboardOverviewSchema,
1988
1901
  getDashboardOverview,
1989
1902
  { readOnlyHint: true, openWorldHint: false }
@@ -1991,7 +1904,7 @@ function registerTools(server, client, options = {}) {
1991
1904
  tool(
1992
1905
  "list_pending_actions",
1993
1906
  "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.",
1907
+ '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
1908
  listPendingActionsSchema,
1996
1909
  listPendingActions,
1997
1910
  { readOnlyHint: true, openWorldHint: false }
@@ -1999,7 +1912,7 @@ function registerTools(server, client, options = {}) {
1999
1912
  tool(
2000
1913
  "approve_action",
2001
1914
  "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.",
1915
+ "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
1916
  approveActionSchema,
2004
1917
  approveAction,
2005
1918
  { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
@@ -2007,11 +1920,19 @@ function registerTools(server, client, options = {}) {
2007
1920
  tool(
2008
1921
  "reject_action",
2009
1922
  "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.",
1923
+ "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
1924
  rejectActionSchema,
2012
1925
  rejectAction,
2013
1926
  { readOnlyHint: false, destructiveHint: true, openWorldHint: false }
2014
1927
  );
1928
+ tool(
1929
+ "check_action_now",
1930
+ "Check a change in the store now",
1931
+ '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.',
1932
+ checkActionNowSchema,
1933
+ checkActionNow,
1934
+ { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
1935
+ );
2015
1936
  tool(
2016
1937
  "get_aso_summary",
2017
1938
  "Get ASO summary",
@@ -2028,6 +1949,14 @@ function registerTools(server, client, options = {}) {
2028
1949
  getAsoRecommendations,
2029
1950
  { readOnlyHint: true, openWorldHint: false }
2030
1951
  );
1952
+ tool(
1953
+ "get_aso_evidence",
1954
+ "Get ASO decisions and evidence",
1955
+ "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.",
1956
+ getAsoEvidenceSchema,
1957
+ getAsoEvidence,
1958
+ { readOnlyHint: true, openWorldHint: false }
1959
+ );
2031
1960
  tool(
2032
1961
  "get_aso_keywords",
2033
1962
  "Get ASO keywords",
@@ -2047,7 +1976,7 @@ function registerTools(server, client, options = {}) {
2047
1976
  tool(
2048
1977
  "get_aso_locale_snapshots",
2049
1978
  "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.",
1979
+ '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
1980
  getAsoLocaleSnapshotsSchema,
2052
1981
  getAsoLocaleSnapshots,
2053
1982
  { readOnlyHint: true, openWorldHint: false }
@@ -2079,23 +2008,21 @@ function registerTools(server, client, options = {}) {
2079
2008
  tool(
2080
2009
  "send_chat_message",
2081
2010
  "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.",
2011
+ "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
2012
  sendChatMessageSchema,
2084
2013
  sendChatMessage,
2085
2014
  { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
2086
2015
  );
2087
2016
  }
2088
2017
  export {
2089
- acknowledgeAnomaly,
2090
- acknowledgeAnomalySchema,
2091
2018
  approveAction,
2092
2019
  approveActionSchema,
2020
+ checkActionNow,
2021
+ checkActionNowSchema,
2093
2022
  discoverDimensions,
2094
2023
  discoverDimensionsSchema,
2095
2024
  discoverMetrics,
2096
2025
  discoverMetricsSchema,
2097
- dismissAnomaly,
2098
- dismissAnomalySchema,
2099
2026
  generateReviewReply,
2100
2027
  generateReviewReplySchema,
2101
2028
  getAdsPerformance,
@@ -2106,12 +2033,10 @@ export {
2106
2033
  getAgentDetailsSchema,
2107
2034
  getAgentRunHistory,
2108
2035
  getAgentRunHistorySchema,
2109
- getAnomalies,
2110
- getAnomaliesSchema,
2111
- getAnomalyDetail,
2112
- getAnomalyDetailSchema,
2113
2036
  getAppDetails,
2114
2037
  getAppDetailsSchema,
2038
+ getAsoEvidence,
2039
+ getAsoEvidenceSchema,
2115
2040
  getAsoExperiments,
2116
2041
  getAsoExperimentsSchema,
2117
2042
  getAsoKeywords,
@@ -2126,12 +2051,6 @@ export {
2126
2051
  getConversationMessagesSchema,
2127
2052
  getDashboardOverview,
2128
2053
  getDashboardOverviewSchema,
2129
- getForecasts,
2130
- getForecastsSchema,
2131
- getGrowthAudit,
2132
- getGrowthAuditSchema,
2133
- getGrowthScore,
2134
- getGrowthScoreSchema,
2135
2054
  getMetrics,
2136
2055
  getMetricsSchema,
2137
2056
  getReviews,