@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/bin.js
CHANGED
|
@@ -1221,6 +1221,14 @@ var checkActionNowSchema = z8.object({
|
|
|
1221
1221
|
'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
1222
|
)
|
|
1223
1223
|
});
|
|
1224
|
+
var renameCustomPageActionSchema = z8.object({
|
|
1225
|
+
actionId: z8.string().describe(
|
|
1226
|
+
'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
|
+
),
|
|
1228
|
+
name: z8.string().trim().min(1).max(100).describe(
|
|
1229
|
+
"The new page name: at most 100 characters (UTF-16 units), not its current name, not a page the app already has"
|
|
1230
|
+
)
|
|
1231
|
+
});
|
|
1224
1232
|
function commandFor(kind, intent) {
|
|
1225
1233
|
if (kind === "notice")
|
|
1226
1234
|
return intent === "approve" ? "acknowledge" : "dismiss";
|
|
@@ -1298,18 +1306,18 @@ async function approveAction(input, client) {
|
|
|
1298
1306
|
input.actionId,
|
|
1299
1307
|
"approve"
|
|
1300
1308
|
);
|
|
1301
|
-
const
|
|
1309
|
+
const applied2 = result?.result === "applied" || result?.result === "replayed";
|
|
1302
1310
|
return toolText(
|
|
1303
1311
|
{
|
|
1304
|
-
success:
|
|
1312
|
+
success: applied2,
|
|
1305
1313
|
actionId: input.actionId,
|
|
1306
1314
|
command,
|
|
1307
1315
|
result: result?.result ?? "unknown",
|
|
1308
1316
|
...result?.error ? { error: result.error } : {},
|
|
1309
|
-
message:
|
|
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.",
|
|
1310
1318
|
item: result?.item
|
|
1311
1319
|
},
|
|
1312
|
-
!
|
|
1320
|
+
!applied2
|
|
1313
1321
|
);
|
|
1314
1322
|
} catch (error) {
|
|
1315
1323
|
return toolError(error);
|
|
@@ -1323,18 +1331,18 @@ async function rejectAction(input, client) {
|
|
|
1323
1331
|
"reject",
|
|
1324
1332
|
input.reason
|
|
1325
1333
|
);
|
|
1326
|
-
const
|
|
1334
|
+
const applied2 = result?.result === "applied" || result?.result === "replayed";
|
|
1327
1335
|
return toolText(
|
|
1328
1336
|
{
|
|
1329
|
-
success:
|
|
1337
|
+
success: applied2,
|
|
1330
1338
|
actionId: input.actionId,
|
|
1331
1339
|
command,
|
|
1332
1340
|
result: result?.result ?? "unknown",
|
|
1333
1341
|
...result?.error ? { error: result.error } : {},
|
|
1334
|
-
message:
|
|
1342
|
+
message: applied2 ? command === "dismiss" ? "Dismissed." : "Rejected. Nothing was sent." : result?.error ?? "The rejection could not be recorded.",
|
|
1335
1343
|
item: result?.item
|
|
1336
1344
|
},
|
|
1337
|
-
!
|
|
1345
|
+
!applied2
|
|
1338
1346
|
);
|
|
1339
1347
|
} catch (error) {
|
|
1340
1348
|
return toolError(error);
|
|
@@ -1351,19 +1359,104 @@ async function checkActionNow(input, client) {
|
|
|
1351
1359
|
}
|
|
1352
1360
|
);
|
|
1353
1361
|
const result = answer.body?.results?.[0];
|
|
1354
|
-
const
|
|
1362
|
+
const applied2 = result?.result === "applied" || result?.result === "replayed";
|
|
1355
1363
|
const error = result?.error ? publicMcpErrorMessage(result.error, "Fload could not check it now.") : void 0;
|
|
1356
1364
|
return toolText(
|
|
1357
1365
|
{
|
|
1358
|
-
success:
|
|
1366
|
+
success: applied2,
|
|
1359
1367
|
actionId: input.actionId,
|
|
1360
1368
|
command: "check_now",
|
|
1361
1369
|
result: result?.result ?? "unknown",
|
|
1362
1370
|
...error ? { error } : {},
|
|
1363
|
-
message:
|
|
1371
|
+
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."),
|
|
1364
1372
|
item: result?.item
|
|
1365
1373
|
},
|
|
1366
|
-
!
|
|
1374
|
+
!applied2
|
|
1375
|
+
);
|
|
1376
|
+
} catch (error) {
|
|
1377
|
+
return toolError(error);
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
var applied = (result) => result?.result === "applied" || result?.result === "replayed";
|
|
1381
|
+
async function sendItemCommand(client, body) {
|
|
1382
|
+
const { command, itemId, revisionId, ...extra } = body;
|
|
1383
|
+
const answer = await client.postForAnswer(
|
|
1384
|
+
"/api/actions/commands",
|
|
1385
|
+
{
|
|
1386
|
+
command,
|
|
1387
|
+
idempotencyKey: `mcp:${command}:${itemId}:${randomUUID()}`,
|
|
1388
|
+
targets: [{ itemId, ...revisionId ? { revisionId } : {} }],
|
|
1389
|
+
...extra
|
|
1390
|
+
}
|
|
1391
|
+
);
|
|
1392
|
+
const result = answer.body?.results?.[0];
|
|
1393
|
+
if (applied(result)) return { result, refusal: null };
|
|
1394
|
+
const said = result?.error ?? answer.body?.message;
|
|
1395
|
+
return {
|
|
1396
|
+
result,
|
|
1397
|
+
refusal: publicMcpErrorMessage(
|
|
1398
|
+
said,
|
|
1399
|
+
answer.ok ? "Fload returned no result for the command." : "Fload rejected the request. Please check access and try again."
|
|
1400
|
+
)
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
function renameAnswer(input, outcome, item) {
|
|
1404
|
+
const success = outcome.renamed && outcome.approved;
|
|
1405
|
+
return toolText(
|
|
1406
|
+
{
|
|
1407
|
+
success,
|
|
1408
|
+
actionId: input.actionId,
|
|
1409
|
+
...outcome,
|
|
1410
|
+
...item === void 0 ? {} : { item }
|
|
1411
|
+
},
|
|
1412
|
+
!success
|
|
1413
|
+
);
|
|
1414
|
+
}
|
|
1415
|
+
async function renameCustomPageAction(input, client) {
|
|
1416
|
+
try {
|
|
1417
|
+
const name = input.name.trim();
|
|
1418
|
+
const detail = await client.get(
|
|
1419
|
+
`/api/actions/items/${encodeURIComponent(input.actionId)}`
|
|
1420
|
+
);
|
|
1421
|
+
const item = detail.item;
|
|
1422
|
+
if (!item || item.kind !== "asc_custom_product_page" || !item.subjectKey?.startsWith("asc-cpp:"))
|
|
1423
|
+
return renameAnswer(input, {
|
|
1424
|
+
renamed: false,
|
|
1425
|
+
approved: false,
|
|
1426
|
+
message: "This item is not a request to create a custom product page."
|
|
1427
|
+
});
|
|
1428
|
+
const edit = await sendItemCommand(client, {
|
|
1429
|
+
command: "edit",
|
|
1430
|
+
itemId: item.id,
|
|
1431
|
+
revisionId: item.currentRevisionId,
|
|
1432
|
+
pageName: name
|
|
1433
|
+
});
|
|
1434
|
+
if (edit.refusal)
|
|
1435
|
+
return renameAnswer(input, {
|
|
1436
|
+
renamed: false,
|
|
1437
|
+
approved: false,
|
|
1438
|
+
message: edit.refusal
|
|
1439
|
+
});
|
|
1440
|
+
const renamed = edit.result?.item;
|
|
1441
|
+
const approve = await sendItemCommand(client, {
|
|
1442
|
+
command: "approve",
|
|
1443
|
+
itemId: item.id,
|
|
1444
|
+
revisionId: renamed?.currentRevisionId ?? null
|
|
1445
|
+
});
|
|
1446
|
+
return renameAnswer(
|
|
1447
|
+
input,
|
|
1448
|
+
approve.refusal ? {
|
|
1449
|
+
renamed: true,
|
|
1450
|
+
approved: false,
|
|
1451
|
+
// The server's own refusal, as it said it.
|
|
1452
|
+
message: approve.refusal,
|
|
1453
|
+
next: `The page is renamed to \u201C${name}\u201D and waits for approval (approve_action).`
|
|
1454
|
+
} : {
|
|
1455
|
+
renamed: true,
|
|
1456
|
+
approved: true,
|
|
1457
|
+
message: `Renamed to \u201C${name}\u201D and approved. Fload creates the page after a short undo window; the inbox shows where it is.`
|
|
1458
|
+
},
|
|
1459
|
+
approve.result?.item ?? renamed
|
|
1367
1460
|
);
|
|
1368
1461
|
} catch (error) {
|
|
1369
1462
|
return toolError(error);
|
|
@@ -1978,6 +2071,14 @@ function registerTools(server, client, options = {}) {
|
|
|
1978
2071
|
checkActionNow,
|
|
1979
2072
|
{ readOnlyHint: false, destructiveHint: false, openWorldHint: true }
|
|
1980
2073
|
);
|
|
2074
|
+
tool(
|
|
2075
|
+
"rename_custom_page_action",
|
|
2076
|
+
"Rename a custom product page request and send it",
|
|
2077
|
+
'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.',
|
|
2078
|
+
renameCustomPageActionSchema,
|
|
2079
|
+
renameCustomPageAction,
|
|
2080
|
+
{ readOnlyHint: false, destructiveHint: true, openWorldHint: true }
|
|
2081
|
+
);
|
|
1981
2082
|
tool(
|
|
1982
2083
|
"get_aso_summary",
|
|
1983
2084
|
"Get ASO summary",
|