@fload-ai/mcp 0.7.0 → 0.8.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":"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"}
@@ -1176,6 +1176,14 @@ var checkActionNowSchema = z7.object({
1176
1176
  '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
1177
  )
1178
1178
  });
1179
+ var renameCustomPageActionSchema = z7.object({
1180
+ actionId: z7.string().describe(
1181
+ '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)'
1182
+ ),
1183
+ name: z7.string().trim().min(1).max(100).describe(
1184
+ "The new page name: at most 100 characters (UTF-16 units), not its current name, not a page the app already has"
1185
+ )
1186
+ });
1179
1187
  function commandFor(kind, intent) {
1180
1188
  if (kind === "notice")
1181
1189
  return intent === "approve" ? "acknowledge" : "dismiss";
@@ -1253,18 +1261,18 @@ async function approveAction(input, client) {
1253
1261
  input.actionId,
1254
1262
  "approve"
1255
1263
  );
1256
- const applied = result?.result === "applied" || result?.result === "replayed";
1264
+ const applied2 = result?.result === "applied" || result?.result === "replayed";
1257
1265
  return toolText(
1258
1266
  {
1259
- success: applied,
1267
+ success: applied2,
1260
1268
  actionId: input.actionId,
1261
1269
  command,
1262
1270
  result: result?.result ?? "unknown",
1263
1271
  ...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.",
1272
+ 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
1273
  item: result?.item
1266
1274
  },
1267
- !applied
1275
+ !applied2
1268
1276
  );
1269
1277
  } catch (error) {
1270
1278
  return toolError(error);
@@ -1278,18 +1286,18 @@ async function rejectAction(input, client) {
1278
1286
  "reject",
1279
1287
  input.reason
1280
1288
  );
1281
- const applied = result?.result === "applied" || result?.result === "replayed";
1289
+ const applied2 = result?.result === "applied" || result?.result === "replayed";
1282
1290
  return toolText(
1283
1291
  {
1284
- success: applied,
1292
+ success: applied2,
1285
1293
  actionId: input.actionId,
1286
1294
  command,
1287
1295
  result: result?.result ?? "unknown",
1288
1296
  ...result?.error ? { error: result.error } : {},
1289
- message: applied ? command === "dismiss" ? "Dismissed." : "Rejected. Nothing was sent." : result?.error ?? "The rejection could not be recorded.",
1297
+ message: applied2 ? command === "dismiss" ? "Dismissed." : "Rejected. Nothing was sent." : result?.error ?? "The rejection could not be recorded.",
1290
1298
  item: result?.item
1291
1299
  },
1292
- !applied
1300
+ !applied2
1293
1301
  );
1294
1302
  } catch (error) {
1295
1303
  return toolError(error);
@@ -1306,19 +1314,104 @@ async function checkActionNow(input, client) {
1306
1314
  }
1307
1315
  );
1308
1316
  const result = answer.body?.results?.[0];
1309
- const applied = result?.result === "applied" || result?.result === "replayed";
1317
+ const applied2 = result?.result === "applied" || result?.result === "replayed";
1310
1318
  const error = result?.error ? publicMcpErrorMessage(result.error, "Fload could not check it now.") : void 0;
1311
1319
  return toolText(
1312
1320
  {
1313
- success: applied,
1321
+ success: applied2,
1314
1322
  actionId: input.actionId,
1315
1323
  command: "check_now",
1316
1324
  result: result?.result ?? "unknown",
1317
1325
  ...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."),
1326
+ 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
1327
  item: result?.item
1320
1328
  },
1321
- !applied
1329
+ !applied2
1330
+ );
1331
+ } catch (error) {
1332
+ return toolError(error);
1333
+ }
1334
+ }
1335
+ var applied = (result) => result?.result === "applied" || result?.result === "replayed";
1336
+ async function sendItemCommand(client, body) {
1337
+ const { command, itemId, revisionId, ...extra } = body;
1338
+ const answer = await client.postForAnswer(
1339
+ "/api/actions/commands",
1340
+ {
1341
+ command,
1342
+ idempotencyKey: `mcp:${command}:${itemId}:${randomUUID()}`,
1343
+ targets: [{ itemId, ...revisionId ? { revisionId } : {} }],
1344
+ ...extra
1345
+ }
1346
+ );
1347
+ const result = answer.body?.results?.[0];
1348
+ if (applied(result)) return { result, refusal: null };
1349
+ const said = result?.error ?? answer.body?.message;
1350
+ return {
1351
+ result,
1352
+ refusal: publicMcpErrorMessage(
1353
+ said,
1354
+ answer.ok ? "Fload returned no result for the command." : "Fload rejected the request. Please check access and try again."
1355
+ )
1356
+ };
1357
+ }
1358
+ function renameAnswer(input, outcome, item) {
1359
+ const success = outcome.renamed && outcome.approved;
1360
+ return toolText(
1361
+ {
1362
+ success,
1363
+ actionId: input.actionId,
1364
+ ...outcome,
1365
+ ...item === void 0 ? {} : { item }
1366
+ },
1367
+ !success
1368
+ );
1369
+ }
1370
+ async function renameCustomPageAction(input, client) {
1371
+ try {
1372
+ const name = input.name.trim();
1373
+ const detail = await client.get(
1374
+ `/api/actions/items/${encodeURIComponent(input.actionId)}`
1375
+ );
1376
+ const item = detail.item;
1377
+ if (!item || item.kind !== "asc_custom_product_page" || !item.subjectKey?.startsWith("asc-cpp:"))
1378
+ return renameAnswer(input, {
1379
+ renamed: false,
1380
+ approved: false,
1381
+ message: "This item is not a request to create a custom product page."
1382
+ });
1383
+ const edit = await sendItemCommand(client, {
1384
+ command: "edit",
1385
+ itemId: item.id,
1386
+ revisionId: item.currentRevisionId,
1387
+ pageName: name
1388
+ });
1389
+ if (edit.refusal)
1390
+ return renameAnswer(input, {
1391
+ renamed: false,
1392
+ approved: false,
1393
+ message: edit.refusal
1394
+ });
1395
+ const renamed = edit.result?.item;
1396
+ const approve = await sendItemCommand(client, {
1397
+ command: "approve",
1398
+ itemId: item.id,
1399
+ revisionId: renamed?.currentRevisionId ?? null
1400
+ });
1401
+ return renameAnswer(
1402
+ input,
1403
+ approve.refusal ? {
1404
+ renamed: true,
1405
+ approved: false,
1406
+ // The server's own refusal, as it said it.
1407
+ message: approve.refusal,
1408
+ next: `The page is renamed to \u201C${name}\u201D and waits for approval (approve_action).`
1409
+ } : {
1410
+ renamed: true,
1411
+ approved: true,
1412
+ message: `Renamed to \u201C${name}\u201D and approved. Fload creates the page after a short undo window; the inbox shows where it is.`
1413
+ },
1414
+ approve.result?.item ?? renamed
1322
1415
  );
1323
1416
  } catch (error) {
1324
1417
  return toolError(error);
@@ -1933,6 +2026,14 @@ function registerTools(server, client, options = {}) {
1933
2026
  checkActionNow,
1934
2027
  { readOnlyHint: false, destructiveHint: false, openWorldHint: true }
1935
2028
  );
2029
+ tool(
2030
+ "rename_custom_page_action",
2031
+ "Rename a custom product page request and send it",
2032
+ '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.',
2033
+ renameCustomPageActionSchema,
2034
+ renameCustomPageAction,
2035
+ { readOnlyHint: false, destructiveHint: true, openWorldHint: true }
2036
+ );
1936
2037
  tool(
1937
2038
  "get_aso_summary",
1938
2039
  "Get ASO summary",
@@ -2069,6 +2170,8 @@ export {
2069
2170
  registerTools,
2070
2171
  rejectAction,
2071
2172
  rejectActionSchema,
2173
+ renameCustomPageAction,
2174
+ renameCustomPageActionSchema,
2072
2175
  resumeAgent,
2073
2176
  resumeAgentSchema,
2074
2177
  sendChatMessage,