@fload-ai/mcp 0.9.0 → 0.11.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.
package/dist/bin.js CHANGED
@@ -324,7 +324,9 @@ async function getReviews(input, client) {
324
324
  hasReply: hasReply(review),
325
325
  replySource: review.replySource ?? null,
326
326
  hasDraft: review.hasDraft ?? false,
327
- reply: review.developerResponse ? typeof review.developerResponse === "object" ? review.developerResponse.response : review.developerResponse : review.reply || null
327
+ reply: review.developerResponse ? typeof review.developerResponse === "object" ? review.developerResponse.response : review.developerResponse : review.reply || null,
328
+ // FLO-2571: where an App Store reply stands at Apple.
329
+ replyPublication: typeof review.developerResponse === "object" ? review.developerResponse?.publication ?? null : null
328
330
  }))
329
331
  })
330
332
  }
@@ -749,8 +751,58 @@ async function discoverDimensions(input, client) {
749
751
  }
750
752
  }
751
753
 
752
- // src/tools/agents.ts
754
+ // src/tools/download-impact.ts
753
755
  import { z as z5 } from "zod";
756
+ var Day = z5.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional();
757
+ var getDownloadImpactSchema = z5.object({
758
+ assetId: z5.string().uuid().describe("App UUID (App Store apps)"),
759
+ from: Day.describe(
760
+ "First day drawn (YYYY-MM-DD); default 20 weeks before `to`"
761
+ ),
762
+ to: Day.describe(
763
+ "Last day drawn (YYYY-MM-DD); default the newest day with data"
764
+ ),
765
+ beforeFrom: Day.describe(
766
+ 'Start of the "before" window compared (needs beforeTo; all windows within 400 days of each other)'
767
+ ),
768
+ beforeTo: Day.describe('End of the "before" window compared'),
769
+ afterFrom: Day.describe(
770
+ 'Start of the "after" window compared (needs afterTo)'
771
+ ),
772
+ afterTo: Day.describe('End of the "after" window compared'),
773
+ country: z5.string().regex(/^[a-zA-Z]{2}$/).optional().describe(
774
+ 'One storefront, two-letter code (e.g. "us"): narrows countries and keywords'
775
+ ),
776
+ includeDays: z5.boolean().optional().describe("Also return every day (long). Weeks carry the same downloads.")
777
+ });
778
+ async function getDownloadImpact(input, client) {
779
+ try {
780
+ const { assetId, includeDays, ...query } = input;
781
+ const impact = await client.get(
782
+ `/api/assets/${assetId}/metrics/download-impact`,
783
+ query
784
+ );
785
+ const { days, lastYearDays, ...rest } = impact;
786
+ return {
787
+ content: [
788
+ {
789
+ type: "text",
790
+ text: formatAsJson(
791
+ includeDays ? { ...rest, days, lastYearDays } : rest
792
+ )
793
+ }
794
+ ]
795
+ };
796
+ } catch (error) {
797
+ return {
798
+ content: [{ type: "text", text: formatError(error) }],
799
+ isError: true
800
+ };
801
+ }
802
+ }
803
+
804
+ // src/tools/agents.ts
805
+ import { z as z6 } from "zod";
754
806
  function asRecord(value) {
755
807
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
756
808
  }
@@ -759,28 +811,28 @@ var AGENT_DESCRIPTIONS = {
759
811
  review: "AI-powered review management \u2014 drafts and sends replies to app store reviews",
760
812
  aso: "App Store Optimization \u2014 listing optimization suggestions for better visibility"
761
813
  };
762
- var listAgentsSchema = z5.object({});
763
- var getAgentDetailsSchema = z5.object({
764
- agentType: z5.enum(AGENT_TYPES).describe("The type of agent to get details for"),
765
- assetId: z5.string().uuid().optional().describe("App UUID to get agent config for (when agent is per-asset)")
814
+ var listAgentsSchema = z6.object({});
815
+ var getAgentDetailsSchema = z6.object({
816
+ agentType: z6.enum(AGENT_TYPES).describe("The type of agent to get details for"),
817
+ assetId: z6.string().uuid().optional().describe("App UUID to get agent config for (when agent is per-asset)")
766
818
  });
767
- var getAgentRunHistorySchema = z5.object({
768
- agentType: z5.enum(AGENT_TYPES).describe("The type of agent to get run history for"),
769
- assetId: z5.string().uuid().optional().describe("App UUID to filter runs"),
770
- limit: z5.number().int().min(1).max(100).default(20).describe("Maximum number of runs to return")
819
+ var getAgentRunHistorySchema = z6.object({
820
+ agentType: z6.enum(AGENT_TYPES).describe("The type of agent to get run history for"),
821
+ assetId: z6.string().uuid().optional().describe("App UUID to filter runs"),
822
+ limit: z6.number().int().min(1).max(100).default(20).describe("Maximum number of runs to return")
771
823
  });
772
- var triggerAgentRunSchema = z5.object({
773
- agentId: z5.string().describe("The agent ID to trigger a run for (the `id` from list_agents)"),
774
- assetId: z5.string().uuid().optional().describe("Optional app UUID to run the agent against")
824
+ var triggerAgentRunSchema = z6.object({
825
+ agentId: z6.string().describe("The agent ID to trigger a run for (the `id` from list_agents)"),
826
+ assetId: z6.string().uuid().optional().describe("Optional app UUID to run the agent against")
775
827
  });
776
- var pauseAgentSchema = z5.object({
777
- agentId: z5.string().describe("The agent ID to pause (the `id` from list_agents)")
828
+ var pauseAgentSchema = z6.object({
829
+ agentId: z6.string().describe("The agent ID to pause (the `id` from list_agents)")
778
830
  });
779
- var resumeAgentSchema = z5.object({
780
- agentId: z5.string().describe("The agent ID to resume (the `id` from list_agents)")
831
+ var resumeAgentSchema = z6.object({
832
+ agentId: z6.string().describe("The agent ID to resume (the `id` from list_agents)")
781
833
  });
782
- var getAgentActivitySchema = z5.object({
783
- agentId: z5.string().describe("The agent ID to get activity for (the `id` from list_agents)")
834
+ var getAgentActivitySchema = z6.object({
835
+ agentId: z6.string().describe("The agent ID to get activity for (the `id` from list_agents)")
784
836
  });
785
837
  async function listAgents(_input, client) {
786
838
  try {
@@ -1038,13 +1090,13 @@ async function getAgentActivity(input, client) {
1038
1090
  }
1039
1091
 
1040
1092
  // src/tools/ads.ts
1041
- import { z as z6 } from "zod";
1042
- var getAdsPerformanceSchema = z6.object({
1043
- assetId: z6.string().uuid().optional().describe("Filter by app UUID"),
1044
- platform: z6.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
1045
- fromDate: z6.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
1046
- toDate: z6.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
1047
- limit: z6.number().int().min(1).max(100).default(50).describe("Maximum number of campaigns to return")
1093
+ import { z as z7 } from "zod";
1094
+ var getAdsPerformanceSchema = z7.object({
1095
+ assetId: z7.string().uuid().optional().describe("Filter by app UUID"),
1096
+ platform: z7.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
1097
+ fromDate: z7.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
1098
+ toDate: z7.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
1099
+ limit: z7.number().int().min(1).max(100).default(50).describe("Maximum number of campaigns to return")
1048
1100
  });
1049
1101
  async function getAdsPerformance(input, client) {
1050
1102
  try {
@@ -1110,7 +1162,7 @@ async function getAdsPerformance(input, client) {
1110
1162
  }
1111
1163
 
1112
1164
  // src/tools/dashboard.ts
1113
- import { z as z7 } from "zod";
1165
+ import { z as z8 } from "zod";
1114
1166
  function parseDashboardNumber(value) {
1115
1167
  if (value === null || value === void 0 || value === "") return null;
1116
1168
  const parsed = typeof value === "number" ? value : Number.parseFloat(value);
@@ -1121,7 +1173,7 @@ function getSidebarAssets(response) {
1121
1173
  if (Array.isArray(response)) return response;
1122
1174
  return response.data ?? [];
1123
1175
  }
1124
- var getDashboardOverviewSchema = z7.object({});
1176
+ var getDashboardOverviewSchema = z8.object({});
1125
1177
  async function getDashboardOverview(_input, client) {
1126
1178
  try {
1127
1179
  const overviewPromise = client.get("/api/dashboard/overview-metrics").catch(() => null);
@@ -1177,7 +1229,7 @@ async function getDashboardOverview(_input, client) {
1177
1229
 
1178
1230
  // src/tools/actions.ts
1179
1231
  import { randomUUID } from "node:crypto";
1180
- import { z as z8 } from "zod";
1232
+ import { z as z9 } from "zod";
1181
1233
 
1182
1234
  // src/public-errors.ts
1183
1235
  var INTERNAL_ERROR_PATTERNS = [
@@ -1203,32 +1255,32 @@ function publicMcpErrorMessage(message, fallbackMessage = "Fload could not compl
1203
1255
  }
1204
1256
 
1205
1257
  // src/tools/actions.ts
1206
- var listPendingActionsSchema = z8.object({
1207
- assetId: z8.string().uuid().optional().describe("Filter by app UUID"),
1208
- view: z8.enum(["open", "queued"]).default("open").describe(
1258
+ var listPendingActionsSchema = z9.object({
1259
+ assetId: z9.string().uuid().optional().describe("Filter by app UUID"),
1260
+ view: z9.enum(["open", "queued"]).default("open").describe(
1209
1261
  "open (default): items waiting on the user. queued: approved work Fload is sending or checking in the store (an item being checked offers check_now)."
1210
1262
  ),
1211
- limit: z8.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
1263
+ limit: z9.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
1212
1264
  });
1213
- var approveActionSchema = z8.object({
1214
- actionId: z8.string().describe("The inbox item ID to approve (from list_pending_actions)")
1265
+ var approveActionSchema = z9.object({
1266
+ actionId: z9.string().describe("The inbox item ID to approve (from list_pending_actions)")
1215
1267
  });
1216
- var rejectActionSchema = z8.object({
1217
- actionId: z8.string().describe("The inbox item ID to reject (from list_pending_actions)"),
1218
- reason: z8.string().trim().min(1).max(1e3).optional().describe(
1268
+ var rejectActionSchema = z9.object({
1269
+ actionId: z9.string().describe("The inbox item ID to reject (from list_pending_actions)"),
1270
+ reason: z9.string().trim().min(1).max(1e3).optional().describe(
1219
1271
  "Why, in the user's words. Kept with the rejection so the agents do not propose the same thing again."
1220
1272
  )
1221
1273
  });
1222
- var checkActionNowSchema = z8.object({
1223
- actionId: z8.string().describe(
1274
+ var checkActionNowSchema = z9.object({
1275
+ actionId: z9.string().describe(
1224
1276
  'The inbox item ID to check now (from list_pending_actions with view "queued", or an approve_action result; its commands include check_now)'
1225
1277
  )
1226
1278
  });
1227
- var renameCustomPageActionSchema = z8.object({
1228
- actionId: z8.string().describe(
1279
+ var renameCustomPageActionSchema = z9.object({
1280
+ actionId: z9.string().describe(
1229
1281
  '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)'
1230
1282
  ),
1231
- name: z8.string().trim().min(1).max(100).describe(
1283
+ name: z9.string().trim().min(1).max(100).describe(
1232
1284
  "The new page name: at most 100 characters (UTF-16 units), not its current name, not a page the app already has"
1233
1285
  )
1234
1286
  });
@@ -1302,6 +1354,18 @@ async function commandItem(client, itemId, intent, reason) {
1302
1354
  }
1303
1355
  };
1304
1356
  }
1357
+ function approveMessage(command, applied2, result) {
1358
+ if (!applied2) return refusedMessage(result);
1359
+ if (command === "acknowledge") return "Acknowledged.";
1360
+ if (result?.alreadyLive)
1361
+ return "Already live: the store already shows this change, so nothing was sent. The item is done.";
1362
+ return "Approved. Fload delivers it after a short undo window; the inbox shows where it is.";
1363
+ }
1364
+ function refusedMessage(result) {
1365
+ const said = result?.error ?? "The approval could not be recorded.";
1366
+ const check = result?.policyRefusal?.check;
1367
+ return check ? `Stopped by the ${check}: ${said}` : said;
1368
+ }
1305
1369
  async function approveAction(input, client) {
1306
1370
  try {
1307
1371
  const { command, result } = await commandItem(
@@ -1317,7 +1381,7 @@ async function approveAction(input, client) {
1317
1381
  command,
1318
1382
  result: result?.result ?? "unknown",
1319
1383
  ...result?.error ? { error: result.error } : {},
1320
- 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.",
1384
+ message: approveMessage(command, applied2, result),
1321
1385
  item: result?.item
1322
1386
  },
1323
1387
  !applied2
@@ -1467,22 +1531,22 @@ async function renameCustomPageAction(input, client) {
1467
1531
  }
1468
1532
 
1469
1533
  // src/tools/aso.ts
1470
- import { z as z9 } from "zod";
1471
- var getAsoSummarySchema = z9.object({
1472
- assetId: z9.string().uuid().describe("App UUID to get ASO summary for")
1534
+ import { z as z10 } from "zod";
1535
+ var getAsoSummarySchema = z10.object({
1536
+ assetId: z10.string().uuid().describe("App UUID to get ASO summary for")
1473
1537
  });
1474
- var getAsoRecommendationsSchema = z9.object({
1475
- assetId: z9.string().uuid().describe("App UUID to get ASO recommendations for")
1538
+ var getAsoRecommendationsSchema = z10.object({
1539
+ assetId: z10.string().uuid().describe("App UUID to get ASO recommendations for")
1476
1540
  });
1477
- var getAsoKeywordsSchema = z9.object({
1478
- assetId: z9.string().uuid().describe("App UUID to get keyword intelligence for"),
1479
- locale: z9.string().optional().describe(
1541
+ var getAsoKeywordsSchema = z10.object({
1542
+ assetId: z10.string().uuid().describe("App UUID to get keyword intelligence for"),
1543
+ locale: z10.string().optional().describe(
1480
1544
  'Locale code to filter keywords (e.g., "en-US", "de-DE"). Returns all locales if omitted.'
1481
1545
  )
1482
1546
  });
1483
- var getAsoExperimentsSchema = z9.object({
1484
- assetId: z9.string().uuid().describe("App UUID to list ASO experiments for"),
1485
- status: z9.enum([
1547
+ var getAsoExperimentsSchema = z10.object({
1548
+ assetId: z10.string().uuid().describe("App UUID to list ASO experiments for"),
1549
+ status: z10.enum([
1486
1550
  "proposed",
1487
1551
  "approved",
1488
1552
  "applied",
@@ -1490,22 +1554,22 @@ var getAsoExperimentsSchema = z9.object({
1490
1554
  "completed",
1491
1555
  "reverted"
1492
1556
  ]).optional().describe("Filter experiments by status"),
1493
- limit: z9.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1494
- cursor: z9.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
1557
+ limit: z10.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1558
+ cursor: z10.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
1495
1559
  });
1496
- var getAsoLocaleSnapshotsSchema = z9.object({
1497
- assetId: z9.string().uuid().describe("App UUID to get locale snapshots for"),
1498
- store: z9.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1499
- locale: z9.string().optional().describe(
1560
+ var getAsoLocaleSnapshotsSchema = z10.object({
1561
+ assetId: z10.string().uuid().describe("App UUID to get locale snapshots for"),
1562
+ store: z10.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1563
+ locale: z10.string().optional().describe(
1500
1564
  'Filter to a single locale (e.g. "en-US"). Returns all locales if omitted.'
1501
1565
  ),
1502
- view: z9.enum(["latest", "history"]).default("latest").describe(
1566
+ view: z10.enum(["latest", "history"]).default("latest").describe(
1503
1567
  '"latest" (default) = newest snapshot per (locale, type); "history" = raw revisions newest first'
1504
1568
  ),
1505
- limit: z9.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1569
+ limit: z10.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1506
1570
  });
1507
- var triggerAsoAnalysisSchema = z9.object({
1508
- assetId: z9.string().uuid().describe("App UUID to trigger ASO analysis for")
1571
+ var triggerAsoAnalysisSchema = z10.object({
1572
+ assetId: z10.string().uuid().describe("App UUID to trigger ASO analysis for")
1509
1573
  });
1510
1574
  async function getAsoSummary(input, client) {
1511
1575
  try {
@@ -1673,7 +1737,7 @@ async function triggerAsoAnalysis(input, client) {
1673
1737
  };
1674
1738
  }
1675
1739
  }
1676
- var getAsoEvidenceSchema = z9.object({ assetId: z9.string().uuid() });
1740
+ var getAsoEvidenceSchema = z10.object({ assetId: z10.string().uuid() });
1677
1741
  async function getAsoEvidence(input, client) {
1678
1742
  try {
1679
1743
  const response = await client.get(
@@ -1692,19 +1756,19 @@ async function getAsoEvidence(input, client) {
1692
1756
 
1693
1757
  // src/tools/chat.ts
1694
1758
  import { randomUUID as randomUUID2 } from "node:crypto";
1695
- import { z as z10 } from "zod";
1696
- var listConversationsSchema = z10.object({
1697
- limit: z10.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
1759
+ import { z as z11 } from "zod";
1760
+ var listConversationsSchema = z11.object({
1761
+ limit: z11.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
1698
1762
  });
1699
- var getConversationMessagesSchema = z10.object({
1700
- conversationId: z10.string().uuid().describe("The conversation UUID to get messages for")
1763
+ var getConversationMessagesSchema = z11.object({
1764
+ conversationId: z11.string().uuid().describe("The conversation UUID to get messages for")
1701
1765
  });
1702
- var sendChatMessageSchema = z10.object({
1703
- message: z10.string().describe("The message to send to the AI chat"),
1704
- conversationId: z10.string().uuid().optional().describe(
1766
+ var sendChatMessageSchema = z11.object({
1767
+ message: z11.string().describe("The message to send to the AI chat"),
1768
+ conversationId: z11.string().uuid().optional().describe(
1705
1769
  "Existing conversation UUID to continue. Starts a new conversation if omitted."
1706
1770
  ),
1707
- agentType: z10.string().optional().describe(
1771
+ agentType: z11.string().optional().describe(
1708
1772
  "Agent type to use for the conversation (e.g., review, monitoring)"
1709
1773
  )
1710
1774
  });
@@ -1907,7 +1971,7 @@ function registerTools(server, client, options = {}) {
1907
1971
  tool(
1908
1972
  "get_reviews",
1909
1973
  "Get reviews",
1910
- "Get app reviews with flexible filtering. Filter by app (assetId or bundleId), platform, rating (1-5 stars), replied status, and date range. Returns reviews with metadata, author, body text, and reply status. Useful for sentiment analysis, support workflows, and review management.",
1974
+ 'Get app reviews with flexible filtering. Filter by app (assetId or bundleId), platform, rating (1-5 stars), replied status, and date range. Returns reviews with metadata, author, body text, and reply status. For an App Store reply, replyPublication says where it stands at Apple: "publishing" (sent; Apple has not published it yet, usually within a day), "live" (live on the App Store), "removed" (Apple no longer shows it), or null (not known: never call it live). Useful for sentiment analysis, support workflows, and review management.',
1911
1975
  getReviewsSchema,
1912
1976
  getReviews,
1913
1977
  { readOnlyHint: true, openWorldHint: false }
@@ -1960,6 +2024,14 @@ function registerTools(server, client, options = {}) {
1960
2024
  discoverDimensions,
1961
2025
  { readOnlyHint: true, openWorldHint: false }
1962
2026
  );
2027
+ tool(
2028
+ "get_download_impact",
2029
+ "Get what Fload changed on downloads",
2030
+ "Did Fload's listing changes move downloads, overall or in one country? For an App Store app: downloads by source a week (organicSearch = App Store search minus Apple Ads, appleAds, browse, appReferrer, webReferrer, other, total) with the same days last year (364 days back) and an index of each year to its own first four weeks; markers for releases, each Fload listing change on the day written and the day live (with the storefronts that read its locales) and the iOS launch week; the 21 days before Fload's first change against the latest 21 days; storefronts by role (changed: a changed localization is its own language; reads_changed: it also reads one, e.g. the US reads es-MX; control: reads nothing changed) with organic downloads a day before and after, this year and last; and each touched keyword's median rank before and after. Listing changes can only move organic App Store search: judge them on organicSearch against last year, never on total, paid or browse. Null means unknown, never 0.",
2031
+ getDownloadImpactSchema,
2032
+ getDownloadImpact,
2033
+ { readOnlyHint: true, openWorldHint: false }
2034
+ );
1963
2035
  tool(
1964
2036
  "list_agents",
1965
2037
  "List agents",