@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/index.js CHANGED
@@ -404,7 +404,9 @@ async function getReviews(input, client) {
404
404
  hasReply: hasReply(review),
405
405
  replySource: review.replySource ?? null,
406
406
  hasDraft: review.hasDraft ?? false,
407
- reply: review.developerResponse ? typeof review.developerResponse === "object" ? review.developerResponse.response : review.developerResponse : review.reply || null
407
+ reply: review.developerResponse ? typeof review.developerResponse === "object" ? review.developerResponse.response : review.developerResponse : review.reply || null,
408
+ // FLO-2571: where an App Store reply stands at Apple.
409
+ replyPublication: typeof review.developerResponse === "object" ? review.developerResponse?.publication ?? null : null
408
410
  }))
409
411
  })
410
412
  }
@@ -829,8 +831,58 @@ async function discoverDimensions(input, client) {
829
831
  }
830
832
  }
831
833
 
832
- // src/tools/agents.ts
834
+ // src/tools/download-impact.ts
833
835
  import { z as z4 } from "zod";
836
+ var Day = z4.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional();
837
+ var getDownloadImpactSchema = z4.object({
838
+ assetId: z4.string().uuid().describe("App UUID (App Store apps)"),
839
+ from: Day.describe(
840
+ "First day drawn (YYYY-MM-DD); default 20 weeks before `to`"
841
+ ),
842
+ to: Day.describe(
843
+ "Last day drawn (YYYY-MM-DD); default the newest day with data"
844
+ ),
845
+ beforeFrom: Day.describe(
846
+ 'Start of the "before" window compared (needs beforeTo; all windows within 400 days of each other)'
847
+ ),
848
+ beforeTo: Day.describe('End of the "before" window compared'),
849
+ afterFrom: Day.describe(
850
+ 'Start of the "after" window compared (needs afterTo)'
851
+ ),
852
+ afterTo: Day.describe('End of the "after" window compared'),
853
+ country: z4.string().regex(/^[a-zA-Z]{2}$/).optional().describe(
854
+ 'One storefront, two-letter code (e.g. "us"): narrows countries and keywords'
855
+ ),
856
+ includeDays: z4.boolean().optional().describe("Also return every day (long). Weeks carry the same downloads.")
857
+ });
858
+ async function getDownloadImpact(input, client) {
859
+ try {
860
+ const { assetId, includeDays, ...query } = input;
861
+ const impact = await client.get(
862
+ `/api/assets/${assetId}/metrics/download-impact`,
863
+ query
864
+ );
865
+ const { days, lastYearDays, ...rest } = impact;
866
+ return {
867
+ content: [
868
+ {
869
+ type: "text",
870
+ text: formatAsJson(
871
+ includeDays ? { ...rest, days, lastYearDays } : rest
872
+ )
873
+ }
874
+ ]
875
+ };
876
+ } catch (error) {
877
+ return {
878
+ content: [{ type: "text", text: formatError(error) }],
879
+ isError: true
880
+ };
881
+ }
882
+ }
883
+
884
+ // src/tools/agents.ts
885
+ import { z as z5 } from "zod";
834
886
  function asRecord(value) {
835
887
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
836
888
  }
@@ -839,28 +891,28 @@ var AGENT_DESCRIPTIONS = {
839
891
  review: "AI-powered review management \u2014 drafts and sends replies to app store reviews",
840
892
  aso: "App Store Optimization \u2014 listing optimization suggestions for better visibility"
841
893
  };
842
- var listAgentsSchema = z4.object({});
843
- var getAgentDetailsSchema = z4.object({
844
- agentType: z4.enum(AGENT_TYPES).describe("The type of agent to get details for"),
845
- assetId: z4.string().uuid().optional().describe("App UUID to get agent config for (when agent is per-asset)")
894
+ var listAgentsSchema = z5.object({});
895
+ var getAgentDetailsSchema = z5.object({
896
+ agentType: z5.enum(AGENT_TYPES).describe("The type of agent to get details for"),
897
+ assetId: z5.string().uuid().optional().describe("App UUID to get agent config for (when agent is per-asset)")
846
898
  });
847
- var getAgentRunHistorySchema = z4.object({
848
- agentType: z4.enum(AGENT_TYPES).describe("The type of agent to get run history for"),
849
- assetId: z4.string().uuid().optional().describe("App UUID to filter runs"),
850
- limit: z4.number().int().min(1).max(100).default(20).describe("Maximum number of runs to return")
899
+ var getAgentRunHistorySchema = z5.object({
900
+ agentType: z5.enum(AGENT_TYPES).describe("The type of agent to get run history for"),
901
+ assetId: z5.string().uuid().optional().describe("App UUID to filter runs"),
902
+ limit: z5.number().int().min(1).max(100).default(20).describe("Maximum number of runs to return")
851
903
  });
852
- var triggerAgentRunSchema = z4.object({
853
- agentId: z4.string().describe("The agent ID to trigger a run for (the `id` from list_agents)"),
854
- assetId: z4.string().uuid().optional().describe("Optional app UUID to run the agent against")
904
+ var triggerAgentRunSchema = z5.object({
905
+ agentId: z5.string().describe("The agent ID to trigger a run for (the `id` from list_agents)"),
906
+ assetId: z5.string().uuid().optional().describe("Optional app UUID to run the agent against")
855
907
  });
856
- var pauseAgentSchema = z4.object({
857
- agentId: z4.string().describe("The agent ID to pause (the `id` from list_agents)")
908
+ var pauseAgentSchema = z5.object({
909
+ agentId: z5.string().describe("The agent ID to pause (the `id` from list_agents)")
858
910
  });
859
- var resumeAgentSchema = z4.object({
860
- agentId: z4.string().describe("The agent ID to resume (the `id` from list_agents)")
911
+ var resumeAgentSchema = z5.object({
912
+ agentId: z5.string().describe("The agent ID to resume (the `id` from list_agents)")
861
913
  });
862
- var getAgentActivitySchema = z4.object({
863
- agentId: z4.string().describe("The agent ID to get activity for (the `id` from list_agents)")
914
+ var getAgentActivitySchema = z5.object({
915
+ agentId: z5.string().describe("The agent ID to get activity for (the `id` from list_agents)")
864
916
  });
865
917
  async function listAgents(_input, client) {
866
918
  try {
@@ -1118,13 +1170,13 @@ async function getAgentActivity(input, client) {
1118
1170
  }
1119
1171
 
1120
1172
  // src/tools/ads.ts
1121
- import { z as z5 } from "zod";
1122
- var getAdsPerformanceSchema = z5.object({
1123
- assetId: z5.string().uuid().optional().describe("Filter by app UUID"),
1124
- platform: z5.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
1125
- fromDate: z5.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
1126
- toDate: z5.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
1127
- limit: z5.number().int().min(1).max(100).default(50).describe("Maximum number of campaigns to return")
1173
+ import { z as z6 } from "zod";
1174
+ var getAdsPerformanceSchema = z6.object({
1175
+ assetId: z6.string().uuid().optional().describe("Filter by app UUID"),
1176
+ platform: z6.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
1177
+ fromDate: z6.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
1178
+ toDate: z6.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
1179
+ limit: z6.number().int().min(1).max(100).default(50).describe("Maximum number of campaigns to return")
1128
1180
  });
1129
1181
  async function getAdsPerformance(input, client) {
1130
1182
  try {
@@ -1190,7 +1242,7 @@ async function getAdsPerformance(input, client) {
1190
1242
  }
1191
1243
 
1192
1244
  // src/tools/dashboard.ts
1193
- import { z as z6 } from "zod";
1245
+ import { z as z7 } from "zod";
1194
1246
  function parseDashboardNumber(value) {
1195
1247
  if (value === null || value === void 0 || value === "") return null;
1196
1248
  const parsed = typeof value === "number" ? value : Number.parseFloat(value);
@@ -1201,7 +1253,7 @@ function getSidebarAssets(response) {
1201
1253
  if (Array.isArray(response)) return response;
1202
1254
  return response.data ?? [];
1203
1255
  }
1204
- var getDashboardOverviewSchema = z6.object({});
1256
+ var getDashboardOverviewSchema = z7.object({});
1205
1257
  async function getDashboardOverview(_input, client) {
1206
1258
  try {
1207
1259
  const overviewPromise = client.get("/api/dashboard/overview-metrics").catch(() => null);
@@ -1257,33 +1309,33 @@ async function getDashboardOverview(_input, client) {
1257
1309
 
1258
1310
  // src/tools/actions.ts
1259
1311
  import { randomUUID } from "node:crypto";
1260
- import { z as z7 } from "zod";
1261
- var listPendingActionsSchema = z7.object({
1262
- assetId: z7.string().uuid().optional().describe("Filter by app UUID"),
1263
- view: z7.enum(["open", "queued"]).default("open").describe(
1312
+ import { z as z8 } from "zod";
1313
+ var listPendingActionsSchema = z8.object({
1314
+ assetId: z8.string().uuid().optional().describe("Filter by app UUID"),
1315
+ view: z8.enum(["open", "queued"]).default("open").describe(
1264
1316
  "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)."
1265
1317
  ),
1266
- limit: z7.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
1318
+ limit: z8.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
1267
1319
  });
1268
- var approveActionSchema = z7.object({
1269
- actionId: z7.string().describe("The inbox item ID to approve (from list_pending_actions)")
1320
+ var approveActionSchema = z8.object({
1321
+ actionId: z8.string().describe("The inbox item ID to approve (from list_pending_actions)")
1270
1322
  });
1271
- var rejectActionSchema = z7.object({
1272
- actionId: z7.string().describe("The inbox item ID to reject (from list_pending_actions)"),
1273
- reason: z7.string().trim().min(1).max(1e3).optional().describe(
1323
+ var rejectActionSchema = z8.object({
1324
+ actionId: z8.string().describe("The inbox item ID to reject (from list_pending_actions)"),
1325
+ reason: z8.string().trim().min(1).max(1e3).optional().describe(
1274
1326
  "Why, in the user's words. Kept with the rejection so the agents do not propose the same thing again."
1275
1327
  )
1276
1328
  });
1277
- var checkActionNowSchema = z7.object({
1278
- actionId: z7.string().describe(
1329
+ var checkActionNowSchema = z8.object({
1330
+ actionId: z8.string().describe(
1279
1331
  'The inbox item ID to check now (from list_pending_actions with view "queued", or an approve_action result; its commands include check_now)'
1280
1332
  )
1281
1333
  });
1282
- var renameCustomPageActionSchema = z7.object({
1283
- actionId: z7.string().describe(
1334
+ var renameCustomPageActionSchema = z8.object({
1335
+ actionId: z8.string().describe(
1284
1336
  '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)'
1285
1337
  ),
1286
- name: z7.string().trim().min(1).max(100).describe(
1338
+ name: z8.string().trim().min(1).max(100).describe(
1287
1339
  "The new page name: at most 100 characters (UTF-16 units), not its current name, not a page the app already has"
1288
1340
  )
1289
1341
  });
@@ -1357,6 +1409,18 @@ async function commandItem(client, itemId, intent, reason) {
1357
1409
  }
1358
1410
  };
1359
1411
  }
1412
+ function approveMessage(command, applied2, result) {
1413
+ if (!applied2) return refusedMessage(result);
1414
+ if (command === "acknowledge") return "Acknowledged.";
1415
+ if (result?.alreadyLive)
1416
+ return "Already live: the store already shows this change, so nothing was sent. The item is done.";
1417
+ return "Approved. Fload delivers it after a short undo window; the inbox shows where it is.";
1418
+ }
1419
+ function refusedMessage(result) {
1420
+ const said = result?.error ?? "The approval could not be recorded.";
1421
+ const check = result?.policyRefusal?.check;
1422
+ return check ? `Stopped by the ${check}: ${said}` : said;
1423
+ }
1360
1424
  async function approveAction(input, client) {
1361
1425
  try {
1362
1426
  const { command, result } = await commandItem(
@@ -1372,7 +1436,7 @@ async function approveAction(input, client) {
1372
1436
  command,
1373
1437
  result: result?.result ?? "unknown",
1374
1438
  ...result?.error ? { error: result.error } : {},
1375
- 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.",
1439
+ message: approveMessage(command, applied2, result),
1376
1440
  item: result?.item
1377
1441
  },
1378
1442
  !applied2
@@ -1522,22 +1586,22 @@ async function renameCustomPageAction(input, client) {
1522
1586
  }
1523
1587
 
1524
1588
  // src/tools/aso.ts
1525
- import { z as z8 } from "zod";
1526
- var getAsoSummarySchema = z8.object({
1527
- assetId: z8.string().uuid().describe("App UUID to get ASO summary for")
1589
+ import { z as z9 } from "zod";
1590
+ var getAsoSummarySchema = z9.object({
1591
+ assetId: z9.string().uuid().describe("App UUID to get ASO summary for")
1528
1592
  });
1529
- var getAsoRecommendationsSchema = z8.object({
1530
- assetId: z8.string().uuid().describe("App UUID to get ASO recommendations for")
1593
+ var getAsoRecommendationsSchema = z9.object({
1594
+ assetId: z9.string().uuid().describe("App UUID to get ASO recommendations for")
1531
1595
  });
1532
- var getAsoKeywordsSchema = z8.object({
1533
- assetId: z8.string().uuid().describe("App UUID to get keyword intelligence for"),
1534
- locale: z8.string().optional().describe(
1596
+ var getAsoKeywordsSchema = z9.object({
1597
+ assetId: z9.string().uuid().describe("App UUID to get keyword intelligence for"),
1598
+ locale: z9.string().optional().describe(
1535
1599
  'Locale code to filter keywords (e.g., "en-US", "de-DE"). Returns all locales if omitted.'
1536
1600
  )
1537
1601
  });
1538
- var getAsoExperimentsSchema = z8.object({
1539
- assetId: z8.string().uuid().describe("App UUID to list ASO experiments for"),
1540
- status: z8.enum([
1602
+ var getAsoExperimentsSchema = z9.object({
1603
+ assetId: z9.string().uuid().describe("App UUID to list ASO experiments for"),
1604
+ status: z9.enum([
1541
1605
  "proposed",
1542
1606
  "approved",
1543
1607
  "applied",
@@ -1545,22 +1609,22 @@ var getAsoExperimentsSchema = z8.object({
1545
1609
  "completed",
1546
1610
  "reverted"
1547
1611
  ]).optional().describe("Filter experiments by status"),
1548
- limit: z8.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1549
- cursor: z8.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
1612
+ limit: z9.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1613
+ cursor: z9.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
1550
1614
  });
1551
- var getAsoLocaleSnapshotsSchema = z8.object({
1552
- assetId: z8.string().uuid().describe("App UUID to get locale snapshots for"),
1553
- store: z8.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1554
- locale: z8.string().optional().describe(
1615
+ var getAsoLocaleSnapshotsSchema = z9.object({
1616
+ assetId: z9.string().uuid().describe("App UUID to get locale snapshots for"),
1617
+ store: z9.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1618
+ locale: z9.string().optional().describe(
1555
1619
  'Filter to a single locale (e.g. "en-US"). Returns all locales if omitted.'
1556
1620
  ),
1557
- view: z8.enum(["latest", "history"]).default("latest").describe(
1621
+ view: z9.enum(["latest", "history"]).default("latest").describe(
1558
1622
  '"latest" (default) = newest snapshot per (locale, type); "history" = raw revisions newest first'
1559
1623
  ),
1560
- limit: z8.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1624
+ limit: z9.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1561
1625
  });
1562
- var triggerAsoAnalysisSchema = z8.object({
1563
- assetId: z8.string().uuid().describe("App UUID to trigger ASO analysis for")
1626
+ var triggerAsoAnalysisSchema = z9.object({
1627
+ assetId: z9.string().uuid().describe("App UUID to trigger ASO analysis for")
1564
1628
  });
1565
1629
  async function getAsoSummary(input, client) {
1566
1630
  try {
@@ -1728,7 +1792,7 @@ async function triggerAsoAnalysis(input, client) {
1728
1792
  };
1729
1793
  }
1730
1794
  }
1731
- var getAsoEvidenceSchema = z8.object({ assetId: z8.string().uuid() });
1795
+ var getAsoEvidenceSchema = z9.object({ assetId: z9.string().uuid() });
1732
1796
  async function getAsoEvidence(input, client) {
1733
1797
  try {
1734
1798
  const response = await client.get(
@@ -1747,19 +1811,19 @@ async function getAsoEvidence(input, client) {
1747
1811
 
1748
1812
  // src/tools/chat.ts
1749
1813
  import { randomUUID as randomUUID2 } from "node:crypto";
1750
- import { z as z9 } from "zod";
1751
- var listConversationsSchema = z9.object({
1752
- limit: z9.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
1814
+ import { z as z10 } from "zod";
1815
+ var listConversationsSchema = z10.object({
1816
+ limit: z10.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
1753
1817
  });
1754
- var getConversationMessagesSchema = z9.object({
1755
- conversationId: z9.string().uuid().describe("The conversation UUID to get messages for")
1818
+ var getConversationMessagesSchema = z10.object({
1819
+ conversationId: z10.string().uuid().describe("The conversation UUID to get messages for")
1756
1820
  });
1757
- var sendChatMessageSchema = z9.object({
1758
- message: z9.string().describe("The message to send to the AI chat"),
1759
- conversationId: z9.string().uuid().optional().describe(
1821
+ var sendChatMessageSchema = z10.object({
1822
+ message: z10.string().describe("The message to send to the AI chat"),
1823
+ conversationId: z10.string().uuid().optional().describe(
1760
1824
  "Existing conversation UUID to continue. Starts a new conversation if omitted."
1761
1825
  ),
1762
- agentType: z9.string().optional().describe(
1826
+ agentType: z10.string().optional().describe(
1763
1827
  "Agent type to use for the conversation (e.g., review, monitoring)"
1764
1828
  )
1765
1829
  });
@@ -1962,7 +2026,7 @@ function registerTools(server, client, options = {}) {
1962
2026
  tool(
1963
2027
  "get_reviews",
1964
2028
  "Get reviews",
1965
- "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.",
2029
+ '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.',
1966
2030
  getReviewsSchema,
1967
2031
  getReviews,
1968
2032
  { readOnlyHint: true, openWorldHint: false }
@@ -2015,6 +2079,14 @@ function registerTools(server, client, options = {}) {
2015
2079
  discoverDimensions,
2016
2080
  { readOnlyHint: true, openWorldHint: false }
2017
2081
  );
2082
+ tool(
2083
+ "get_download_impact",
2084
+ "Get what Fload changed on downloads",
2085
+ "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.",
2086
+ getDownloadImpactSchema,
2087
+ getDownloadImpact,
2088
+ { readOnlyHint: true, openWorldHint: false }
2089
+ );
2018
2090
  tool(
2019
2091
  "list_agents",
2020
2092
  "List agents",
@@ -2235,10 +2307,10 @@ async function createMcpServer(_config, client) {
2235
2307
  import { readFileSync, existsSync } from "fs";
2236
2308
  import { homedir } from "os";
2237
2309
  import { join } from "path";
2238
- import { z as z10 } from "zod";
2239
- var ConfigFileSchema = z10.object({
2240
- apiKey: z10.string().optional().catch(void 0),
2241
- apiUrl: z10.string().optional().catch(void 0)
2310
+ import { z as z11 } from "zod";
2311
+ var ConfigFileSchema = z11.object({
2312
+ apiKey: z11.string().optional().catch(void 0),
2313
+ apiUrl: z11.string().optional().catch(void 0)
2242
2314
  });
2243
2315
  function loadConfig(env = process.env) {
2244
2316
  const apiKey = env.FLOAD_API_KEY;