@fload-ai/mcp 0.9.0 → 0.10.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
@@ -749,8 +749,58 @@ async function discoverDimensions(input, client) {
749
749
  }
750
750
  }
751
751
 
752
- // src/tools/agents.ts
752
+ // src/tools/download-impact.ts
753
753
  import { z as z5 } from "zod";
754
+ var Day = z5.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional();
755
+ var getDownloadImpactSchema = z5.object({
756
+ assetId: z5.string().uuid().describe("App UUID (App Store apps)"),
757
+ from: Day.describe(
758
+ "First day drawn (YYYY-MM-DD); default 20 weeks before `to`"
759
+ ),
760
+ to: Day.describe(
761
+ "Last day drawn (YYYY-MM-DD); default the newest day with data"
762
+ ),
763
+ beforeFrom: Day.describe(
764
+ 'Start of the "before" window compared (needs beforeTo; all windows within 400 days of each other)'
765
+ ),
766
+ beforeTo: Day.describe('End of the "before" window compared'),
767
+ afterFrom: Day.describe(
768
+ 'Start of the "after" window compared (needs afterTo)'
769
+ ),
770
+ afterTo: Day.describe('End of the "after" window compared'),
771
+ country: z5.string().regex(/^[a-zA-Z]{2}$/).optional().describe(
772
+ 'One storefront, two-letter code (e.g. "us"): narrows countries and keywords'
773
+ ),
774
+ includeDays: z5.boolean().optional().describe("Also return every day (long). Weeks carry the same downloads.")
775
+ });
776
+ async function getDownloadImpact(input, client) {
777
+ try {
778
+ const { assetId, includeDays, ...query } = input;
779
+ const impact = await client.get(
780
+ `/api/assets/${assetId}/metrics/download-impact`,
781
+ query
782
+ );
783
+ const { days, lastYearDays, ...rest } = impact;
784
+ return {
785
+ content: [
786
+ {
787
+ type: "text",
788
+ text: formatAsJson(
789
+ includeDays ? { ...rest, days, lastYearDays } : rest
790
+ )
791
+ }
792
+ ]
793
+ };
794
+ } catch (error) {
795
+ return {
796
+ content: [{ type: "text", text: formatError(error) }],
797
+ isError: true
798
+ };
799
+ }
800
+ }
801
+
802
+ // src/tools/agents.ts
803
+ import { z as z6 } from "zod";
754
804
  function asRecord(value) {
755
805
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
756
806
  }
@@ -759,28 +809,28 @@ var AGENT_DESCRIPTIONS = {
759
809
  review: "AI-powered review management \u2014 drafts and sends replies to app store reviews",
760
810
  aso: "App Store Optimization \u2014 listing optimization suggestions for better visibility"
761
811
  };
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)")
812
+ var listAgentsSchema = z6.object({});
813
+ var getAgentDetailsSchema = z6.object({
814
+ agentType: z6.enum(AGENT_TYPES).describe("The type of agent to get details for"),
815
+ assetId: z6.string().uuid().optional().describe("App UUID to get agent config for (when agent is per-asset)")
766
816
  });
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")
817
+ var getAgentRunHistorySchema = z6.object({
818
+ agentType: z6.enum(AGENT_TYPES).describe("The type of agent to get run history for"),
819
+ assetId: z6.string().uuid().optional().describe("App UUID to filter runs"),
820
+ limit: z6.number().int().min(1).max(100).default(20).describe("Maximum number of runs to return")
771
821
  });
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")
822
+ var triggerAgentRunSchema = z6.object({
823
+ agentId: z6.string().describe("The agent ID to trigger a run for (the `id` from list_agents)"),
824
+ assetId: z6.string().uuid().optional().describe("Optional app UUID to run the agent against")
775
825
  });
776
- var pauseAgentSchema = z5.object({
777
- agentId: z5.string().describe("The agent ID to pause (the `id` from list_agents)")
826
+ var pauseAgentSchema = z6.object({
827
+ agentId: z6.string().describe("The agent ID to pause (the `id` from list_agents)")
778
828
  });
779
- var resumeAgentSchema = z5.object({
780
- agentId: z5.string().describe("The agent ID to resume (the `id` from list_agents)")
829
+ var resumeAgentSchema = z6.object({
830
+ agentId: z6.string().describe("The agent ID to resume (the `id` from list_agents)")
781
831
  });
782
- var getAgentActivitySchema = z5.object({
783
- agentId: z5.string().describe("The agent ID to get activity for (the `id` from list_agents)")
832
+ var getAgentActivitySchema = z6.object({
833
+ agentId: z6.string().describe("The agent ID to get activity for (the `id` from list_agents)")
784
834
  });
785
835
  async function listAgents(_input, client) {
786
836
  try {
@@ -1038,13 +1088,13 @@ async function getAgentActivity(input, client) {
1038
1088
  }
1039
1089
 
1040
1090
  // 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")
1091
+ import { z as z7 } from "zod";
1092
+ var getAdsPerformanceSchema = z7.object({
1093
+ assetId: z7.string().uuid().optional().describe("Filter by app UUID"),
1094
+ platform: z7.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
1095
+ fromDate: z7.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
1096
+ toDate: z7.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
1097
+ limit: z7.number().int().min(1).max(100).default(50).describe("Maximum number of campaigns to return")
1048
1098
  });
1049
1099
  async function getAdsPerformance(input, client) {
1050
1100
  try {
@@ -1110,7 +1160,7 @@ async function getAdsPerformance(input, client) {
1110
1160
  }
1111
1161
 
1112
1162
  // src/tools/dashboard.ts
1113
- import { z as z7 } from "zod";
1163
+ import { z as z8 } from "zod";
1114
1164
  function parseDashboardNumber(value) {
1115
1165
  if (value === null || value === void 0 || value === "") return null;
1116
1166
  const parsed = typeof value === "number" ? value : Number.parseFloat(value);
@@ -1121,7 +1171,7 @@ function getSidebarAssets(response) {
1121
1171
  if (Array.isArray(response)) return response;
1122
1172
  return response.data ?? [];
1123
1173
  }
1124
- var getDashboardOverviewSchema = z7.object({});
1174
+ var getDashboardOverviewSchema = z8.object({});
1125
1175
  async function getDashboardOverview(_input, client) {
1126
1176
  try {
1127
1177
  const overviewPromise = client.get("/api/dashboard/overview-metrics").catch(() => null);
@@ -1177,7 +1227,7 @@ async function getDashboardOverview(_input, client) {
1177
1227
 
1178
1228
  // src/tools/actions.ts
1179
1229
  import { randomUUID } from "node:crypto";
1180
- import { z as z8 } from "zod";
1230
+ import { z as z9 } from "zod";
1181
1231
 
1182
1232
  // src/public-errors.ts
1183
1233
  var INTERNAL_ERROR_PATTERNS = [
@@ -1203,32 +1253,32 @@ function publicMcpErrorMessage(message, fallbackMessage = "Fload could not compl
1203
1253
  }
1204
1254
 
1205
1255
  // 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(
1256
+ var listPendingActionsSchema = z9.object({
1257
+ assetId: z9.string().uuid().optional().describe("Filter by app UUID"),
1258
+ view: z9.enum(["open", "queued"]).default("open").describe(
1209
1259
  "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
1260
  ),
1211
- limit: z8.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
1261
+ limit: z9.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
1212
1262
  });
1213
- var approveActionSchema = z8.object({
1214
- actionId: z8.string().describe("The inbox item ID to approve (from list_pending_actions)")
1263
+ var approveActionSchema = z9.object({
1264
+ actionId: z9.string().describe("The inbox item ID to approve (from list_pending_actions)")
1215
1265
  });
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(
1266
+ var rejectActionSchema = z9.object({
1267
+ actionId: z9.string().describe("The inbox item ID to reject (from list_pending_actions)"),
1268
+ reason: z9.string().trim().min(1).max(1e3).optional().describe(
1219
1269
  "Why, in the user's words. Kept with the rejection so the agents do not propose the same thing again."
1220
1270
  )
1221
1271
  });
1222
- var checkActionNowSchema = z8.object({
1223
- actionId: z8.string().describe(
1272
+ var checkActionNowSchema = z9.object({
1273
+ actionId: z9.string().describe(
1224
1274
  '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
1275
  )
1226
1276
  });
1227
- var renameCustomPageActionSchema = z8.object({
1228
- actionId: z8.string().describe(
1277
+ var renameCustomPageActionSchema = z9.object({
1278
+ actionId: z9.string().describe(
1229
1279
  '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
1280
  ),
1231
- name: z8.string().trim().min(1).max(100).describe(
1281
+ name: z9.string().trim().min(1).max(100).describe(
1232
1282
  "The new page name: at most 100 characters (UTF-16 units), not its current name, not a page the app already has"
1233
1283
  )
1234
1284
  });
@@ -1302,6 +1352,11 @@ async function commandItem(client, itemId, intent, reason) {
1302
1352
  }
1303
1353
  };
1304
1354
  }
1355
+ function refusedMessage(result) {
1356
+ const said = result?.error ?? "The approval could not be recorded.";
1357
+ const check = result?.policyRefusal?.check;
1358
+ return check ? `Stopped by the ${check}: ${said}` : said;
1359
+ }
1305
1360
  async function approveAction(input, client) {
1306
1361
  try {
1307
1362
  const { command, result } = await commandItem(
@@ -1317,7 +1372,7 @@ async function approveAction(input, client) {
1317
1372
  command,
1318
1373
  result: result?.result ?? "unknown",
1319
1374
  ...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.",
1375
+ message: applied2 ? command === "acknowledge" ? "Acknowledged." : "Approved. Fload delivers it after a short undo window; the inbox shows where it is." : refusedMessage(result),
1321
1376
  item: result?.item
1322
1377
  },
1323
1378
  !applied2
@@ -1467,22 +1522,22 @@ async function renameCustomPageAction(input, client) {
1467
1522
  }
1468
1523
 
1469
1524
  // 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")
1525
+ import { z as z10 } from "zod";
1526
+ var getAsoSummarySchema = z10.object({
1527
+ assetId: z10.string().uuid().describe("App UUID to get ASO summary for")
1473
1528
  });
1474
- var getAsoRecommendationsSchema = z9.object({
1475
- assetId: z9.string().uuid().describe("App UUID to get ASO recommendations for")
1529
+ var getAsoRecommendationsSchema = z10.object({
1530
+ assetId: z10.string().uuid().describe("App UUID to get ASO recommendations for")
1476
1531
  });
1477
- var getAsoKeywordsSchema = z9.object({
1478
- assetId: z9.string().uuid().describe("App UUID to get keyword intelligence for"),
1479
- locale: z9.string().optional().describe(
1532
+ var getAsoKeywordsSchema = z10.object({
1533
+ assetId: z10.string().uuid().describe("App UUID to get keyword intelligence for"),
1534
+ locale: z10.string().optional().describe(
1480
1535
  'Locale code to filter keywords (e.g., "en-US", "de-DE"). Returns all locales if omitted.'
1481
1536
  )
1482
1537
  });
1483
- var getAsoExperimentsSchema = z9.object({
1484
- assetId: z9.string().uuid().describe("App UUID to list ASO experiments for"),
1485
- status: z9.enum([
1538
+ var getAsoExperimentsSchema = z10.object({
1539
+ assetId: z10.string().uuid().describe("App UUID to list ASO experiments for"),
1540
+ status: z10.enum([
1486
1541
  "proposed",
1487
1542
  "approved",
1488
1543
  "applied",
@@ -1490,22 +1545,22 @@ var getAsoExperimentsSchema = z9.object({
1490
1545
  "completed",
1491
1546
  "reverted"
1492
1547
  ]).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)")
1548
+ limit: z10.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1549
+ cursor: z10.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
1495
1550
  });
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(
1551
+ var getAsoLocaleSnapshotsSchema = z10.object({
1552
+ assetId: z10.string().uuid().describe("App UUID to get locale snapshots for"),
1553
+ store: z10.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1554
+ locale: z10.string().optional().describe(
1500
1555
  'Filter to a single locale (e.g. "en-US"). Returns all locales if omitted.'
1501
1556
  ),
1502
- view: z9.enum(["latest", "history"]).default("latest").describe(
1557
+ view: z10.enum(["latest", "history"]).default("latest").describe(
1503
1558
  '"latest" (default) = newest snapshot per (locale, type); "history" = raw revisions newest first'
1504
1559
  ),
1505
- limit: z9.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1560
+ limit: z10.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
1506
1561
  });
1507
- var triggerAsoAnalysisSchema = z9.object({
1508
- assetId: z9.string().uuid().describe("App UUID to trigger ASO analysis for")
1562
+ var triggerAsoAnalysisSchema = z10.object({
1563
+ assetId: z10.string().uuid().describe("App UUID to trigger ASO analysis for")
1509
1564
  });
1510
1565
  async function getAsoSummary(input, client) {
1511
1566
  try {
@@ -1673,7 +1728,7 @@ async function triggerAsoAnalysis(input, client) {
1673
1728
  };
1674
1729
  }
1675
1730
  }
1676
- var getAsoEvidenceSchema = z9.object({ assetId: z9.string().uuid() });
1731
+ var getAsoEvidenceSchema = z10.object({ assetId: z10.string().uuid() });
1677
1732
  async function getAsoEvidence(input, client) {
1678
1733
  try {
1679
1734
  const response = await client.get(
@@ -1692,19 +1747,19 @@ async function getAsoEvidence(input, client) {
1692
1747
 
1693
1748
  // src/tools/chat.ts
1694
1749
  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")
1750
+ import { z as z11 } from "zod";
1751
+ var listConversationsSchema = z11.object({
1752
+ limit: z11.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
1698
1753
  });
1699
- var getConversationMessagesSchema = z10.object({
1700
- conversationId: z10.string().uuid().describe("The conversation UUID to get messages for")
1754
+ var getConversationMessagesSchema = z11.object({
1755
+ conversationId: z11.string().uuid().describe("The conversation UUID to get messages for")
1701
1756
  });
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(
1757
+ var sendChatMessageSchema = z11.object({
1758
+ message: z11.string().describe("The message to send to the AI chat"),
1759
+ conversationId: z11.string().uuid().optional().describe(
1705
1760
  "Existing conversation UUID to continue. Starts a new conversation if omitted."
1706
1761
  ),
1707
- agentType: z10.string().optional().describe(
1762
+ agentType: z11.string().optional().describe(
1708
1763
  "Agent type to use for the conversation (e.g., review, monitoring)"
1709
1764
  )
1710
1765
  });
@@ -1960,6 +2015,14 @@ function registerTools(server, client, options = {}) {
1960
2015
  discoverDimensions,
1961
2016
  { readOnlyHint: true, openWorldHint: false }
1962
2017
  );
2018
+ tool(
2019
+ "get_download_impact",
2020
+ "Get what Fload changed on downloads",
2021
+ "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.",
2022
+ getDownloadImpactSchema,
2023
+ getDownloadImpact,
2024
+ { readOnlyHint: true, openWorldHint: false }
2025
+ );
1963
2026
  tool(
1964
2027
  "list_agents",
1965
2028
  "List agents",