@fload-ai/mcp 0.9.0 → 0.10.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 +137 -74
- package/dist/bin.js.map +4 -4
- package/dist/index.js +141 -78
- package/dist/index.js.map +4 -4
- package/dist/tools/actions.d.ts.map +1 -1
- package/dist/tools/download-impact.d.ts +27 -0
- package/dist/tools/download-impact.d.ts.map +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +139 -74
- package/dist/tools/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -829,8 +829,58 @@ async function discoverDimensions(input, client) {
|
|
|
829
829
|
}
|
|
830
830
|
}
|
|
831
831
|
|
|
832
|
-
// src/tools/
|
|
832
|
+
// src/tools/download-impact.ts
|
|
833
833
|
import { z as z4 } from "zod";
|
|
834
|
+
var Day = z4.string().regex(/^\d{4}-\d{2}-\d{2}$/).optional();
|
|
835
|
+
var getDownloadImpactSchema = z4.object({
|
|
836
|
+
assetId: z4.string().uuid().describe("App UUID (App Store apps)"),
|
|
837
|
+
from: Day.describe(
|
|
838
|
+
"First day drawn (YYYY-MM-DD); default 20 weeks before `to`"
|
|
839
|
+
),
|
|
840
|
+
to: Day.describe(
|
|
841
|
+
"Last day drawn (YYYY-MM-DD); default the newest day with data"
|
|
842
|
+
),
|
|
843
|
+
beforeFrom: Day.describe(
|
|
844
|
+
'Start of the "before" window compared (needs beforeTo; all windows within 400 days of each other)'
|
|
845
|
+
),
|
|
846
|
+
beforeTo: Day.describe('End of the "before" window compared'),
|
|
847
|
+
afterFrom: Day.describe(
|
|
848
|
+
'Start of the "after" window compared (needs afterTo)'
|
|
849
|
+
),
|
|
850
|
+
afterTo: Day.describe('End of the "after" window compared'),
|
|
851
|
+
country: z4.string().regex(/^[a-zA-Z]{2}$/).optional().describe(
|
|
852
|
+
'One storefront, two-letter code (e.g. "us"): narrows countries and keywords'
|
|
853
|
+
),
|
|
854
|
+
includeDays: z4.boolean().optional().describe("Also return every day (long). Weeks carry the same downloads.")
|
|
855
|
+
});
|
|
856
|
+
async function getDownloadImpact(input, client) {
|
|
857
|
+
try {
|
|
858
|
+
const { assetId, includeDays, ...query } = input;
|
|
859
|
+
const impact = await client.get(
|
|
860
|
+
`/api/assets/${assetId}/metrics/download-impact`,
|
|
861
|
+
query
|
|
862
|
+
);
|
|
863
|
+
const { days, lastYearDays, ...rest } = impact;
|
|
864
|
+
return {
|
|
865
|
+
content: [
|
|
866
|
+
{
|
|
867
|
+
type: "text",
|
|
868
|
+
text: formatAsJson(
|
|
869
|
+
includeDays ? { ...rest, days, lastYearDays } : rest
|
|
870
|
+
)
|
|
871
|
+
}
|
|
872
|
+
]
|
|
873
|
+
};
|
|
874
|
+
} catch (error) {
|
|
875
|
+
return {
|
|
876
|
+
content: [{ type: "text", text: formatError(error) }],
|
|
877
|
+
isError: true
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
// src/tools/agents.ts
|
|
883
|
+
import { z as z5 } from "zod";
|
|
834
884
|
function asRecord(value) {
|
|
835
885
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
836
886
|
}
|
|
@@ -839,28 +889,28 @@ var AGENT_DESCRIPTIONS = {
|
|
|
839
889
|
review: "AI-powered review management \u2014 drafts and sends replies to app store reviews",
|
|
840
890
|
aso: "App Store Optimization \u2014 listing optimization suggestions for better visibility"
|
|
841
891
|
};
|
|
842
|
-
var listAgentsSchema =
|
|
843
|
-
var getAgentDetailsSchema =
|
|
844
|
-
agentType:
|
|
845
|
-
assetId:
|
|
892
|
+
var listAgentsSchema = z5.object({});
|
|
893
|
+
var getAgentDetailsSchema = z5.object({
|
|
894
|
+
agentType: z5.enum(AGENT_TYPES).describe("The type of agent to get details for"),
|
|
895
|
+
assetId: z5.string().uuid().optional().describe("App UUID to get agent config for (when agent is per-asset)")
|
|
846
896
|
});
|
|
847
|
-
var getAgentRunHistorySchema =
|
|
848
|
-
agentType:
|
|
849
|
-
assetId:
|
|
850
|
-
limit:
|
|
897
|
+
var getAgentRunHistorySchema = z5.object({
|
|
898
|
+
agentType: z5.enum(AGENT_TYPES).describe("The type of agent to get run history for"),
|
|
899
|
+
assetId: z5.string().uuid().optional().describe("App UUID to filter runs"),
|
|
900
|
+
limit: z5.number().int().min(1).max(100).default(20).describe("Maximum number of runs to return")
|
|
851
901
|
});
|
|
852
|
-
var triggerAgentRunSchema =
|
|
853
|
-
agentId:
|
|
854
|
-
assetId:
|
|
902
|
+
var triggerAgentRunSchema = z5.object({
|
|
903
|
+
agentId: z5.string().describe("The agent ID to trigger a run for (the `id` from list_agents)"),
|
|
904
|
+
assetId: z5.string().uuid().optional().describe("Optional app UUID to run the agent against")
|
|
855
905
|
});
|
|
856
|
-
var pauseAgentSchema =
|
|
857
|
-
agentId:
|
|
906
|
+
var pauseAgentSchema = z5.object({
|
|
907
|
+
agentId: z5.string().describe("The agent ID to pause (the `id` from list_agents)")
|
|
858
908
|
});
|
|
859
|
-
var resumeAgentSchema =
|
|
860
|
-
agentId:
|
|
909
|
+
var resumeAgentSchema = z5.object({
|
|
910
|
+
agentId: z5.string().describe("The agent ID to resume (the `id` from list_agents)")
|
|
861
911
|
});
|
|
862
|
-
var getAgentActivitySchema =
|
|
863
|
-
agentId:
|
|
912
|
+
var getAgentActivitySchema = z5.object({
|
|
913
|
+
agentId: z5.string().describe("The agent ID to get activity for (the `id` from list_agents)")
|
|
864
914
|
});
|
|
865
915
|
async function listAgents(_input, client) {
|
|
866
916
|
try {
|
|
@@ -1118,13 +1168,13 @@ async function getAgentActivity(input, client) {
|
|
|
1118
1168
|
}
|
|
1119
1169
|
|
|
1120
1170
|
// src/tools/ads.ts
|
|
1121
|
-
import { z as
|
|
1122
|
-
var getAdsPerformanceSchema =
|
|
1123
|
-
assetId:
|
|
1124
|
-
platform:
|
|
1125
|
-
fromDate:
|
|
1126
|
-
toDate:
|
|
1127
|
-
limit:
|
|
1171
|
+
import { z as z6 } from "zod";
|
|
1172
|
+
var getAdsPerformanceSchema = z6.object({
|
|
1173
|
+
assetId: z6.string().uuid().optional().describe("Filter by app UUID"),
|
|
1174
|
+
platform: z6.enum(["apple_search_ads", "google_ads", "meta_ads", "tiktok_ads"]).optional().describe("Filter by ad platform"),
|
|
1175
|
+
fromDate: z6.string().optional().describe("Start date for performance data (YYYY-MM-DD)"),
|
|
1176
|
+
toDate: z6.string().optional().describe("End date for performance data (YYYY-MM-DD)"),
|
|
1177
|
+
limit: z6.number().int().min(1).max(100).default(50).describe("Maximum number of campaigns to return")
|
|
1128
1178
|
});
|
|
1129
1179
|
async function getAdsPerformance(input, client) {
|
|
1130
1180
|
try {
|
|
@@ -1190,7 +1240,7 @@ async function getAdsPerformance(input, client) {
|
|
|
1190
1240
|
}
|
|
1191
1241
|
|
|
1192
1242
|
// src/tools/dashboard.ts
|
|
1193
|
-
import { z as
|
|
1243
|
+
import { z as z7 } from "zod";
|
|
1194
1244
|
function parseDashboardNumber(value) {
|
|
1195
1245
|
if (value === null || value === void 0 || value === "") return null;
|
|
1196
1246
|
const parsed = typeof value === "number" ? value : Number.parseFloat(value);
|
|
@@ -1201,7 +1251,7 @@ function getSidebarAssets(response) {
|
|
|
1201
1251
|
if (Array.isArray(response)) return response;
|
|
1202
1252
|
return response.data ?? [];
|
|
1203
1253
|
}
|
|
1204
|
-
var getDashboardOverviewSchema =
|
|
1254
|
+
var getDashboardOverviewSchema = z7.object({});
|
|
1205
1255
|
async function getDashboardOverview(_input, client) {
|
|
1206
1256
|
try {
|
|
1207
1257
|
const overviewPromise = client.get("/api/dashboard/overview-metrics").catch(() => null);
|
|
@@ -1257,33 +1307,33 @@ async function getDashboardOverview(_input, client) {
|
|
|
1257
1307
|
|
|
1258
1308
|
// src/tools/actions.ts
|
|
1259
1309
|
import { randomUUID } from "node:crypto";
|
|
1260
|
-
import { z as
|
|
1261
|
-
var listPendingActionsSchema =
|
|
1262
|
-
assetId:
|
|
1263
|
-
view:
|
|
1310
|
+
import { z as z8 } from "zod";
|
|
1311
|
+
var listPendingActionsSchema = z8.object({
|
|
1312
|
+
assetId: z8.string().uuid().optional().describe("Filter by app UUID"),
|
|
1313
|
+
view: z8.enum(["open", "queued"]).default("open").describe(
|
|
1264
1314
|
"open (default): items waiting on the user. queued: approved work Fload is sending or checking in the store (an item being checked offers check_now)."
|
|
1265
1315
|
),
|
|
1266
|
-
limit:
|
|
1316
|
+
limit: z8.number().int().min(1).max(100).default(50).describe("Maximum number of actions to return")
|
|
1267
1317
|
});
|
|
1268
|
-
var approveActionSchema =
|
|
1269
|
-
actionId:
|
|
1318
|
+
var approveActionSchema = z8.object({
|
|
1319
|
+
actionId: z8.string().describe("The inbox item ID to approve (from list_pending_actions)")
|
|
1270
1320
|
});
|
|
1271
|
-
var rejectActionSchema =
|
|
1272
|
-
actionId:
|
|
1273
|
-
reason:
|
|
1321
|
+
var rejectActionSchema = z8.object({
|
|
1322
|
+
actionId: z8.string().describe("The inbox item ID to reject (from list_pending_actions)"),
|
|
1323
|
+
reason: z8.string().trim().min(1).max(1e3).optional().describe(
|
|
1274
1324
|
"Why, in the user's words. Kept with the rejection so the agents do not propose the same thing again."
|
|
1275
1325
|
)
|
|
1276
1326
|
});
|
|
1277
|
-
var checkActionNowSchema =
|
|
1278
|
-
actionId:
|
|
1327
|
+
var checkActionNowSchema = z8.object({
|
|
1328
|
+
actionId: z8.string().describe(
|
|
1279
1329
|
'The inbox item ID to check now (from list_pending_actions with view "queued", or an approve_action result; its commands include check_now)'
|
|
1280
1330
|
)
|
|
1281
1331
|
});
|
|
1282
|
-
var renameCustomPageActionSchema =
|
|
1283
|
-
actionId:
|
|
1332
|
+
var renameCustomPageActionSchema = z8.object({
|
|
1333
|
+
actionId: z8.string().describe(
|
|
1284
1334
|
'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
1335
|
),
|
|
1286
|
-
name:
|
|
1336
|
+
name: z8.string().trim().min(1).max(100).describe(
|
|
1287
1337
|
"The new page name: at most 100 characters (UTF-16 units), not its current name, not a page the app already has"
|
|
1288
1338
|
)
|
|
1289
1339
|
});
|
|
@@ -1357,6 +1407,11 @@ async function commandItem(client, itemId, intent, reason) {
|
|
|
1357
1407
|
}
|
|
1358
1408
|
};
|
|
1359
1409
|
}
|
|
1410
|
+
function refusedMessage(result) {
|
|
1411
|
+
const said = result?.error ?? "The approval could not be recorded.";
|
|
1412
|
+
const check = result?.policyRefusal?.check;
|
|
1413
|
+
return check ? `Stopped by the ${check}: ${said}` : said;
|
|
1414
|
+
}
|
|
1360
1415
|
async function approveAction(input, client) {
|
|
1361
1416
|
try {
|
|
1362
1417
|
const { command, result } = await commandItem(
|
|
@@ -1372,7 +1427,7 @@ async function approveAction(input, client) {
|
|
|
1372
1427
|
command,
|
|
1373
1428
|
result: result?.result ?? "unknown",
|
|
1374
1429
|
...result?.error ? { error: result.error } : {},
|
|
1375
|
-
message: applied2 ? command === "acknowledge" ? "Acknowledged." : "Approved. Fload delivers it after a short undo window; the inbox shows where it is." : result
|
|
1430
|
+
message: applied2 ? command === "acknowledge" ? "Acknowledged." : "Approved. Fload delivers it after a short undo window; the inbox shows where it is." : refusedMessage(result),
|
|
1376
1431
|
item: result?.item
|
|
1377
1432
|
},
|
|
1378
1433
|
!applied2
|
|
@@ -1522,22 +1577,22 @@ async function renameCustomPageAction(input, client) {
|
|
|
1522
1577
|
}
|
|
1523
1578
|
|
|
1524
1579
|
// src/tools/aso.ts
|
|
1525
|
-
import { z as
|
|
1526
|
-
var getAsoSummarySchema =
|
|
1527
|
-
assetId:
|
|
1580
|
+
import { z as z9 } from "zod";
|
|
1581
|
+
var getAsoSummarySchema = z9.object({
|
|
1582
|
+
assetId: z9.string().uuid().describe("App UUID to get ASO summary for")
|
|
1528
1583
|
});
|
|
1529
|
-
var getAsoRecommendationsSchema =
|
|
1530
|
-
assetId:
|
|
1584
|
+
var getAsoRecommendationsSchema = z9.object({
|
|
1585
|
+
assetId: z9.string().uuid().describe("App UUID to get ASO recommendations for")
|
|
1531
1586
|
});
|
|
1532
|
-
var getAsoKeywordsSchema =
|
|
1533
|
-
assetId:
|
|
1534
|
-
locale:
|
|
1587
|
+
var getAsoKeywordsSchema = z9.object({
|
|
1588
|
+
assetId: z9.string().uuid().describe("App UUID to get keyword intelligence for"),
|
|
1589
|
+
locale: z9.string().optional().describe(
|
|
1535
1590
|
'Locale code to filter keywords (e.g., "en-US", "de-DE"). Returns all locales if omitted.'
|
|
1536
1591
|
)
|
|
1537
1592
|
});
|
|
1538
|
-
var getAsoExperimentsSchema =
|
|
1539
|
-
assetId:
|
|
1540
|
-
status:
|
|
1593
|
+
var getAsoExperimentsSchema = z9.object({
|
|
1594
|
+
assetId: z9.string().uuid().describe("App UUID to list ASO experiments for"),
|
|
1595
|
+
status: z9.enum([
|
|
1541
1596
|
"proposed",
|
|
1542
1597
|
"approved",
|
|
1543
1598
|
"applied",
|
|
@@ -1545,22 +1600,22 @@ var getAsoExperimentsSchema = z8.object({
|
|
|
1545
1600
|
"completed",
|
|
1546
1601
|
"reverted"
|
|
1547
1602
|
]).optional().describe("Filter experiments by status"),
|
|
1548
|
-
limit:
|
|
1549
|
-
cursor:
|
|
1603
|
+
limit: z9.number().int().min(1).max(100).default(20).describe("Maximum number of experiments to return"),
|
|
1604
|
+
cursor: z9.string().optional().describe("Pagination cursor from a previous response (meta.nextCursor)")
|
|
1550
1605
|
});
|
|
1551
|
-
var getAsoLocaleSnapshotsSchema =
|
|
1552
|
-
assetId:
|
|
1553
|
-
store:
|
|
1554
|
-
locale:
|
|
1606
|
+
var getAsoLocaleSnapshotsSchema = z9.object({
|
|
1607
|
+
assetId: z9.string().uuid().describe("App UUID to get locale snapshots for"),
|
|
1608
|
+
store: z9.enum(["ios", "android"]).default("ios").describe("Which store listing to read"),
|
|
1609
|
+
locale: z9.string().optional().describe(
|
|
1555
1610
|
'Filter to a single locale (e.g. "en-US"). Returns all locales if omitted.'
|
|
1556
1611
|
),
|
|
1557
|
-
view:
|
|
1612
|
+
view: z9.enum(["latest", "history"]).default("latest").describe(
|
|
1558
1613
|
'"latest" (default) = newest snapshot per (locale, type); "history" = raw revisions newest first'
|
|
1559
1614
|
),
|
|
1560
|
-
limit:
|
|
1615
|
+
limit: z9.number().int().min(1).max(500).optional().describe("Maximum snapshot rows to return (newest first)")
|
|
1561
1616
|
});
|
|
1562
|
-
var triggerAsoAnalysisSchema =
|
|
1563
|
-
assetId:
|
|
1617
|
+
var triggerAsoAnalysisSchema = z9.object({
|
|
1618
|
+
assetId: z9.string().uuid().describe("App UUID to trigger ASO analysis for")
|
|
1564
1619
|
});
|
|
1565
1620
|
async function getAsoSummary(input, client) {
|
|
1566
1621
|
try {
|
|
@@ -1728,7 +1783,7 @@ async function triggerAsoAnalysis(input, client) {
|
|
|
1728
1783
|
};
|
|
1729
1784
|
}
|
|
1730
1785
|
}
|
|
1731
|
-
var getAsoEvidenceSchema =
|
|
1786
|
+
var getAsoEvidenceSchema = z9.object({ assetId: z9.string().uuid() });
|
|
1732
1787
|
async function getAsoEvidence(input, client) {
|
|
1733
1788
|
try {
|
|
1734
1789
|
const response = await client.get(
|
|
@@ -1747,19 +1802,19 @@ async function getAsoEvidence(input, client) {
|
|
|
1747
1802
|
|
|
1748
1803
|
// src/tools/chat.ts
|
|
1749
1804
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
1750
|
-
import { z as
|
|
1751
|
-
var listConversationsSchema =
|
|
1752
|
-
limit:
|
|
1805
|
+
import { z as z10 } from "zod";
|
|
1806
|
+
var listConversationsSchema = z10.object({
|
|
1807
|
+
limit: z10.number().int().min(1).max(100).default(20).describe("Maximum number of conversations to return")
|
|
1753
1808
|
});
|
|
1754
|
-
var getConversationMessagesSchema =
|
|
1755
|
-
conversationId:
|
|
1809
|
+
var getConversationMessagesSchema = z10.object({
|
|
1810
|
+
conversationId: z10.string().uuid().describe("The conversation UUID to get messages for")
|
|
1756
1811
|
});
|
|
1757
|
-
var sendChatMessageSchema =
|
|
1758
|
-
message:
|
|
1759
|
-
conversationId:
|
|
1812
|
+
var sendChatMessageSchema = z10.object({
|
|
1813
|
+
message: z10.string().describe("The message to send to the AI chat"),
|
|
1814
|
+
conversationId: z10.string().uuid().optional().describe(
|
|
1760
1815
|
"Existing conversation UUID to continue. Starts a new conversation if omitted."
|
|
1761
1816
|
),
|
|
1762
|
-
agentType:
|
|
1817
|
+
agentType: z10.string().optional().describe(
|
|
1763
1818
|
"Agent type to use for the conversation (e.g., review, monitoring)"
|
|
1764
1819
|
)
|
|
1765
1820
|
});
|
|
@@ -2015,6 +2070,14 @@ function registerTools(server, client, options = {}) {
|
|
|
2015
2070
|
discoverDimensions,
|
|
2016
2071
|
{ readOnlyHint: true, openWorldHint: false }
|
|
2017
2072
|
);
|
|
2073
|
+
tool(
|
|
2074
|
+
"get_download_impact",
|
|
2075
|
+
"Get what Fload changed on downloads",
|
|
2076
|
+
"Did Fload's listing changes move downloads, overall or in one country? For an App Store app: downloads by source a week (organicSearch = App Store search minus Apple Ads, appleAds, browse, appReferrer, webReferrer, other, total) with the same days last year (364 days back) and an index of each year to its own first four weeks; markers for releases, each Fload listing change on the day written and the day live (with the storefronts that read its locales) and the iOS launch week; the 21 days before Fload's first change against the latest 21 days; storefronts by role (changed: a changed localization is its own language; reads_changed: it also reads one, e.g. the US reads es-MX; control: reads nothing changed) with organic downloads a day before and after, this year and last; and each touched keyword's median rank before and after. Listing changes can only move organic App Store search: judge them on organicSearch against last year, never on total, paid or browse. Null means unknown, never 0.",
|
|
2077
|
+
getDownloadImpactSchema,
|
|
2078
|
+
getDownloadImpact,
|
|
2079
|
+
{ readOnlyHint: true, openWorldHint: false }
|
|
2080
|
+
);
|
|
2018
2081
|
tool(
|
|
2019
2082
|
"list_agents",
|
|
2020
2083
|
"List agents",
|
|
@@ -2235,10 +2298,10 @@ async function createMcpServer(_config, client) {
|
|
|
2235
2298
|
import { readFileSync, existsSync } from "fs";
|
|
2236
2299
|
import { homedir } from "os";
|
|
2237
2300
|
import { join } from "path";
|
|
2238
|
-
import { z as
|
|
2239
|
-
var ConfigFileSchema =
|
|
2240
|
-
apiKey:
|
|
2241
|
-
apiUrl:
|
|
2301
|
+
import { z as z11 } from "zod";
|
|
2302
|
+
var ConfigFileSchema = z11.object({
|
|
2303
|
+
apiKey: z11.string().optional().catch(void 0),
|
|
2304
|
+
apiUrl: z11.string().optional().catch(void 0)
|
|
2242
2305
|
});
|
|
2243
2306
|
function loadConfig(env = process.env) {
|
|
2244
2307
|
const apiKey = env.FLOAD_API_KEY;
|