@fload-ai/mcp 0.7.0 → 0.9.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.
@@ -18,6 +18,10 @@ export declare const rejectActionSchema: z.ZodObject<{
18
18
  export declare const checkActionNowSchema: z.ZodObject<{
19
19
  actionId: z.ZodString;
20
20
  }, z.core.$strip>;
21
+ export declare const renameCustomPageActionSchema: z.ZodObject<{
22
+ actionId: z.ZodString;
23
+ name: z.ZodString;
24
+ }, z.core.$strip>;
21
25
  export declare function listPendingActions(input: z.input<typeof listPendingActionsSchema>, client: FloadApiClient): Promise<{
22
26
  isError?: boolean | undefined;
23
27
  content: {
@@ -46,4 +50,11 @@ export declare function checkActionNow(input: z.input<typeof checkActionNowSchem
46
50
  text: string;
47
51
  }[];
48
52
  }>;
53
+ export declare function renameCustomPageAction(input: z.input<typeof renameCustomPageActionSchema>, client: FloadApiClient): Promise<{
54
+ isError?: boolean | undefined;
55
+ content: {
56
+ type: "text";
57
+ text: string;
58
+ }[];
59
+ }>;
49
60
  //# sourceMappingURL=actions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/tools/actions.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAmCvD,eAAO,MAAM,wBAAwB;;;;;;;iBAenC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;iBAI9B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;iBAa7B,CAAC;AAGH,eAAO,MAAM,oBAAoB;;iBAM/B,CAAC;AAiCH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,EAC/C,MAAM,EAAE,cAAc;;;;;;GAgBvB;AA0DD,wBAAsB,aAAa,CACjC,KAAK,EAAE,CAAC,CAAC,K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CAC1C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,EACnD,MAAM,EAAE,cAAc;;;;;;GAwDvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/tools/analytics.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA+EvD,eAAO,MAAM,qBAAqB;;iBAKhC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;iBAgC3B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;iBAQnC,CAAC;AAmIH,wBAAsB,eAAe,CACnC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,EAC5C,MAAM,EAAE,cAAc;;;;;;;;;;;;GA8CvB;AAED,wBAAsB,UAAU,CAC9B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,EACvC,MAAM,EAAE,cAAc;;;;;;;;;;;;GAmFvB;AAED,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,EAC/C,MAAM,EAAE,cAAc;;;;;;;;;;;;GAuDvB"}
1
+ {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/tools/analytics.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAuGvD,eAAO,MAAM,qBAAqB;;iBAKhC,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;iBAgC3B,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;iBAQnC,CAAC;AAmIH,wBAAsB,eAAe,CACnC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,EAC5C,MAAM,EAAE,cAAc;;;;;;;;;;;;GA8CvB;AAED,wBAAsB,UAAU,CAC9B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,EACvC,MAAM,EAAE,cAAc;;;;;;;;;;;;GAyFvB;AAED,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,EAC/C,MAAM,EAAE,cAAc;;;;;;;;;;;;GAuDvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,SAAS,EAEV,MAAM,yCAAyC,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAkF1B,MAAM,WAAW,oBAAoB;IAMnC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAoBD,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,oBAAyB,GACjC,IAAI,CA2UN"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,SAAS,EAEV,MAAM,yCAAyC,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAoF1B,MAAM,WAAW,oBAAoB;IAMnC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAoBD,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,cAAc,EACtB,OAAO,GAAE,oBAAyB,GACjC,IAAI,CAmVN"}
@@ -423,7 +423,7 @@ var getMetricsSchema = z3.object({
423
423
  endDate: z3.string().optional().describe("End date (YYYY-MM-DD). Defaults to today."),
424
424
  granularity: z3.enum(["daily", "weekly", "monthly"]).default("daily").describe("Data granularity"),
425
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.'
426
+ '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.'
427
427
  ),
428
428
  dimensionFilter: z3.string().optional().describe(
429
429
  'Filter to a specific dimension value (e.g., "US" when dimension is "storefront")'
@@ -637,7 +637,10 @@ async function getMetrics(input, client) {
637
637
  displayName: info[name]?.displayName || name,
638
638
  type: info[name]?.type || "count",
639
639
  summary: summaries[name],
640
- change: changes[name] || null
640
+ change: changes[name] || null,
641
+ ...input.dimension && {
642
+ breakdown: summaryResponse.breakdownTotals?.[name] ?? null
643
+ }
641
644
  })),
642
645
  timeseries: data,
643
646
  meta
@@ -1176,6 +1179,14 @@ var checkActionNowSchema = z7.object({
1176
1179
  '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
1180
  )
1178
1181
  });
1182
+ var renameCustomPageActionSchema = z7.object({
1183
+ actionId: z7.string().describe(
1184
+ '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)'
1185
+ ),
1186
+ name: z7.string().trim().min(1).max(100).describe(
1187
+ "The new page name: at most 100 characters (UTF-16 units), not its current name, not a page the app already has"
1188
+ )
1189
+ });
1179
1190
  function commandFor(kind, intent) {
1180
1191
  if (kind === "notice")
1181
1192
  return intent === "approve" ? "acknowledge" : "dismiss";
@@ -1253,18 +1264,18 @@ async function approveAction(input, client) {
1253
1264
  input.actionId,
1254
1265
  "approve"
1255
1266
  );
1256
- const applied = result?.result === "applied" || result?.result === "replayed";
1267
+ const applied2 = result?.result === "applied" || result?.result === "replayed";
1257
1268
  return toolText(
1258
1269
  {
1259
- success: applied,
1270
+ success: applied2,
1260
1271
  actionId: input.actionId,
1261
1272
  command,
1262
1273
  result: result?.result ?? "unknown",
1263
1274
  ...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.",
1275
+ 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.",
1265
1276
  item: result?.item
1266
1277
  },
1267
- !applied
1278
+ !applied2
1268
1279
  );
1269
1280
  } catch (error) {
1270
1281
  return toolError(error);
@@ -1278,18 +1289,18 @@ async function rejectAction(input, client) {
1278
1289
  "reject",
1279
1290
  input.reason
1280
1291
  );
1281
- const applied = result?.result === "applied" || result?.result === "replayed";
1292
+ const applied2 = result?.result === "applied" || result?.result === "replayed";
1282
1293
  return toolText(
1283
1294
  {
1284
- success: applied,
1295
+ success: applied2,
1285
1296
  actionId: input.actionId,
1286
1297
  command,
1287
1298
  result: result?.result ?? "unknown",
1288
1299
  ...result?.error ? { error: result.error } : {},
1289
- message: applied ? command === "dismiss" ? "Dismissed." : "Rejected. Nothing was sent." : result?.error ?? "The rejection could not be recorded.",
1300
+ message: applied2 ? command === "dismiss" ? "Dismissed." : "Rejected. Nothing was sent." : result?.error ?? "The rejection could not be recorded.",
1290
1301
  item: result?.item
1291
1302
  },
1292
- !applied
1303
+ !applied2
1293
1304
  );
1294
1305
  } catch (error) {
1295
1306
  return toolError(error);
@@ -1306,19 +1317,104 @@ async function checkActionNow(input, client) {
1306
1317
  }
1307
1318
  );
1308
1319
  const result = answer.body?.results?.[0];
1309
- const applied = result?.result === "applied" || result?.result === "replayed";
1320
+ const applied2 = result?.result === "applied" || result?.result === "replayed";
1310
1321
  const error = result?.error ? publicMcpErrorMessage(result.error, "Fload could not check it now.") : void 0;
1311
1322
  return toolText(
1312
1323
  {
1313
- success: applied,
1324
+ success: applied2,
1314
1325
  actionId: input.actionId,
1315
1326
  command: "check_now",
1316
1327
  result: result?.result ?? "unknown",
1317
1328
  ...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."),
1329
+ message: applied2 ? "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
1330
  item: result?.item
1320
1331
  },
1321
- !applied
1332
+ !applied2
1333
+ );
1334
+ } catch (error) {
1335
+ return toolError(error);
1336
+ }
1337
+ }
1338
+ var applied = (result) => result?.result === "applied" || result?.result === "replayed";
1339
+ async function sendItemCommand(client, body) {
1340
+ const { command, itemId, revisionId, ...extra } = body;
1341
+ const answer = await client.postForAnswer(
1342
+ "/api/actions/commands",
1343
+ {
1344
+ command,
1345
+ idempotencyKey: `mcp:${command}:${itemId}:${randomUUID()}`,
1346
+ targets: [{ itemId, ...revisionId ? { revisionId } : {} }],
1347
+ ...extra
1348
+ }
1349
+ );
1350
+ const result = answer.body?.results?.[0];
1351
+ if (applied(result)) return { result, refusal: null };
1352
+ const said = result?.error ?? answer.body?.message;
1353
+ return {
1354
+ result,
1355
+ refusal: publicMcpErrorMessage(
1356
+ said,
1357
+ answer.ok ? "Fload returned no result for the command." : "Fload rejected the request. Please check access and try again."
1358
+ )
1359
+ };
1360
+ }
1361
+ function renameAnswer(input, outcome, item) {
1362
+ const success = outcome.renamed && outcome.approved;
1363
+ return toolText(
1364
+ {
1365
+ success,
1366
+ actionId: input.actionId,
1367
+ ...outcome,
1368
+ ...item === void 0 ? {} : { item }
1369
+ },
1370
+ !success
1371
+ );
1372
+ }
1373
+ async function renameCustomPageAction(input, client) {
1374
+ try {
1375
+ const name = input.name.trim();
1376
+ const detail = await client.get(
1377
+ `/api/actions/items/${encodeURIComponent(input.actionId)}`
1378
+ );
1379
+ const item = detail.item;
1380
+ if (!item || item.kind !== "asc_custom_product_page" || !item.subjectKey?.startsWith("asc-cpp:"))
1381
+ return renameAnswer(input, {
1382
+ renamed: false,
1383
+ approved: false,
1384
+ message: "This item is not a request to create a custom product page."
1385
+ });
1386
+ const edit = await sendItemCommand(client, {
1387
+ command: "edit",
1388
+ itemId: item.id,
1389
+ revisionId: item.currentRevisionId,
1390
+ pageName: name
1391
+ });
1392
+ if (edit.refusal)
1393
+ return renameAnswer(input, {
1394
+ renamed: false,
1395
+ approved: false,
1396
+ message: edit.refusal
1397
+ });
1398
+ const renamed = edit.result?.item;
1399
+ const approve = await sendItemCommand(client, {
1400
+ command: "approve",
1401
+ itemId: item.id,
1402
+ revisionId: renamed?.currentRevisionId ?? null
1403
+ });
1404
+ return renameAnswer(
1405
+ input,
1406
+ approve.refusal ? {
1407
+ renamed: true,
1408
+ approved: false,
1409
+ // The server's own refusal, as it said it.
1410
+ message: approve.refusal,
1411
+ next: `The page is renamed to \u201C${name}\u201D and waits for approval (approve_action).`
1412
+ } : {
1413
+ renamed: true,
1414
+ approved: true,
1415
+ message: `Renamed to \u201C${name}\u201D and approved. Fload creates the page after a short undo window; the inbox shows where it is.`
1416
+ },
1417
+ approve.result?.item ?? renamed
1322
1418
  );
1323
1419
  } catch (error) {
1324
1420
  return toolError(error);
@@ -1933,6 +2029,14 @@ function registerTools(server, client, options = {}) {
1933
2029
  checkActionNow,
1934
2030
  { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
1935
2031
  );
2032
+ tool(
2033
+ "rename_custom_page_action",
2034
+ "Rename a custom product page request and send it",
2035
+ 'For a "Create custom product page" inbox item (actionId from list_pending_actions) that App Store Connect refused because the app already has a page of that name, or one still waiting for approval: rename it (name: at most 100 characters, not its current name, not a page the app already has) and approve it again on the same item. Fload then creates the page under the new name after a short undo window. Treat as destructive: it creates a page in App Store Connect. If the approve is refused, the item keeps its new name and waits for approval.',
2036
+ renameCustomPageActionSchema,
2037
+ renameCustomPageAction,
2038
+ { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
2039
+ );
1936
2040
  tool(
1937
2041
  "get_aso_summary",
1938
2042
  "Get ASO summary",
@@ -2069,6 +2173,8 @@ export {
2069
2173
  registerTools,
2070
2174
  rejectAction,
2071
2175
  rejectActionSchema,
2176
+ renameCustomPageAction,
2177
+ renameCustomPageActionSchema,
2072
2178
  resumeAgent,
2073
2179
  resumeAgentSchema,
2074
2180
  sendChatMessage,