@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.
- package/README.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/bin.js +113 -12
- package/dist/bin.js.map +3 -3
- package/dist/index.js +113 -12
- package/dist/index.js.map +3 -3
- package/dist/tools/actions.d.ts +11 -0
- package/dist/tools/actions.d.ts.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +115 -12
- package/dist/tools/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1276,6 +1276,14 @@ var checkActionNowSchema = z7.object({
|
|
|
1276
1276
|
'The inbox item ID to check now (from list_pending_actions with view "queued", or an approve_action result; its commands include check_now)'
|
|
1277
1277
|
)
|
|
1278
1278
|
});
|
|
1279
|
+
var renameCustomPageActionSchema = z7.object({
|
|
1280
|
+
actionId: z7.string().describe(
|
|
1281
|
+
'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)'
|
|
1282
|
+
),
|
|
1283
|
+
name: z7.string().trim().min(1).max(100).describe(
|
|
1284
|
+
"The new page name: at most 100 characters (UTF-16 units), not its current name, not a page the app already has"
|
|
1285
|
+
)
|
|
1286
|
+
});
|
|
1279
1287
|
function commandFor(kind, intent) {
|
|
1280
1288
|
if (kind === "notice")
|
|
1281
1289
|
return intent === "approve" ? "acknowledge" : "dismiss";
|
|
@@ -1353,18 +1361,18 @@ async function approveAction(input, client) {
|
|
|
1353
1361
|
input.actionId,
|
|
1354
1362
|
"approve"
|
|
1355
1363
|
);
|
|
1356
|
-
const
|
|
1364
|
+
const applied2 = result?.result === "applied" || result?.result === "replayed";
|
|
1357
1365
|
return toolText(
|
|
1358
1366
|
{
|
|
1359
|
-
success:
|
|
1367
|
+
success: applied2,
|
|
1360
1368
|
actionId: input.actionId,
|
|
1361
1369
|
command,
|
|
1362
1370
|
result: result?.result ?? "unknown",
|
|
1363
1371
|
...result?.error ? { error: result.error } : {},
|
|
1364
|
-
message:
|
|
1372
|
+
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.",
|
|
1365
1373
|
item: result?.item
|
|
1366
1374
|
},
|
|
1367
|
-
!
|
|
1375
|
+
!applied2
|
|
1368
1376
|
);
|
|
1369
1377
|
} catch (error) {
|
|
1370
1378
|
return toolError(error);
|
|
@@ -1378,18 +1386,18 @@ async function rejectAction(input, client) {
|
|
|
1378
1386
|
"reject",
|
|
1379
1387
|
input.reason
|
|
1380
1388
|
);
|
|
1381
|
-
const
|
|
1389
|
+
const applied2 = result?.result === "applied" || result?.result === "replayed";
|
|
1382
1390
|
return toolText(
|
|
1383
1391
|
{
|
|
1384
|
-
success:
|
|
1392
|
+
success: applied2,
|
|
1385
1393
|
actionId: input.actionId,
|
|
1386
1394
|
command,
|
|
1387
1395
|
result: result?.result ?? "unknown",
|
|
1388
1396
|
...result?.error ? { error: result.error } : {},
|
|
1389
|
-
message:
|
|
1397
|
+
message: applied2 ? command === "dismiss" ? "Dismissed." : "Rejected. Nothing was sent." : result?.error ?? "The rejection could not be recorded.",
|
|
1390
1398
|
item: result?.item
|
|
1391
1399
|
},
|
|
1392
|
-
!
|
|
1400
|
+
!applied2
|
|
1393
1401
|
);
|
|
1394
1402
|
} catch (error) {
|
|
1395
1403
|
return toolError(error);
|
|
@@ -1406,19 +1414,104 @@ async function checkActionNow(input, client) {
|
|
|
1406
1414
|
}
|
|
1407
1415
|
);
|
|
1408
1416
|
const result = answer.body?.results?.[0];
|
|
1409
|
-
const
|
|
1417
|
+
const applied2 = result?.result === "applied" || result?.result === "replayed";
|
|
1410
1418
|
const error = result?.error ? publicMcpErrorMessage(result.error, "Fload could not check it now.") : void 0;
|
|
1411
1419
|
return toolText(
|
|
1412
1420
|
{
|
|
1413
|
-
success:
|
|
1421
|
+
success: applied2,
|
|
1414
1422
|
actionId: input.actionId,
|
|
1415
1423
|
command: "check_now",
|
|
1416
1424
|
result: result?.result ?? "unknown",
|
|
1417
1425
|
...error ? { error } : {},
|
|
1418
|
-
message:
|
|
1426
|
+
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."),
|
|
1419
1427
|
item: result?.item
|
|
1420
1428
|
},
|
|
1421
|
-
!
|
|
1429
|
+
!applied2
|
|
1430
|
+
);
|
|
1431
|
+
} catch (error) {
|
|
1432
|
+
return toolError(error);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
var applied = (result) => result?.result === "applied" || result?.result === "replayed";
|
|
1436
|
+
async function sendItemCommand(client, body) {
|
|
1437
|
+
const { command, itemId, revisionId, ...extra } = body;
|
|
1438
|
+
const answer = await client.postForAnswer(
|
|
1439
|
+
"/api/actions/commands",
|
|
1440
|
+
{
|
|
1441
|
+
command,
|
|
1442
|
+
idempotencyKey: `mcp:${command}:${itemId}:${randomUUID()}`,
|
|
1443
|
+
targets: [{ itemId, ...revisionId ? { revisionId } : {} }],
|
|
1444
|
+
...extra
|
|
1445
|
+
}
|
|
1446
|
+
);
|
|
1447
|
+
const result = answer.body?.results?.[0];
|
|
1448
|
+
if (applied(result)) return { result, refusal: null };
|
|
1449
|
+
const said = result?.error ?? answer.body?.message;
|
|
1450
|
+
return {
|
|
1451
|
+
result,
|
|
1452
|
+
refusal: publicMcpErrorMessage(
|
|
1453
|
+
said,
|
|
1454
|
+
answer.ok ? "Fload returned no result for the command." : "Fload rejected the request. Please check access and try again."
|
|
1455
|
+
)
|
|
1456
|
+
};
|
|
1457
|
+
}
|
|
1458
|
+
function renameAnswer(input, outcome, item) {
|
|
1459
|
+
const success = outcome.renamed && outcome.approved;
|
|
1460
|
+
return toolText(
|
|
1461
|
+
{
|
|
1462
|
+
success,
|
|
1463
|
+
actionId: input.actionId,
|
|
1464
|
+
...outcome,
|
|
1465
|
+
...item === void 0 ? {} : { item }
|
|
1466
|
+
},
|
|
1467
|
+
!success
|
|
1468
|
+
);
|
|
1469
|
+
}
|
|
1470
|
+
async function renameCustomPageAction(input, client) {
|
|
1471
|
+
try {
|
|
1472
|
+
const name = input.name.trim();
|
|
1473
|
+
const detail = await client.get(
|
|
1474
|
+
`/api/actions/items/${encodeURIComponent(input.actionId)}`
|
|
1475
|
+
);
|
|
1476
|
+
const item = detail.item;
|
|
1477
|
+
if (!item || item.kind !== "asc_custom_product_page" || !item.subjectKey?.startsWith("asc-cpp:"))
|
|
1478
|
+
return renameAnswer(input, {
|
|
1479
|
+
renamed: false,
|
|
1480
|
+
approved: false,
|
|
1481
|
+
message: "This item is not a request to create a custom product page."
|
|
1482
|
+
});
|
|
1483
|
+
const edit = await sendItemCommand(client, {
|
|
1484
|
+
command: "edit",
|
|
1485
|
+
itemId: item.id,
|
|
1486
|
+
revisionId: item.currentRevisionId,
|
|
1487
|
+
pageName: name
|
|
1488
|
+
});
|
|
1489
|
+
if (edit.refusal)
|
|
1490
|
+
return renameAnswer(input, {
|
|
1491
|
+
renamed: false,
|
|
1492
|
+
approved: false,
|
|
1493
|
+
message: edit.refusal
|
|
1494
|
+
});
|
|
1495
|
+
const renamed = edit.result?.item;
|
|
1496
|
+
const approve = await sendItemCommand(client, {
|
|
1497
|
+
command: "approve",
|
|
1498
|
+
itemId: item.id,
|
|
1499
|
+
revisionId: renamed?.currentRevisionId ?? null
|
|
1500
|
+
});
|
|
1501
|
+
return renameAnswer(
|
|
1502
|
+
input,
|
|
1503
|
+
approve.refusal ? {
|
|
1504
|
+
renamed: true,
|
|
1505
|
+
approved: false,
|
|
1506
|
+
// The server's own refusal, as it said it.
|
|
1507
|
+
message: approve.refusal,
|
|
1508
|
+
next: `The page is renamed to \u201C${name}\u201D and waits for approval (approve_action).`
|
|
1509
|
+
} : {
|
|
1510
|
+
renamed: true,
|
|
1511
|
+
approved: true,
|
|
1512
|
+
message: `Renamed to \u201C${name}\u201D and approved. Fload creates the page after a short undo window; the inbox shows where it is.`
|
|
1513
|
+
},
|
|
1514
|
+
approve.result?.item ?? renamed
|
|
1422
1515
|
);
|
|
1423
1516
|
} catch (error) {
|
|
1424
1517
|
return toolError(error);
|
|
@@ -2033,6 +2126,14 @@ function registerTools(server, client, options = {}) {
|
|
|
2033
2126
|
checkActionNow,
|
|
2034
2127
|
{ readOnlyHint: false, destructiveHint: false, openWorldHint: true }
|
|
2035
2128
|
);
|
|
2129
|
+
tool(
|
|
2130
|
+
"rename_custom_page_action",
|
|
2131
|
+
"Rename a custom product page request and send it",
|
|
2132
|
+
'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.',
|
|
2133
|
+
renameCustomPageActionSchema,
|
|
2134
|
+
renameCustomPageAction,
|
|
2135
|
+
{ readOnlyHint: false, destructiveHint: true, openWorldHint: true }
|
|
2136
|
+
);
|
|
2036
2137
|
tool(
|
|
2037
2138
|
"get_aso_summary",
|
|
2038
2139
|
"Get ASO summary",
|