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