@fload-ai/mcp 0.8.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
@@ -468,7 +468,7 @@ var getMetricsSchema = z4.object({
468
468
  endDate: z4.string().optional().describe("End date (YYYY-MM-DD). Defaults to today."),
469
469
  granularity: z4.enum(["daily", "weekly", "monthly"]).default("daily").describe("Data granularity"),
470
470
  dimension: z4.string().optional().describe(
471
- 'Optional dimension to break down by (e.g., "storefront" for country, "platform" for device). Use discover_dimensions to see options.'
471
+ 'Optional dimension to break down by (e.g., "storefront" for country, "platform" for device). Use discover_dimensions to see options. Each metric then carries `breakdown`: the period value, share and change of every value, aggregated for the metric type (read its `basis`: "latest" is the last day, never a sum; "daily_average" is an average a day, never a period total). Answer per-country questions from `breakdown`, never by adding up `timeseries`, which keeps only the top values each day.'
472
472
  ),
473
473
  dimensionFilter: z4.string().optional().describe(
474
474
  'Filter to a specific dimension value (e.g., "US" when dimension is "storefront")'
@@ -682,7 +682,10 @@ async function getMetrics(input, client) {
682
682
  displayName: info[name]?.displayName || name,
683
683
  type: info[name]?.type || "count",
684
684
  summary: summaries[name],
685
- change: changes[name] || null
685
+ change: changes[name] || null,
686
+ ...input.dimension && {
687
+ breakdown: summaryResponse.breakdownTotals?.[name] ?? null
688
+ }
686
689
  })),
687
690
  timeseries: data,
688
691
  meta
@@ -746,8 +749,58 @@ async function discoverDimensions(input, client) {
746
749
  }
747
750
  }
748
751
 
749
- // src/tools/agents.ts
752
+ // src/tools/download-impact.ts
750
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";
751
804
  function asRecord(value) {
752
805
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
753
806
  }
@@ -756,28 +809,28 @@ var AGENT_DESCRIPTIONS = {
756
809
  review: "AI-powered review management \u2014 drafts and sends replies to app store reviews",
757
810
  aso: "App Store Optimization \u2014 listing optimization suggestions for better visibility"
758
811
  };
759
- var listAgentsSchema = z5.object({});
760
- var getAgentDetailsSchema = z5.object({
761
- agentType: z5.enum(AGENT_TYPES).describe("The type of agent to get details for"),
762
- 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)")
763
816
  });
764
- var getAgentRunHistorySchema = z5.object({
765
- agentType: z5.enum(AGENT_TYPES).describe("The type of agent to get run history for"),
766
- assetId: z5.string().uuid().optional().describe("App UUID to filter runs"),
767
- 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")
768
821
  });
769
- var triggerAgentRunSchema = z5.object({
770
- agentId: z5.string().describe("The agent ID to trigger a run for (the `id` from list_agents)"),
771
- 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")
772
825
  });
773
- var pauseAgentSchema = z5.object({
774
- 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)")
775
828
  });
776
- var resumeAgentSchema = z5.object({
777
- 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)")
778
831
  });
779
- var getAgentActivitySchema = z5.object({
780
- 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)")
781
834
  });
782
835
  async function listAgents(_input, client) {
783
836
  try {
@@ -1035,13 +1088,13 @@ async function getAgentActivity(input, client) {
1035
1088
  }
1036
1089
 
1037
1090
  // src/tools/ads.ts
1038
- import { z as z6 } from "zod";
1039
- var getAdsPerformanceSchema = z6.object({
1040
- assetId: z6.string().uuid().optional().describe("Filter by app UUID"),
1041
- platform: z6.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
1042
- fromDate: z6.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
1043
- toDate: z6.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
1044
- 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")
1045
1098
  });
1046
1099
  async function getAdsPerformance(input, client) {
1047
1100
  try {
@@ -1107,7 +1160,7 @@ async function getAdsPerformance(input, client) {
1107
1160
  }
1108
1161
 
1109
1162
  // src/tools/dashboard.ts
1110
- import { z as z7 } from "zod";
1163
+ import { z as z8 } from "zod";
1111
1164
  function parseDashboardNumber(value) {
1112
1165
  if (value === null || value === void 0 || value === "") return null;
1113
1166
  const parsed = typeof value === "number" ? value : Number.parseFloat(value);
@@ -1118,7 +1171,7 @@ function getSidebarAssets(response) {
1118
1171
  if (Array.isArray(response)) return response;
1119
1172
  return response.data ?? [];
1120
1173
  }
1121
- var getDashboardOverviewSchema = z7.object({});
1174
+ var getDashboardOverviewSchema = z8.object({});
1122
1175
  async function getDashboardOverview(_input, client) {
1123
1176
  try {
1124
1177
  const overviewPromise = client.get("/api/dashboard/overview-metrics").catch(() => null);
@@ -1174,7 +1227,7 @@ async function getDashboardOverview(_input, client) {
1174
1227
 
1175
1228
  // src/tools/actions.ts
1176
1229
  import { randomUUID } from "node:crypto";
1177
- import { z as z8 } from "zod";
1230
+ import { z as z9 } from "zod";
1178
1231
 
1179
1232
  // src/public-errors.ts
1180
1233
  var INTERNAL_ERROR_PATTERNS = [
@@ -1200,32 +1253,32 @@ function publicMcpErrorMessage(message, fallbackMessage = "Fload could not compl
1200
1253
  }
1201
1254
 
1202
1255
  // src/tools/actions.ts
1203
- var listPendingActionsSchema = z8.object({
1204
- assetId: z8.string().uuid().optional().describe("Filter by app UUID"),
1205
- 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(
1206
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)."
1207
1260
  ),
1208
- 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")
1209
1262
  });
1210
- var approveActionSchema = z8.object({
1211
- 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)")
1212
1265
  });
1213
- var rejectActionSchema = z8.object({
1214
- actionId: z8.string().describe("The inbox item ID to reject (from list_pending_actions)"),
1215
- 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(
1216
1269
  "Why, in the user's words. Kept with the rejection so the agents do not propose the same thing again."
1217
1270
  )
1218
1271
  });
1219
- var checkActionNowSchema = z8.object({
1220
- actionId: z8.string().describe(
1272
+ var checkActionNowSchema = z9.object({
1273
+ actionId: z9.string().describe(
1221
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)'
1222
1275
  )
1223
1276
  });
1224
- var renameCustomPageActionSchema = z8.object({
1225
- actionId: z8.string().describe(
1277
+ var renameCustomPageActionSchema = z9.object({
1278
+ actionId: z9.string().describe(
1226
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)'
1227
1280
  ),
1228
- name: z8.string().trim().min(1).max(100).describe(
1281
+ name: z9.string().trim().min(1).max(100).describe(
1229
1282
  "The new page name: at most 100 characters (UTF-16 units), not its current name, not a page the app already has"
1230
1283
  )
1231
1284
  });
@@ -1299,6 +1352,11 @@ async function commandItem(client, itemId, intent, reason) {
1299
1352
  }
1300
1353
  };
1301
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
+ }
1302
1360
  async function approveAction(input, client) {
1303
1361
  try {
1304
1362
  const { command, result } = await commandItem(
@@ -1314,7 +1372,7 @@ async function approveAction(input, client) {
1314
1372
  command,
1315
1373
  result: result?.result ?? "unknown",
1316
1374
  ...result?.error ? { error: result.error } : {},
1317
- 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),
1318
1376
  item: result?.item
1319
1377
  },
1320
1378
  !applied2
@@ -1464,22 +1522,22 @@ async function renameCustomPageAction(input, client) {
1464
1522
  }
1465
1523
 
1466
1524
  // src/tools/aso.ts
1467
- import { z as z9 } from "zod";
1468
- var getAsoSummarySchema = z9.object({
1469
- 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")
1470
1528
  });
1471
- var getAsoRecommendationsSchema = z9.object({
1472
- 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")
1473
1531
  });
1474
- var getAsoKeywordsSchema = z9.object({
1475
- assetId: z9.string().uuid().describe("App UUID to get keyword intelligence for"),
1476
- 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(
1477
1535
  'Locale code to filter keywords (e.g., "en-US", "de-DE"). Returns all locales if omitted.'
1478
1536
  )
1479
1537
  });
1480
- var getAsoExperimentsSchema = z9.object({
1481
- assetId: z9.string().uuid().describe("App UUID to list ASO experiments for"),
1482
- 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([
1483
1541
  "proposed",
1484
1542
  "approved",
1485
1543
  "applied",
@@ -1487,22 +1545,22 @@ var getAsoExperimentsSchema = z9.object({
1487
1545
  "completed",
1488
1546
  "reverted"
1489
1547
  ]).optional().describe("Filter experiments by status"),
1490
- limit: z9.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
1491
- 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)")
1492
1550
  });
1493
- var getAsoLocaleSnapshotsSchema = z9.object({
1494
- assetId: z9.string().uuid().describe("App UUID to get locale snapshots for"),
1495
- store: z9.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
1496
- 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(
1497
1555
  'Filter to a single locale (e.g. "en-US"). Returns all locales if omitted.'
1498
1556
  ),
1499
- view: z9.enum(["latest", "history"]).default("latest").describe(
1557
+ view: z10.enum(["latest", "history"]).default("latest").describe(
1500
1558
  '"latest" (default) = newest snapshot per (locale, type); "history" = raw revisions newest first'
1501
1559
  ),
1502
- 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)")
1503
1561
  });
1504
- var triggerAsoAnalysisSchema = z9.object({
1505
- 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")
1506
1564
  });
1507
1565
  async function getAsoSummary(input, client) {
1508
1566
  try {
@@ -1670,7 +1728,7 @@ async function triggerAsoAnalysis(input, client) {
1670
1728
  };
1671
1729
  }
1672
1730
  }
1673
- var getAsoEvidenceSchema = z9.object({ assetId: z9.string().uuid() });
1731
+ var getAsoEvidenceSchema = z10.object({ assetId: z10.string().uuid() });
1674
1732
  async function getAsoEvidence(input, client) {
1675
1733
  try {
1676
1734
  const response = await client.get(
@@ -1689,19 +1747,19 @@ async function getAsoEvidence(input, client) {
1689
1747
 
1690
1748
  // src/tools/chat.ts
1691
1749
  import { randomUUID as randomUUID2 } from "node:crypto";
1692
- import { z as z10 } from "zod";
1693
- var listConversationsSchema = z10.object({
1694
- 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")
1695
1753
  });
1696
- var getConversationMessagesSchema = z10.object({
1697
- 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")
1698
1756
  });
1699
- var sendChatMessageSchema = z10.object({
1700
- message: z10.string().describe("The message to send to the AI chat"),
1701
- 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(
1702
1760
  "Existing conversation UUID to continue. Starts a new conversation if omitted."
1703
1761
  ),
1704
- agentType: z10.string().optional().describe(
1762
+ agentType: z11.string().optional().describe(
1705
1763
  "Agent type to use for the conversation (e.g., review, monitoring)"
1706
1764
  )
1707
1765
  });
@@ -1957,6 +2015,14 @@ function registerTools(server, client, options = {}) {
1957
2015
  discoverDimensions,
1958
2016
  { readOnlyHint: true, openWorldHint: false }
1959
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
+ );
1960
2026
  tool(
1961
2027
  "list_agents",
1962
2028
  "List agents",