@datadive-tools/mcp 0.14.0 → 0.15.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 +3 -0
- package/dist/index.js +353 -144
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +34 -1
- package/dist/lib.js +358 -145
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -144,7 +144,7 @@ function extractMessage(body) {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
// package.json
|
|
147
|
-
var version = "0.
|
|
147
|
+
var version = "0.15.0";
|
|
148
148
|
|
|
149
149
|
// src/http/client.ts
|
|
150
150
|
var PKG_VERSION = version;
|
|
@@ -408,6 +408,33 @@ var SUPPORTED_MARKETPLACES = [
|
|
|
408
408
|
];
|
|
409
409
|
var RANK_RADAR_STATES = ["ACTIVE", "PAUSED", "ARCHIVED"];
|
|
410
410
|
var RANK_RADAR_STATUSES = [...RANK_RADAR_STATES, "ALL"];
|
|
411
|
+
var PPC_CAMPAIGN_BASE_SORT_BY = [
|
|
412
|
+
"name",
|
|
413
|
+
"state",
|
|
414
|
+
"bidStrategy",
|
|
415
|
+
"budget",
|
|
416
|
+
"impressions",
|
|
417
|
+
"clicks",
|
|
418
|
+
"ctr",
|
|
419
|
+
"cpc",
|
|
420
|
+
"spend",
|
|
421
|
+
"unitsSold",
|
|
422
|
+
"sales",
|
|
423
|
+
"acos",
|
|
424
|
+
"cvr",
|
|
425
|
+
"tosImpressionShare"
|
|
426
|
+
];
|
|
427
|
+
var PPC_CAMPAIGN_PLACEMENT_SORT_BY = [
|
|
428
|
+
...["tos", "ros", "pp", "off"].flatMap(
|
|
429
|
+
(p) => ["Impressions", "Clicks", "Spend", "Sales", "UnitsSold", "Ctr", "Cpc", "Acos"].map(
|
|
430
|
+
(m) => `${p}${m}`
|
|
431
|
+
)
|
|
432
|
+
),
|
|
433
|
+
"tosBidAdjustment",
|
|
434
|
+
"rosBidAdjustment",
|
|
435
|
+
"ppBidAdjustment"
|
|
436
|
+
];
|
|
437
|
+
var PPC_CAMPAIGN_STATES = ["ENABLED", "PAUSED"];
|
|
411
438
|
var ALERT_STATUSES = ["active", "resolved", "all"];
|
|
412
439
|
var BILLABLE_FEATURE_TYPES = [
|
|
413
440
|
"DIVED_ASINS",
|
|
@@ -459,42 +486,92 @@ var listRankRadarsTool = {
|
|
|
459
486
|
}
|
|
460
487
|
};
|
|
461
488
|
|
|
462
|
-
// src/tools/
|
|
489
|
+
// src/tools/rank-radar-keyword-query.ts
|
|
463
490
|
import { z as z7 } from "zod";
|
|
464
491
|
var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
465
492
|
var RANK_RADAR_KEYWORDS_MAX_PAGE_SIZE = 100;
|
|
466
493
|
var RANK_RADAR_MAX_DATE_RANGE_DAYS = 90;
|
|
467
|
-
var
|
|
494
|
+
var rankRadarKeywordQueryInputSchema = {
|
|
468
495
|
rankRadarId: z7.string().uuid().describe("The Rank Radar UUID (from `list_rank_radars`)."),
|
|
469
|
-
startDate: z7.string().regex(ISO_DATE, "startDate must be in yyyy-mm-dd format").describe("Start date
|
|
496
|
+
startDate: z7.string().regex(ISO_DATE, "startDate must be in yyyy-mm-dd format").describe("Start date of the range, yyyy-mm-dd (e.g. 2024-03-26)."),
|
|
470
497
|
endDate: z7.string().regex(ISO_DATE, "endDate must be in yyyy-mm-dd format").describe(
|
|
471
|
-
`End date
|
|
498
|
+
`End date of the range, yyyy-mm-dd (e.g. 2024-04-26). Must be on or after startDate, and at most ${RANK_RADAR_MAX_DATE_RANGE_DAYS} days after it.`
|
|
472
499
|
),
|
|
473
500
|
currentPage: z7.number().int().min(1).optional().describe("Page of keywords, 1-indexed. Defaults to 1."),
|
|
474
501
|
pageSize: z7.number().int().min(1).max(RANK_RADAR_KEYWORDS_MAX_PAGE_SIZE).optional().describe(`Keywords per page (max ${RANK_RADAR_KEYWORDS_MAX_PAGE_SIZE}). Defaults to 20.`)
|
|
475
502
|
};
|
|
503
|
+
var RANK_RADAR_KEYWORD_PAGING_NOTE = `Results are paged by keyword: \`data\` holds one page, and the response carries currentPage, pageSize, total, lastPage, hasNext and hasPrev. \`total\` is the Rank Radar's active keyword count; to read every keyword, call again with \`currentPage\` + 1 while \`hasNext\` is true, using \`pageSize\` ${RANK_RADAR_KEYWORDS_MAX_PAGE_SIZE} for large Rank Radars. Paused keywords are not included.`;
|
|
504
|
+
function rankRadarPath(rankRadarId, suffix = "") {
|
|
505
|
+
return `/v1/niches/rank-radars/${encodeURIComponent(rankRadarId)}${suffix ? `/${suffix}` : ""}`;
|
|
506
|
+
}
|
|
507
|
+
function rankRadarKeywordQuery(args) {
|
|
508
|
+
return {
|
|
509
|
+
startDate: args.startDate,
|
|
510
|
+
endDate: args.endDate,
|
|
511
|
+
currentPage: args.currentPage,
|
|
512
|
+
pageSize: args.pageSize
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// src/tools/get-rank-radar-data.ts
|
|
517
|
+
var inputSchema7 = rankRadarKeywordQueryInputSchema;
|
|
476
518
|
var getRankRadarDataTool = {
|
|
477
519
|
name: "get_rank_radar_data",
|
|
478
520
|
title: "Get Keyword Rankings for a Rank Radar",
|
|
479
|
-
description: `Use this to analyze keyword ranking trends over time. Requires startDate and endDate (yyyy-mm-dd), at most ${RANK_RADAR_MAX_DATE_RANGE_DAYS} days apart. Retrieves historical keyword ranking data for the specified Rank Radar within the date range.
|
|
521
|
+
description: `Use this to analyze keyword ranking trends over time. Requires startDate and endDate (yyyy-mm-dd), at most ${RANK_RADAR_MAX_DATE_RANGE_DAYS} days apart. Retrieves historical keyword ranking data for the specified Rank Radar within the date range. ${RANK_RADAR_KEYWORD_PAGING_NOTE} Each keyword has id, keyword, searchVolume, relevancy, ranks (per-day { date, organicRank, sponsoredRank, impressionRank }), and any highlight annotations. A rank of 101 means the product was not in the top 100 results that day. For PPC metrics use \`get_rank_radar_ppc_data\`; for Search Query Performance use \`get_rank_radar_sqp_data\`. Use after \`list_rank_radars\` to discover a \`rankRadarId\`.`,
|
|
480
522
|
inputSchema: inputSchema7,
|
|
481
523
|
annotations: { readOnlyHint: true },
|
|
482
524
|
handler: async (args, ctx) => {
|
|
483
525
|
return await httpGet(
|
|
484
526
|
{ config: ctx.config, toolName: "get_rank_radar_data" },
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
startDate: args.startDate,
|
|
488
|
-
endDate: args.endDate,
|
|
489
|
-
currentPage: args.currentPage,
|
|
490
|
-
pageSize: args.pageSize
|
|
491
|
-
}
|
|
527
|
+
rankRadarPath(args.rankRadarId),
|
|
528
|
+
rankRadarKeywordQuery(args)
|
|
492
529
|
);
|
|
493
530
|
}
|
|
494
531
|
};
|
|
495
532
|
|
|
496
|
-
// src/tools/
|
|
533
|
+
// src/tools/get-rank-radar-sqp-data.ts
|
|
534
|
+
var inputSchema8 = rankRadarKeywordQueryInputSchema;
|
|
535
|
+
var getRankRadarSqpDataTool = {
|
|
536
|
+
name: "get_rank_radar_sqp_data",
|
|
537
|
+
title: "Get Search Query Performance for a Rank Radar",
|
|
538
|
+
description: `Use this when the user asks how shoppers search, click, add to cart and buy for the keywords of a Rank Radar \u2014 Amazon's Search Query Performance (SQP) data, from Brand Analytics. Requires startDate and endDate (yyyy-mm-dd), at most ${RANK_RADAR_MAX_DATE_RANGE_DAYS} days apart; 30 days or less keeps it fast. Each keyword's metrics are aggregated over the range: searchQueryVolume and searchQueryScore; impressions, clicks, cart adds and purchases, each as the total across all sellers (\`*TotalCount\`), this ASIN family's count (\`*AsinCount\`) and its share (\`*AsinShare\`); click, cart-add and purchase rates; and ctr/cvr for the market (\`*Total\`) and for this ASIN family (\`*Asin\`). \`numberOfDaysWithData\` says how many days of the range had SQP data; metrics are null when there is none, which is normal for low-volume keywords, recent dates (Amazon publishes SQP with a delay) and sellers without Brand Analytics. ${RANK_RADAR_KEYWORD_PAGING_NOTE} Each call counts toward API usage and is rate limited (about 60 requests/minute). Use after \`list_rank_radars\` to discover a \`rankRadarId\`.`,
|
|
539
|
+
inputSchema: inputSchema8,
|
|
540
|
+
annotations: { readOnlyHint: true },
|
|
541
|
+
handler: async (args, ctx) => {
|
|
542
|
+
return await httpGet(
|
|
543
|
+
{ config: ctx.config, toolName: "get_rank_radar_sqp_data" },
|
|
544
|
+
rankRadarPath(args.rankRadarId, "sqp"),
|
|
545
|
+
rankRadarKeywordQuery(args)
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
// src/tools/get-rank-radar-ppc-data.ts
|
|
497
551
|
import { z as z8 } from "zod";
|
|
552
|
+
var inputSchema9 = {
|
|
553
|
+
...rankRadarKeywordQueryInputSchema,
|
|
554
|
+
includeCampaigns: z8.boolean().optional().describe(
|
|
555
|
+
"When true, each keyword also carries `campaigns`: the per-campaign/ad-group breakdown (campaign and ad group name, match type, targeting, spend, sales, clicks, impressions, orders, CPC, CTR, CVR, ACOS). Defaults to false; leave it off unless the user asks which campaigns drive a keyword."
|
|
556
|
+
)
|
|
557
|
+
};
|
|
558
|
+
var getRankRadarPpcDataTool = {
|
|
559
|
+
name: "get_rank_radar_ppc_data",
|
|
560
|
+
title: "Get PPC Data for a Rank Radar",
|
|
561
|
+
description: `Use this when the user asks about advertising (Sponsored Products) performance for the keywords of a Rank Radar. Requires startDate and endDate (yyyy-mm-dd), at most ${RANK_RADAR_MAX_DATE_RANGE_DAYS} days apart; 30 days or less keeps it fast. Each keyword's metrics are aggregated over the range: sponsoredRank (median; 101 means not in the top 100 sponsored results), impressionRank and impressionRankShare; how many exact, phrase, broad and auto campaigns target it; organicSales, ppcSales, ppcSpend, costPerClicks, clickThroughRate, conversionRate, totalClicks, totalImpressions, totalOrders and acos. Metrics are null or 0 when the seller runs no ads on a keyword. Set \`includeCampaigns\` for the per-campaign breakdown. ${RANK_RADAR_KEYWORD_PAGING_NOTE} Each call counts toward API usage and is rate limited (about 60 requests/minute). For the seller's campaigns as a whole, use \`list_ppc_campaigns\`. Use after \`list_rank_radars\` to discover a \`rankRadarId\`.`,
|
|
562
|
+
inputSchema: inputSchema9,
|
|
563
|
+
annotations: { readOnlyHint: true },
|
|
564
|
+
handler: async (args, ctx) => {
|
|
565
|
+
return await httpGet(
|
|
566
|
+
{ config: ctx.config, toolName: "get_rank_radar_ppc_data" },
|
|
567
|
+
rankRadarPath(args.rankRadarId, "ppc"),
|
|
568
|
+
{ ...rankRadarKeywordQuery(args), includeCampaigns: args.includeCampaigns }
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
// src/tools/create-rank-radar.ts
|
|
574
|
+
import { z as z9 } from "zod";
|
|
498
575
|
|
|
499
576
|
// src/tools/confirm.ts
|
|
500
577
|
function needsConfirmation(confirm, ctx) {
|
|
@@ -515,11 +592,11 @@ function requireConfirmation(confirm, ctx, costNote) {
|
|
|
515
592
|
|
|
516
593
|
// src/tools/create-rank-radar.ts
|
|
517
594
|
var PATH = "/v1/niches/rank-radars";
|
|
518
|
-
var
|
|
519
|
-
asin:
|
|
520
|
-
numberOfKeywords:
|
|
521
|
-
nicheId:
|
|
522
|
-
confirm:
|
|
595
|
+
var inputSchema10 = {
|
|
596
|
+
asin: z9.string().min(1).describe("The ASIN to track keyword rankings for."),
|
|
597
|
+
numberOfKeywords: z9.number().int().min(1).describe("How many keywords to track (minimum 1). More keywords = broader tracking but more Search Term tokens."),
|
|
598
|
+
nicheId: z9.string().min(1).describe("The niche this Rank Radar belongs to. Get one from `list_niches`."),
|
|
599
|
+
confirm: z9.boolean().optional().describe(
|
|
523
600
|
"Must be true to proceed \u2014 creating a Rank Radar spends Search Term tokens. Confirm the cost with the user first."
|
|
524
601
|
)
|
|
525
602
|
};
|
|
@@ -527,7 +604,7 @@ var createRankRadarTool = {
|
|
|
527
604
|
name: "create_rank_radar",
|
|
528
605
|
title: "Create a Rank Radar",
|
|
529
606
|
description: "Use this to start tracking organic and sponsored keyword rankings for an ASIN within a niche. \u26A0\uFE0F Spends Search Term tokens (cost scales with `numberOfKeywords`) and cannot be undone \u2014 set `confirm: true` only after the user approves the cost. Not safe to retry: each call spends tokens again and creates a separate Rank Radar \u2014 if a call errors or times out, check `list_rank_radars` instead of re-calling. The first call previews the creation and may return `warnings` alongside the cost note \u2014 for example that this product family is already tracked by another Rank Radar. Show every warning `message` to the user verbatim, before asking them to confirm; do not summarise it or decide on their behalf. A warning never blocks creation. Returns the new `rankRadarId`; read its data later with `get_rank_radar_data`. Requires `asin`, `numberOfKeywords` (min 1), and a `nicheId` from `list_niches`.",
|
|
530
|
-
inputSchema:
|
|
607
|
+
inputSchema: inputSchema10,
|
|
531
608
|
// destructiveHint is technically "additive" here (this creates a new Rank Radar, it
|
|
532
609
|
// doesn't destroy data), but we flag it destructive so clients prompt before the
|
|
533
610
|
// irreversible token spend. The confirm gate enforces this server-side regardless.
|
|
@@ -552,20 +629,20 @@ var createRankRadarTool = {
|
|
|
552
629
|
};
|
|
553
630
|
|
|
554
631
|
// src/tools/create-niche-dive.ts
|
|
555
|
-
import { z as
|
|
556
|
-
var
|
|
557
|
-
marketplace:
|
|
632
|
+
import { z as z10 } from "zod";
|
|
633
|
+
var inputSchema11 = {
|
|
634
|
+
marketplace: z10.enum(SUPPORTED_MARKETPLACES).describe(
|
|
558
635
|
"Amazon marketplace of the seed ASIN. Note these are full domain suffixes: com, ca, co.uk, com.mx, in, fr, de, es, it, co.jp (e.g. UK is `co.uk`, not `uk`)."
|
|
559
636
|
),
|
|
560
|
-
asin:
|
|
561
|
-
numberOfCompetitors:
|
|
562
|
-
confirm:
|
|
637
|
+
asin: z10.string().min(1).describe("The seed ASIN to start the dive from (e.g. B08N5WRWNW). Competitors are built around it."),
|
|
638
|
+
numberOfCompetitors: z10.number().int().min(2).describe("How many competitors to analyze (minimum 2). More competitors = deeper niche but more dive tokens."),
|
|
639
|
+
confirm: z10.boolean().optional().describe("Must be true to proceed \u2014 creating a dive spends dive tokens. Confirm the cost with the user first.")
|
|
563
640
|
};
|
|
564
641
|
var createNicheDiveTool = {
|
|
565
642
|
name: "create_niche_dive",
|
|
566
643
|
title: "Create a Niche Dive",
|
|
567
644
|
description: "Use this to start new niche research from a seed ASIN. \u26A0\uFE0F Spends dive tokens (cost scales with `numberOfCompetitors`) and cannot be undone \u2014 set `confirm: true` only after the user approves the cost. Not safe to retry: each call spends tokens again and starts a separate dive \u2014 if a call errors or times out, poll `get_dive_status` (or check `list_niches`) instead of re-calling. The dive runs asynchronously: this returns immediately with a `diveId` and an `estimatedCompletionDate`. Poll `get_dive_status` with that `diveId` until it reports `success` (which carries the new `nicheId` for use with `list_niches`, `get_niche_keywords`, etc.). Requires `marketplace`, `asin`, and `numberOfCompetitors` (min 2).",
|
|
568
|
-
inputSchema:
|
|
645
|
+
inputSchema: inputSchema11,
|
|
569
646
|
// destructiveHint is technically "additive" here (a dive creates a new niche, it
|
|
570
647
|
// doesn't destroy data), but we flag it destructive so clients prompt before the
|
|
571
648
|
// irreversible token spend. The confirm gate enforces this server-side regardless.
|
|
@@ -590,23 +667,23 @@ var createNicheDiveTool = {
|
|
|
590
667
|
};
|
|
591
668
|
|
|
592
669
|
// src/tools/redive-niche.ts
|
|
593
|
-
import { z as
|
|
594
|
-
var
|
|
595
|
-
nicheId:
|
|
596
|
-
mode:
|
|
670
|
+
import { z as z11 } from "zod";
|
|
671
|
+
var inputSchema12 = {
|
|
672
|
+
nicheId: z11.string().min(1).describe("The niche to re-dive. Get one from `list_niches`."),
|
|
673
|
+
mode: z11.enum(["same_competitors", "discover"]).describe(
|
|
597
674
|
"How to pick the competitors for the refreshed dive. `same_competitors` re-runs the niche's current competitor set and takes no other argument \u2014 use it to refresh stale data. `discover` searches for a fresh competitor set, which is what you want when the niche has changed."
|
|
598
675
|
),
|
|
599
|
-
numberOfCompetitors:
|
|
676
|
+
numberOfCompetitors: z11.number().int().min(2).optional().describe(
|
|
600
677
|
"Total ASINs the refreshed dive should contain, including `lockedAsins`. Required in `discover` mode and rejected in `same_competitors` mode. Dive tokens are spent per ASIN."
|
|
601
678
|
),
|
|
602
|
-
heroAsin:
|
|
679
|
+
heroAsin: z11.string().min(1).optional().describe(
|
|
603
680
|
"`discover` mode only. Seed product the competitor discovery starts from. Defaults to the niche's highest-selling competitor, preferring one the user's own connected seller account owns."
|
|
604
681
|
),
|
|
605
|
-
lockedAsins:
|
|
682
|
+
lockedAsins: z11.array(z11.string().min(1)).optional().describe(
|
|
606
683
|
"`discover` mode only. ASINs that must stay in the competitor set regardless of what discovery finds. Cannot exceed `numberOfCompetitors`, and cannot overlap `excludedAsins`."
|
|
607
684
|
),
|
|
608
|
-
excludedAsins:
|
|
609
|
-
confirm:
|
|
685
|
+
excludedAsins: z11.array(z11.string().min(1)).optional().describe("`discover` mode only. ASINs discovery must never select."),
|
|
686
|
+
confirm: z11.boolean().optional().describe(
|
|
610
687
|
"Must be true to proceed \u2014 a re-dive spends dive tokens. Confirm the cost with the user first."
|
|
611
688
|
)
|
|
612
689
|
};
|
|
@@ -614,7 +691,7 @@ var rediveNicheTool = {
|
|
|
614
691
|
name: "redive_niche",
|
|
615
692
|
title: "Re-dive an Existing Niche",
|
|
616
693
|
description: "Use this to refresh an existing niche's research with current Amazon data, instead of creating a new niche with `create_niche_dive`. \u26A0\uFE0F Spends dive tokens (one batch per ASIN dived) and cannot be undone \u2014 set `confirm: true` only after the user approves the cost. Not safe to retry: each call spends tokens again and starts a separate re-dive \u2014 if a call errors or times out, poll `get_dive_status` instead of re-calling. Two modes: `same_competitors` re-dives the niche's current competitor set (no other argument needed) and `discover` finds a fresh set, sized by `numberOfCompetitors` and steerable with `heroAsin` / `lockedAsins` / `excludedAsins`. Runs asynchronously: returns a `diveId` and an `estimatedCompletionDate` \u2014 poll `get_dive_status` with that `diveId` until it reports `success`. The niche keeps its `nicheId`, so existing rank radars and reports follow the refreshed data.",
|
|
617
|
-
inputSchema:
|
|
694
|
+
inputSchema: inputSchema12,
|
|
618
695
|
// Same reasoning as create_niche_dive: a re-dive is additive rather than destructive, but the
|
|
619
696
|
// irreversible token spend is what clients need to prompt on. The confirm gate enforces it regardless.
|
|
620
697
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
@@ -647,15 +724,15 @@ var rediveNicheTool = {
|
|
|
647
724
|
};
|
|
648
725
|
|
|
649
726
|
// src/tools/get-dive-status.ts
|
|
650
|
-
import { z as
|
|
651
|
-
var
|
|
652
|
-
diveId:
|
|
727
|
+
import { z as z12 } from "zod";
|
|
728
|
+
var inputSchema13 = {
|
|
729
|
+
diveId: z12.string().min(1).describe("The dive identifier returned by `create_niche_dive` or `redive_niche`.")
|
|
653
730
|
};
|
|
654
731
|
var getDiveStatusTool = {
|
|
655
732
|
name: "get_dive_status",
|
|
656
733
|
title: "Get Niche Dive Status",
|
|
657
734
|
description: "Use this to poll a niche dive started with `create_niche_dive` or `redive_niche` until it finishes. Returns one of three shapes keyed by `status`: `in_progress` (with `estimatedCompletionDate`), `success` (with the `nicheId` plus `tokensUsed`/`tokensLeft`), or `error` (with an `error` message). On `success`, use the `nicheId` with `list_niches`, `get_niche_keywords`, `get_niche_competitors`, etc. (for a re-dive it is the same niche you passed in, now carrying refreshed data). Re-poll periodically \u2014 dives can take minutes; the `estimatedCompletionDate` hints at when to check.",
|
|
658
|
-
inputSchema:
|
|
735
|
+
inputSchema: inputSchema13,
|
|
659
736
|
annotations: { readOnlyHint: true },
|
|
660
737
|
handler: async (args, ctx) => {
|
|
661
738
|
return await httpGet(
|
|
@@ -666,10 +743,10 @@ var getDiveStatusTool = {
|
|
|
666
743
|
};
|
|
667
744
|
|
|
668
745
|
// src/tools/delete-niche.ts
|
|
669
|
-
import { z as
|
|
670
|
-
var
|
|
671
|
-
nicheId:
|
|
672
|
-
confirm:
|
|
746
|
+
import { z as z13 } from "zod";
|
|
747
|
+
var inputSchema14 = {
|
|
748
|
+
nicheId: z13.string().min(1).describe("The niche to delete. Get one from `list_niches`."),
|
|
749
|
+
confirm: z13.boolean().optional().describe(
|
|
673
750
|
"Must be true to proceed \u2014 deleting a niche destroys its keywords, competitors and dive history permanently. Confirm with the user first."
|
|
674
751
|
)
|
|
675
752
|
};
|
|
@@ -677,7 +754,7 @@ var deleteNicheTool = {
|
|
|
677
754
|
name: "delete_niche",
|
|
678
755
|
title: "Delete a Niche",
|
|
679
756
|
description: "Use this to permanently remove a niche the user no longer needs. \u26A0\uFE0F Deletes the niche and everything attached to it \u2014 keywords, competitors, all dives and diveboxes \u2014 and cannot be undone; the dive tokens already spent on it are NOT refunded. Set `confirm: true` only after the user approves. A niche used by any Rank Radar cannot be deleted: the call fails with a conflict, so delete or archive those rank radars first (`list_rank_radars` with the `nicheId` filter shows them).",
|
|
680
|
-
inputSchema:
|
|
757
|
+
inputSchema: inputSchema14,
|
|
681
758
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
682
759
|
handler: async (args, ctx) => {
|
|
683
760
|
const pending = requireConfirmation(
|
|
@@ -695,15 +772,15 @@ var deleteNicheTool = {
|
|
|
695
772
|
};
|
|
696
773
|
|
|
697
774
|
// src/tools/pause-rank-radar.ts
|
|
698
|
-
import { z as
|
|
699
|
-
var
|
|
700
|
-
rankRadarId:
|
|
775
|
+
import { z as z14 } from "zod";
|
|
776
|
+
var inputSchema15 = {
|
|
777
|
+
rankRadarId: z14.string().uuid().describe("The Rank Radar UUID to pause (from `list_rank_radars`).")
|
|
701
778
|
};
|
|
702
779
|
var pauseRankRadarTool = {
|
|
703
780
|
name: "pause_rank_radar",
|
|
704
781
|
title: "Pause a Rank Radar",
|
|
705
782
|
description: "Use this to pause tracking on a Rank Radar without losing anything \u2014 the action the DataDive API calls 'archiving', so when a user asks to archive a Rank Radar, this is the tool they mean. Tracking stops for all of its keywords and the Daily Tracked Keywords quota they held is freed for other Rank Radars, while the Rank Radar and its ranking history are kept. Fully reversible with `resume_rank_radar`, so it needs no `confirm` \u2014 prefer it over `delete_rank_radar` whenever the user may want the data back. Paused Rank Radars show up in `list_rank_radars` under `status: PAUSED` \u2014 not `ARCHIVED`, which covers Rank Radars removed with `delete_rank_radar`. Safe to repeat: pausing an already paused Rank Radar succeeds and changes nothing.",
|
|
706
|
-
inputSchema:
|
|
783
|
+
inputSchema: inputSchema15,
|
|
707
784
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
708
785
|
handler: async (args, ctx) => {
|
|
709
786
|
await httpPost(
|
|
@@ -716,15 +793,15 @@ var pauseRankRadarTool = {
|
|
|
716
793
|
};
|
|
717
794
|
|
|
718
795
|
// src/tools/resume-rank-radar.ts
|
|
719
|
-
import { z as
|
|
720
|
-
var
|
|
721
|
-
rankRadarId:
|
|
796
|
+
import { z as z15 } from "zod";
|
|
797
|
+
var inputSchema16 = {
|
|
798
|
+
rankRadarId: z15.string().uuid().describe("The Rank Radar UUID to resume (from `list_rank_radars`).")
|
|
722
799
|
};
|
|
723
800
|
var resumeRankRadarTool = {
|
|
724
801
|
name: "resume_rank_radar",
|
|
725
802
|
title: "Resume a Paused Rank Radar",
|
|
726
803
|
description: "Use this to restart tracking on a Rank Radar that was paused with `pause_rank_radar` (shown by `list_rank_radars` under `status: PAUSED`; a deleted, `ARCHIVED` one cannot be resumed). Keywords are resumed as far as the available Daily Tracked Keywords quota allows, most relevant first \u2014 so with a tight quota only part of the original keyword set comes back; check `get_quota` first if that matters. Reversible with `pause_rank_radar`, so it needs no `confirm`. Fails with a bad-request error when there is no quota left at all. Safe to repeat: resuming an already active Rank Radar changes nothing.",
|
|
727
|
-
inputSchema:
|
|
804
|
+
inputSchema: inputSchema16,
|
|
728
805
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
729
806
|
handler: async (args, ctx) => {
|
|
730
807
|
await httpPost(
|
|
@@ -737,10 +814,10 @@ var resumeRankRadarTool = {
|
|
|
737
814
|
};
|
|
738
815
|
|
|
739
816
|
// src/tools/delete-rank-radar.ts
|
|
740
|
-
import { z as
|
|
741
|
-
var
|
|
742
|
-
rankRadarId:
|
|
743
|
-
confirm:
|
|
817
|
+
import { z as z16 } from "zod";
|
|
818
|
+
var inputSchema17 = {
|
|
819
|
+
rankRadarId: z16.string().uuid().describe("The Rank Radar UUID to delete (from `list_rank_radars`)."),
|
|
820
|
+
confirm: z16.boolean().optional().describe(
|
|
744
821
|
"Must be true to proceed \u2014 deleting a Rank Radar destroys its ranking history permanently. Confirm with the user first."
|
|
745
822
|
)
|
|
746
823
|
};
|
|
@@ -748,7 +825,7 @@ var deleteRankRadarTool = {
|
|
|
748
825
|
name: "delete_rank_radar",
|
|
749
826
|
title: "Delete a Rank Radar",
|
|
750
827
|
description: "Use this to permanently remove a Rank Radar and all of its keyword ranking history. \u26A0\uFE0F Cannot be undone \u2014 there is no restore endpoint; set `confirm: true` only after the user approves. It does free the Daily Tracked Keywords quota those keywords held. Deleted Rank Radars are what `list_rank_radars` returns for `status: ARCHIVED`. If the user only wants to stop tracking for a while and keep the history \u2014 or asks to 'archive' the Rank Radar, which is what the DataDive API calls pausing \u2014 use `pause_rank_radar` instead: it frees the same quota and is reversible with `resume_rank_radar`.",
|
|
751
|
-
inputSchema:
|
|
828
|
+
inputSchema: inputSchema17,
|
|
752
829
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
753
830
|
handler: async (args, ctx) => {
|
|
754
831
|
const pending = requireConfirmation(
|
|
@@ -766,10 +843,10 @@ var deleteRankRadarTool = {
|
|
|
766
843
|
};
|
|
767
844
|
|
|
768
845
|
// src/tools/add-rank-radar-search-terms.ts
|
|
769
|
-
import { z as
|
|
770
|
-
var
|
|
771
|
-
rankRadarId:
|
|
772
|
-
searchTerms:
|
|
846
|
+
import { z as z17 } from "zod";
|
|
847
|
+
var inputSchema18 = {
|
|
848
|
+
rankRadarId: z17.string().uuid().describe("The Rank Radar UUID to add the search terms to (from `list_rank_radars`)."),
|
|
849
|
+
searchTerms: z17.array(z17.string().min(1)).min(1).max(ADD_SEARCH_TERMS_MAX).describe(
|
|
773
850
|
`The keywords to start tracking, 1\u2013${ADD_SEARCH_TERMS_MAX} per call. Must be unique. Amazon-ignored special characters (@, #, _, parentheses, \u2026) are rejected.`
|
|
774
851
|
)
|
|
775
852
|
};
|
|
@@ -777,7 +854,7 @@ var addRankRadarSearchTermsTool = {
|
|
|
777
854
|
name: "add_rank_radar_search_terms",
|
|
778
855
|
title: "Add Search Terms to a Rank Radar",
|
|
779
856
|
description: "Use this to start tracking extra keywords on an existing Rank Radar, instead of creating a new one with `create_rank_radar`. New keywords are added to the niche and tracked from now on; any matching keyword that was previously paused is resumed. Each newly tracked keyword takes one Daily Tracked Keywords slot, and the call fails if the quota is exhausted \u2014 check `get_quota` first. Reversible with `pause_rank_radar_search_terms`, which frees the slots again, so it needs no `confirm`. Returns `originBreakdown` (where each submitted term ended up) and `keywordToRankRadarKeywordIdMap`, whose ids are what the pause/resume search-term tools take.",
|
|
780
|
-
inputSchema:
|
|
857
|
+
inputSchema: inputSchema18,
|
|
781
858
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
782
859
|
handler: async (args, ctx) => {
|
|
783
860
|
return await httpPost(
|
|
@@ -789,10 +866,10 @@ var addRankRadarSearchTermsTool = {
|
|
|
789
866
|
};
|
|
790
867
|
|
|
791
868
|
// src/tools/pause-rank-radar-search-terms.ts
|
|
792
|
-
import { z as
|
|
793
|
-
var
|
|
794
|
-
rankRadarId:
|
|
795
|
-
rankRadarKeywordIds:
|
|
869
|
+
import { z as z18 } from "zod";
|
|
870
|
+
var inputSchema19 = {
|
|
871
|
+
rankRadarId: z18.string().uuid().describe("The Rank Radar UUID the search terms belong to."),
|
|
872
|
+
rankRadarKeywordIds: z18.array(z18.string().uuid()).min(1).describe(
|
|
796
873
|
"The Rank Radar keyword ids to pause. These are the `id` values from `get_rank_radar_data`, or the values of `keywordToRankRadarKeywordIdMap` returned by `add_rank_radar_search_terms` \u2014 not the keyword text."
|
|
797
874
|
)
|
|
798
875
|
};
|
|
@@ -800,7 +877,7 @@ var pauseRankRadarSearchTermsTool = {
|
|
|
800
877
|
name: "pause_rank_radar_search_terms",
|
|
801
878
|
title: "Pause Search Terms of a Rank Radar",
|
|
802
879
|
description: "Use this to stop tracking individual keywords on a Rank Radar while keeping the Rank Radar itself active \u2014 the way to trim a keyword set the user finds too broad. The DataDive API calls this 'archiving' the search terms; nothing is lost. The paused keywords keep their history and their Daily Tracked Keywords slots are freed for other keywords. Reversible with `resume_rank_radar_search_terms`, so it needs no `confirm`. Takes keyword ids, not keyword text: get them from `get_rank_radar_data`. Safe to repeat: already-paused terms are left unchanged.",
|
|
803
|
-
inputSchema:
|
|
880
|
+
inputSchema: inputSchema19,
|
|
804
881
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
805
882
|
handler: async (args, ctx) => {
|
|
806
883
|
await httpPost(
|
|
@@ -817,10 +894,10 @@ var pauseRankRadarSearchTermsTool = {
|
|
|
817
894
|
};
|
|
818
895
|
|
|
819
896
|
// src/tools/resume-rank-radar-search-terms.ts
|
|
820
|
-
import { z as
|
|
821
|
-
var
|
|
822
|
-
rankRadarId:
|
|
823
|
-
rankRadarKeywordIds:
|
|
897
|
+
import { z as z19 } from "zod";
|
|
898
|
+
var inputSchema20 = {
|
|
899
|
+
rankRadarId: z19.string().uuid().describe("The Rank Radar UUID the search terms belong to."),
|
|
900
|
+
rankRadarKeywordIds: z19.array(z19.string().uuid()).min(1).describe(
|
|
824
901
|
"The Rank Radar keyword ids to resume. These are the `id` values from `get_rank_radar_data`, or the values of `keywordToRankRadarKeywordIdMap` returned by `add_rank_radar_search_terms` \u2014 not the keyword text."
|
|
825
902
|
)
|
|
826
903
|
};
|
|
@@ -828,7 +905,7 @@ var resumeRankRadarSearchTermsTool = {
|
|
|
828
905
|
name: "resume_rank_radar_search_terms",
|
|
829
906
|
title: "Resume Paused Search Terms of a Rank Radar",
|
|
830
907
|
description: "Use this to start tracking keywords again that were paused with `pause_rank_radar_search_terms`. Each resumed keyword takes back one Daily Tracked Keywords slot, and the call fails if the quota is exhausted \u2014 check `get_quota` first. Reversible with `pause_rank_radar_search_terms`, so it needs no `confirm`. Takes keyword ids, not keyword text: get them from `get_rank_radar_data`. Safe to repeat: already-active terms are left unchanged.",
|
|
831
|
-
inputSchema:
|
|
908
|
+
inputSchema: inputSchema20,
|
|
832
909
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
833
910
|
handler: async (args, ctx) => {
|
|
834
911
|
await httpPost(
|
|
@@ -845,16 +922,16 @@ var resumeRankRadarSearchTermsTool = {
|
|
|
845
922
|
};
|
|
846
923
|
|
|
847
924
|
// src/tools/generate-listing-copy.ts
|
|
848
|
-
import { z as
|
|
849
|
-
var
|
|
850
|
-
nicheId:
|
|
851
|
-
strategy:
|
|
925
|
+
import { z as z20 } from "zod";
|
|
926
|
+
var inputSchema21 = {
|
|
927
|
+
nicheId: z20.string().min(1).describe("The niche whose keyword data the copy is written from. Get one from `list_niches`."),
|
|
928
|
+
strategy: z20.enum(LISTING_COPY_STRATEGIES).describe(
|
|
852
929
|
"Which generation strategy to use. `cosmo` targets Amazon's COSMO relevance model, `ranking-juice` optimises for DataDive's ranking-juice score, `nlp` writes for keyword coverage, and `cosmo-rufus` targets COSMO plus the Rufus shopping assistant. Ask the user if they have no preference."
|
|
853
930
|
),
|
|
854
|
-
currentListing:
|
|
931
|
+
currentListing: z20.record(z20.union([z20.string(), z20.array(z20.string())])).describe(
|
|
855
932
|
'The seller\'s existing listing to rewrite, as an object \u2014 e.g. `{ "title": "...", "description": "...", "bullets": ["...", "..."] }`. Pass what the user has; it is the starting point the generated copy builds on.'
|
|
856
933
|
),
|
|
857
|
-
confirm:
|
|
934
|
+
confirm: z20.boolean().optional().describe(
|
|
858
935
|
"Must be true to proceed \u2014 each generation spends one AI Copywriter prompt from the quota. Confirm the cost with the user first."
|
|
859
936
|
)
|
|
860
937
|
};
|
|
@@ -862,7 +939,7 @@ var generateListingCopyTool = {
|
|
|
862
939
|
name: "generate_listing_copy",
|
|
863
940
|
title: "Generate Listing Copy for a Niche",
|
|
864
941
|
description: "Use this to draft an optimised Amazon listing \u2014 title, bullets and description \u2014 from a niche's keyword research and the seller's current listing. It writes text only: nothing is published to Amazon, and the user still has to paste the result into Seller Central. \u26A0\uFE0F Spends one AI Copywriter prompt from the quota per call and cannot be undone \u2014 set `confirm: true` only after the user approves. Not safe to retry: each call spends another prompt, so if a call errors or times out, poll `get_listing_copy_generation_status` instead of re-calling. Runs asynchronously: returns a `generationId` \u2014 poll `get_listing_copy_generation_status` with it until the status is `complete`.",
|
|
865
|
-
inputSchema:
|
|
942
|
+
inputSchema: inputSchema21,
|
|
866
943
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
867
944
|
handler: async (args, ctx) => {
|
|
868
945
|
const pending = requireConfirmation(
|
|
@@ -880,16 +957,16 @@ var generateListingCopyTool = {
|
|
|
880
957
|
};
|
|
881
958
|
|
|
882
959
|
// src/tools/get-listing-copy-generation-status.ts
|
|
883
|
-
import { z as
|
|
884
|
-
var
|
|
885
|
-
nicheId:
|
|
886
|
-
generationId:
|
|
960
|
+
import { z as z21 } from "zod";
|
|
961
|
+
var inputSchema22 = {
|
|
962
|
+
nicheId: z21.string().min(1).describe("The niche the generation was started for."),
|
|
963
|
+
generationId: z21.string().min(1).describe("The `generationId` returned by `generate_listing_copy`.")
|
|
887
964
|
};
|
|
888
965
|
var getListingCopyGenerationStatusTool = {
|
|
889
966
|
name: "get_listing_copy_generation_status",
|
|
890
967
|
title: "Get Listing Copy Generation Status",
|
|
891
968
|
description: "Use this to poll a listing-copy draft started with `generate_listing_copy` until it finishes. Returns one of three shapes keyed by `status`: `generating` (still running \u2014 poll again in a few seconds), `complete` (with `result`, carrying the generated `title`, `bullets`, `description`, `itemHighlights` and its `rankingJuice` score), or `failed` (with an `error` message). Polling is free \u2014 it does not spend another AI Copywriter prompt, so always poll rather than re-calling `generate_listing_copy`.",
|
|
892
|
-
inputSchema:
|
|
969
|
+
inputSchema: inputSchema22,
|
|
893
970
|
annotations: { readOnlyHint: true },
|
|
894
971
|
handler: async (args, ctx) => {
|
|
895
972
|
return await httpGet(
|
|
@@ -900,16 +977,16 @@ var getListingCopyGenerationStatusTool = {
|
|
|
900
977
|
};
|
|
901
978
|
|
|
902
979
|
// src/tools/list-seller-profiles.ts
|
|
903
|
-
import { z as
|
|
904
|
-
var
|
|
905
|
-
currentPage:
|
|
906
|
-
pageSize:
|
|
980
|
+
import { z as z22 } from "zod";
|
|
981
|
+
var inputSchema23 = {
|
|
982
|
+
currentPage: z22.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
983
|
+
pageSize: z22.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
907
984
|
};
|
|
908
985
|
var listSellerProfilesTool = {
|
|
909
986
|
name: "list_seller_profiles",
|
|
910
987
|
title: "List Connected Amazon Seller Profiles",
|
|
911
988
|
description: 'Use this when the user asks which Amazon seller accounts are connected, or as the discovery step to find the `sellerId` and `marketplace` required by `get_asin_inventory_distribution`, `get_seller_catalog`, `get_seller_listing_changes`, and the alert tools. Returns a paginated list of the organization\'s connected seller profiles \u2014 each item has sellerId, sellerName, marketplace (e.g. "com", "co.uk"), hasAdApi (whether Advertising API credentials are connected), and createdAt \u2014 plus pagination metadata (currentPage, pageSize, total, lastPage, hasNext, hasPrev).',
|
|
912
|
-
inputSchema:
|
|
989
|
+
inputSchema: inputSchema23,
|
|
913
990
|
annotations: { readOnlyHint: true },
|
|
914
991
|
handler: async (args, ctx) => {
|
|
915
992
|
return await httpGet(
|
|
@@ -924,15 +1001,15 @@ var listSellerProfilesTool = {
|
|
|
924
1001
|
};
|
|
925
1002
|
|
|
926
1003
|
// src/tools/get-seller-catalog.ts
|
|
927
|
-
import { z as
|
|
1004
|
+
import { z as z24 } from "zod";
|
|
928
1005
|
|
|
929
1006
|
// src/tools/seller-scoped.ts
|
|
930
|
-
import { z as
|
|
1007
|
+
import { z as z23 } from "zod";
|
|
931
1008
|
var sellerScopedInputSchema = {
|
|
932
|
-
sellerId:
|
|
1009
|
+
sellerId: z23.string().min(1).describe(
|
|
933
1010
|
"Amazon seller account ID. Get it from `list_seller_profiles`, or find it on the Connections page at https://2.datadive.tools."
|
|
934
1011
|
),
|
|
935
|
-
marketplace:
|
|
1012
|
+
marketplace: z23.enum(SUPPORTED_MARKETPLACES).describe('Amazon marketplace code, e.g. "com" for amazon.com or "co.uk" for amazon.co.uk.')
|
|
936
1013
|
};
|
|
937
1014
|
function sellerMarketplacePath(sellerId, marketplace, suffix) {
|
|
938
1015
|
return `/v1/seller_profiles/${encodeURIComponent(sellerId)}/marketplaces/${encodeURIComponent(
|
|
@@ -941,19 +1018,19 @@ function sellerMarketplacePath(sellerId, marketplace, suffix) {
|
|
|
941
1018
|
}
|
|
942
1019
|
|
|
943
1020
|
// src/tools/get-seller-catalog.ts
|
|
944
|
-
var
|
|
1021
|
+
var inputSchema24 = {
|
|
945
1022
|
...sellerScopedInputSchema,
|
|
946
|
-
search:
|
|
947
|
-
brand:
|
|
948
|
-
status:
|
|
949
|
-
currentPage:
|
|
950
|
-
pageSize:
|
|
1023
|
+
search: z24.string().min(1).optional().describe("Case-insensitive partial match on product title or brand."),
|
|
1024
|
+
brand: z24.string().min(1).optional().describe("Case-insensitive partial match on brand name."),
|
|
1025
|
+
status: z24.enum(CATALOG_STATUSES).optional().describe('Listing status filter. "Active" (default) or "all".'),
|
|
1026
|
+
currentPage: z24.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1027
|
+
pageSize: z24.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
951
1028
|
};
|
|
952
1029
|
var getSellerCatalogTool = {
|
|
953
1030
|
name: "get_seller_catalog",
|
|
954
1031
|
title: "List Catalog ASINs for a Seller",
|
|
955
1032
|
description: "Use this when the user wants to browse or search a seller's own Amazon catalog \u2014 the products they sell on a given marketplace. Requires a `sellerId` + `marketplace` (use `list_seller_profiles` to discover them). Filter by `search` (title/brand), `brand`, and `status` (Active by default, or all). Returns a paginated list where each item has asin, title, parentAsin, brand, status, imageUrl, and hasVariations, plus pagination metadata (currentPage, pageSize, total, lastPage, hasNext, hasPrev).",
|
|
956
|
-
inputSchema:
|
|
1033
|
+
inputSchema: inputSchema24,
|
|
957
1034
|
annotations: { readOnlyHint: true },
|
|
958
1035
|
handler: async (args, ctx) => {
|
|
959
1036
|
return await httpGet(
|
|
@@ -971,28 +1048,28 @@ var getSellerCatalogTool = {
|
|
|
971
1048
|
};
|
|
972
1049
|
|
|
973
1050
|
// src/tools/get-seller-listing-changes.ts
|
|
974
|
-
import { z as
|
|
975
|
-
var
|
|
1051
|
+
import { z as z25 } from "zod";
|
|
1052
|
+
var inputSchema25 = {
|
|
976
1053
|
...sellerScopedInputSchema,
|
|
977
|
-
types:
|
|
978
|
-
asin:
|
|
979
|
-
brand:
|
|
980
|
-
search:
|
|
981
|
-
startDate:
|
|
982
|
-
endDate:
|
|
983
|
-
sortBy:
|
|
984
|
-
sortOrder:
|
|
985
|
-
includeCorrelations:
|
|
1054
|
+
types: z25.array(z25.enum(LISTING_CHANGE_TYPES)).min(1).optional().describe('Filter to specific change types. Omit for all. Any of "Price", "Content", "Image".'),
|
|
1055
|
+
asin: z25.string().min(1).optional().describe("Filter to an exact ASIN or parent ASIN."),
|
|
1056
|
+
brand: z25.string().min(1).optional().describe("Case-insensitive partial match on brand name."),
|
|
1057
|
+
search: z25.string().min(1).optional().describe("Case-insensitive partial match on product title or brand."),
|
|
1058
|
+
startDate: z25.string().regex(ISO_8601, "startDate must be an ISO-8601 date or timestamp (e.g. 2026-05-01 or 2026-05-01T00:00:00Z)").optional().describe("ISO-8601 date/timestamp; return only changes detected on or after this time."),
|
|
1059
|
+
endDate: z25.string().regex(ISO_8601, "endDate must be an ISO-8601 date or timestamp (e.g. 2026-05-31 or 2026-05-31T23:59:59Z)").optional().describe("ISO-8601 date/timestamp; return only changes detected on or before this time."),
|
|
1060
|
+
sortBy: z25.enum(LISTING_CHANGE_SORT_BY).optional().describe('Sort field. "date" (default) or "type".'),
|
|
1061
|
+
sortOrder: z25.enum(SORT_ORDER).optional().describe('Sort direction. "DESC" (default) or "ASC".'),
|
|
1062
|
+
includeCorrelations: z25.boolean().optional().describe(
|
|
986
1063
|
"When true, include the ranking/conversion `correlation` object per change (CVR and search-term movement before vs after). Defaults to false."
|
|
987
1064
|
),
|
|
988
|
-
currentPage:
|
|
989
|
-
pageSize:
|
|
1065
|
+
currentPage: z25.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1066
|
+
pageSize: z25.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
990
1067
|
};
|
|
991
1068
|
var getSellerListingChangesTool = {
|
|
992
1069
|
name: "get_seller_listing_changes",
|
|
993
1070
|
title: "List Listing Changes for a Seller",
|
|
994
1071
|
description: "Use this when the user asks what changed on their Amazon listings \u2014 price, content (title/bullets/description), or image edits \u2014 for a seller account. Requires a `sellerId` + `marketplace` (use `list_seller_profiles` to discover them). Filter by `types`, `asin`/parent ASIN, `brand`, `search`, and a `startDate`/`endDate` range; sort with `sortBy`/`sortOrder`. Set `includeCorrelations: true` to attach the ranking/conversion impact per change. Returns a paginated list where each item has asin, title, imageUrl, date, type, contentType, description, previousValue, newValue, and (optionally) correlation, plus pagination metadata (currentPage, pageSize, total, lastPage, hasNext, hasPrev).",
|
|
995
|
-
inputSchema:
|
|
1072
|
+
inputSchema: inputSchema25,
|
|
996
1073
|
annotations: { readOnlyHint: true },
|
|
997
1074
|
handler: async (args, ctx) => {
|
|
998
1075
|
return await httpGet(
|
|
@@ -1016,14 +1093,78 @@ var getSellerListingChangesTool = {
|
|
|
1016
1093
|
}
|
|
1017
1094
|
};
|
|
1018
1095
|
|
|
1096
|
+
// src/tools/list-ppc-campaigns.ts
|
|
1097
|
+
import { z as z26 } from "zod";
|
|
1098
|
+
var PPC_CAMPAIGNS_MAX_WINDOW_DAYS = 90;
|
|
1099
|
+
var PPC_CAMPAIGNS_MAX_PAGE_SIZE = 50;
|
|
1100
|
+
var inputSchema26 = {
|
|
1101
|
+
...sellerScopedInputSchema,
|
|
1102
|
+
startDate: z26.string().regex(
|
|
1103
|
+
ISO_8601,
|
|
1104
|
+
"startDate must be an ISO-8601 date or timestamp (e.g. 2026-05-01 or 2026-05-01T00:00:00Z)"
|
|
1105
|
+
).optional().describe("Start of the reporting window, ISO-8601. Defaults to 30 days before endDate."),
|
|
1106
|
+
endDate: z26.string().regex(
|
|
1107
|
+
ISO_8601,
|
|
1108
|
+
"endDate must be an ISO-8601 date or timestamp (e.g. 2026-05-31 or 2026-05-31T23:59:59Z)"
|
|
1109
|
+
).optional().describe(
|
|
1110
|
+
`End of the reporting window, ISO-8601. Defaults to now. At most ${PPC_CAMPAIGNS_MAX_WINDOW_DAYS} days after startDate.`
|
|
1111
|
+
),
|
|
1112
|
+
asin: z26.string().min(1).optional().describe("Only campaigns advertising this ASIN. Cannot be combined with parentAsin."),
|
|
1113
|
+
parentAsin: z26.string().min(1).optional().describe("Only campaigns advertising any ASIN of this variation family. Cannot be combined with asin."),
|
|
1114
|
+
search: z26.string().min(3).max(200).optional().describe("Partial match on campaign name or advertised ASIN. At least 3 characters."),
|
|
1115
|
+
includePlacements: z26.boolean().optional().describe(
|
|
1116
|
+
"Include the per-placement breakdown (topOfSearch, restOfSearch, productPage, offAmazon, each with its bid adjustment). Defaults to true; set false for a smaller response when placements are not needed."
|
|
1117
|
+
),
|
|
1118
|
+
sortBy: z26.enum([...PPC_CAMPAIGN_BASE_SORT_BY, ...PPC_CAMPAIGN_PLACEMENT_SORT_BY]).optional().describe(
|
|
1119
|
+
`Sort field. Defaults to "name". Any of ${PPC_CAMPAIGN_BASE_SORT_BY.join(", ")}. The placement fields (e.g. "tosSpend", "tosAcos", "ppBidAdjustment") are only accepted when includePlacements is not false.`
|
|
1120
|
+
),
|
|
1121
|
+
sortOrder: z26.enum(SORT_ORDER).optional().describe('Sort direction. "ASC" (default) or "DESC".'),
|
|
1122
|
+
state: z26.enum(PPC_CAMPAIGN_STATES).optional().describe("Only ENABLED or only PAUSED campaigns. Omit for both."),
|
|
1123
|
+
currentPage: z26.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1124
|
+
pageSize: z26.number().int().min(1).max(PPC_CAMPAIGNS_MAX_PAGE_SIZE).optional().describe(`Campaigns per page (max ${PPC_CAMPAIGNS_MAX_PAGE_SIZE}). Defaults to 20.`)
|
|
1125
|
+
};
|
|
1126
|
+
var listPpcCampaignsTool = {
|
|
1127
|
+
name: "list_ppc_campaigns",
|
|
1128
|
+
title: "List PPC Campaigns for a Seller",
|
|
1129
|
+
description: `Use this when the user asks about their Sponsored Products campaigns \u2014 which campaigns spend the most, which have a high ACOS, how placements (top of search, rest of search, product pages) perform, or which campaigns advertise a given product. Requires a \`sellerId\` + \`marketplace\` (use \`list_seller_profiles\` to discover them). Narrow to one product with \`asin\`, or to a variation family with \`parentAsin\` (not both). The reporting window defaults to the last 30 days and cannot exceed ${PPC_CAMPAIGNS_MAX_WINDOW_DAYS} days. Returns a paginated list where each campaign has campaignId, name, type, state, targetingType, bidStrategy, budget { type, amount, currencyCode }, window totals (impressions, clicks, ctr, cpc, cvr, spend, unitsSold, orders, sales, tosImpressionShare, acos, roas, tacos), asinCount and, unless includePlacements is false, \`placements\`; plus pagination metadata (currentPage, pageSize, total, lastPage, hasNext, hasPrev). To find the biggest spenders, sort with \`sortBy: "spend", sortOrder: "DESC"\` rather than paging through every campaign. Each call counts toward API usage and is rate limited (about 60 requests/minute). For per-keyword ad data of a Rank Radar, use \`get_rank_radar_ppc_data\`.`,
|
|
1130
|
+
inputSchema: inputSchema26,
|
|
1131
|
+
annotations: { readOnlyHint: true },
|
|
1132
|
+
handler: async (args, ctx) => {
|
|
1133
|
+
if (args.asin && args.parentAsin) {
|
|
1134
|
+
throw new ApiError(
|
|
1135
|
+
"bad_request",
|
|
1136
|
+
400,
|
|
1137
|
+
"Pass either `asin` (one product) or `parentAsin` (its whole variation family), not both."
|
|
1138
|
+
);
|
|
1139
|
+
}
|
|
1140
|
+
return await httpGet(
|
|
1141
|
+
{ config: ctx.config, toolName: "list_ppc_campaigns" },
|
|
1142
|
+
sellerMarketplacePath(args.sellerId, args.marketplace, "ppc/campaigns"),
|
|
1143
|
+
{
|
|
1144
|
+
startDate: args.startDate,
|
|
1145
|
+
endDate: args.endDate,
|
|
1146
|
+
asin: args.asin,
|
|
1147
|
+
parentAsin: args.parentAsin,
|
|
1148
|
+
search: args.search,
|
|
1149
|
+
includePlacements: args.includePlacements,
|
|
1150
|
+
sortBy: args.sortBy,
|
|
1151
|
+
sortOrder: args.sortOrder,
|
|
1152
|
+
state: args.state,
|
|
1153
|
+
currentPage: args.currentPage,
|
|
1154
|
+
pageSize: args.pageSize
|
|
1155
|
+
}
|
|
1156
|
+
);
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1019
1160
|
// src/tools/get-asin-inventory-distribution.ts
|
|
1020
|
-
import { z as
|
|
1021
|
-
var
|
|
1022
|
-
sellerId:
|
|
1161
|
+
import { z as z27 } from "zod";
|
|
1162
|
+
var inputSchema27 = {
|
|
1163
|
+
sellerId: z27.string().min(1).describe(
|
|
1023
1164
|
"Amazon seller account ID as connected to DataDive. Get it from `list_seller_profiles`, or find it on the Connections page at https://2.datadive.tools."
|
|
1024
1165
|
),
|
|
1025
|
-
marketplace:
|
|
1026
|
-
asin:
|
|
1166
|
+
marketplace: z27.enum(SUPPORTED_MARKETPLACES).describe('Amazon marketplace code, e.g. "com" for amazon.com or "co.uk" for amazon.co.uk.'),
|
|
1167
|
+
asin: z27.string().regex(/^[A-Z0-9]{10}$/, "ASIN must be 10 uppercase alphanumeric characters (e.g. B08XYZ1234).").describe(
|
|
1027
1168
|
"Amazon Standard Identification Number (10 uppercase alphanumeric characters, e.g. B08XYZ1234)."
|
|
1028
1169
|
)
|
|
1029
1170
|
};
|
|
@@ -1031,7 +1172,7 @@ var getAsinInventoryDistributionTool = {
|
|
|
1031
1172
|
name: "get_asin_inventory_distribution",
|
|
1032
1173
|
title: "Get Per-Fulfillment-Center Inventory Distribution for an ASIN",
|
|
1033
1174
|
description: "Use this when the user asks about inventory levels, stock by fulfillment center, or where their units are sitting across Amazon's fulfillment network for a specific ASIN. Requires the Amazon sellerId (from `list_seller_profiles` or the user's DataDive Connections page at https://2.datadive.tools), the marketplace code, and the ASIN. Returns totalSellableUnits and a per-FC `distribution` array (fc, state, availableStock, availableStockPercentage). `lastUpdatedAt` may be null when no successful inventory ingestion has occurred in the last 30 days.",
|
|
1034
|
-
inputSchema:
|
|
1175
|
+
inputSchema: inputSchema27,
|
|
1035
1176
|
annotations: { readOnlyHint: true },
|
|
1036
1177
|
handler: async (args, ctx) => {
|
|
1037
1178
|
return await httpGet(
|
|
@@ -1044,18 +1185,18 @@ var getAsinInventoryDistributionTool = {
|
|
|
1044
1185
|
};
|
|
1045
1186
|
|
|
1046
1187
|
// src/tools/alert-query.ts
|
|
1047
|
-
import { z as
|
|
1188
|
+
import { z as z28 } from "zod";
|
|
1048
1189
|
var alertsQueryInputSchema = {
|
|
1049
|
-
sellerId:
|
|
1050
|
-
marketplace:
|
|
1051
|
-
status:
|
|
1190
|
+
sellerId: z28.string().min(1).max(50).optional().describe('Filter to a single connected Amazon seller account ID, e.g. "A1B2C3D4E5".'),
|
|
1191
|
+
marketplace: z28.enum(SUPPORTED_MARKETPLACES).optional().describe('Filter to a single Amazon marketplace code, e.g. "com" for amazon.com or "co.uk" for amazon.co.uk.'),
|
|
1192
|
+
status: z28.enum(ALERT_STATUSES).optional().describe(
|
|
1052
1193
|
"Lifecycle filter. `active` (default) returns unresolved alerts, `resolved` returns resolved alerts, `all` returns both. Dismissed alerts are never returned."
|
|
1053
1194
|
),
|
|
1054
|
-
updatedSince:
|
|
1195
|
+
updatedSince: z28.string().regex(ISO_8601, "updatedSince must be an ISO-8601 date or timestamp (e.g. 2026-05-01 or 2026-05-01T00:00:00Z)").optional().describe(
|
|
1055
1196
|
"ISO-8601 timestamp; return only alerts surfaced at or after this time (filters on `lastAlertedAt`). Use it to incrementally sync since your last poll. Defaults to the last 30 days when omitted."
|
|
1056
1197
|
),
|
|
1057
|
-
currentPage:
|
|
1058
|
-
pageSize:
|
|
1198
|
+
currentPage: z28.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1199
|
+
pageSize: z28.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
1059
1200
|
};
|
|
1060
1201
|
|
|
1061
1202
|
// src/tools/list-indexing-issue-alerts.ts
|
|
@@ -1105,12 +1246,12 @@ var listBlindSpendAlertsTool = {
|
|
|
1105
1246
|
};
|
|
1106
1247
|
|
|
1107
1248
|
// src/tools/get-quota.ts
|
|
1108
|
-
var
|
|
1249
|
+
var inputSchema28 = {};
|
|
1109
1250
|
var getQuotaTool = {
|
|
1110
1251
|
name: "get_quota",
|
|
1111
1252
|
title: "Get Quota Usage",
|
|
1112
1253
|
description: "Use this when the user asks how much quota or how many tokens they have left, or before creating a Niche Dive or Rank Radar to check remaining headroom. Returns current quota usage and capacity for each billable feature \u2014 DIVED_ASINS (Dive tokens), RANK_RADAR_KEYWORDS (tracked keywords), PRODUCT_BRIEF_ASINS, and AI_COPYWRITER_PROMPTS \u2014 each with `used` and `capacity` (null when unlimited / not applicable), plus `nextRefreshDate` (ISO-8601 timestamp of the next quota reset, or null). Takes no arguments.",
|
|
1113
|
-
inputSchema:
|
|
1254
|
+
inputSchema: inputSchema28,
|
|
1114
1255
|
annotations: { readOnlyHint: true },
|
|
1115
1256
|
handler: async (_args, ctx) => {
|
|
1116
1257
|
return await httpGet({ config: ctx.config, toolName: "get_quota" }, "/v1/quota");
|
|
@@ -1118,20 +1259,20 @@ var getQuotaTool = {
|
|
|
1118
1259
|
};
|
|
1119
1260
|
|
|
1120
1261
|
// src/tools/list-usage.ts
|
|
1121
|
-
import { z as
|
|
1122
|
-
var
|
|
1123
|
-
type:
|
|
1124
|
-
search:
|
|
1125
|
-
startDate:
|
|
1126
|
-
endDate:
|
|
1127
|
-
currentPage:
|
|
1128
|
-
pageSize:
|
|
1262
|
+
import { z as z29 } from "zod";
|
|
1263
|
+
var inputSchema29 = {
|
|
1264
|
+
type: z29.enum(BILLABLE_FEATURE_TYPES).optional().describe("Filter to a single billable feature type. Omit to return all types."),
|
|
1265
|
+
search: z29.string().min(1).optional().describe("Case-insensitive partial match on the user's name or email."),
|
|
1266
|
+
startDate: z29.string().regex(ISO_8601, "startDate must be an ISO-8601 date or timestamp (e.g. 2026-05-01 or 2026-05-01T00:00:00Z)").optional().describe("ISO-8601 date/timestamp; return only usage logs recorded on or after this time."),
|
|
1267
|
+
endDate: z29.string().regex(ISO_8601, "endDate must be an ISO-8601 date or timestamp (e.g. 2026-05-31 or 2026-05-31T23:59:59Z)").optional().describe("ISO-8601 date/timestamp; return only usage logs recorded on or before this time."),
|
|
1268
|
+
currentPage: z29.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1269
|
+
pageSize: z29.number().int().min(1).max(200).optional().describe("Items per page (max 200). Defaults to 50.")
|
|
1129
1270
|
};
|
|
1130
1271
|
var listUsageTool = {
|
|
1131
1272
|
name: "list_usage",
|
|
1132
1273
|
title: "List Billable Usage Logs",
|
|
1133
1274
|
description: "Use this when the user asks who consumed tokens, how their quota was spent, or wants an audit of billable activity over a date range. Retrieves a paginated list of billable feature usage logs for the organization \u2014 each entry is a token-consumption event (a dive, rank-radar creation, AI copywriter prompt, etc.). Filter by `type` (billable feature), `search` (user name/email), and `startDate`/`endDate`. Each item includes name, email, qty (tokens consumed), type, action (specific operation), nicheId/nicheName, rankRadarId, and date, plus pagination metadata (currentPage, pageSize, total, lastPage, hasNext, hasPrev).",
|
|
1134
|
-
inputSchema:
|
|
1275
|
+
inputSchema: inputSchema29,
|
|
1135
1276
|
annotations: { readOnlyHint: true },
|
|
1136
1277
|
handler: async (args, ctx) => {
|
|
1137
1278
|
return await httpGet(
|
|
@@ -1158,6 +1299,8 @@ var allTools = [
|
|
|
1158
1299
|
getRankingJuiceTool,
|
|
1159
1300
|
listRankRadarsTool,
|
|
1160
1301
|
getRankRadarDataTool,
|
|
1302
|
+
getRankRadarSqpDataTool,
|
|
1303
|
+
getRankRadarPpcDataTool,
|
|
1161
1304
|
createRankRadarTool,
|
|
1162
1305
|
createNicheDiveTool,
|
|
1163
1306
|
rediveNicheTool,
|
|
@@ -1174,6 +1317,7 @@ var allTools = [
|
|
|
1174
1317
|
listSellerProfilesTool,
|
|
1175
1318
|
getSellerCatalogTool,
|
|
1176
1319
|
getSellerListingChangesTool,
|
|
1320
|
+
listPpcCampaignsTool,
|
|
1177
1321
|
getAsinInventoryDistributionTool,
|
|
1178
1322
|
listIndexingIssueAlertsTool,
|
|
1179
1323
|
listBlindSpendAlertsTool,
|
|
@@ -1181,15 +1325,80 @@ var allTools = [
|
|
|
1181
1325
|
listUsageTool
|
|
1182
1326
|
];
|
|
1183
1327
|
|
|
1328
|
+
// src/whats-new.ts
|
|
1329
|
+
var WHATS_NEW = [
|
|
1330
|
+
{
|
|
1331
|
+
version: "0.15.0",
|
|
1332
|
+
released: "2026-09-28",
|
|
1333
|
+
items: [
|
|
1334
|
+
"Search Query Performance for Rank Radar keywords (`get_rank_radar_sqp_data`): how shoppers search, click, add to cart and buy, for the whole market and for your product.",
|
|
1335
|
+
"PPC data for Rank Radar keywords (`get_rank_radar_ppc_data`): sponsored rank, spend, sales, ACOS and CPC per keyword, optionally broken down by campaign.",
|
|
1336
|
+
"Your Sponsored Products campaigns (`list_ppc_campaigns`): totals and placement performance per campaign, sortable by any metric, e.g. the top spenders first."
|
|
1337
|
+
]
|
|
1338
|
+
},
|
|
1339
|
+
{
|
|
1340
|
+
version: "0.14.0",
|
|
1341
|
+
released: "2026-09-25",
|
|
1342
|
+
items: [
|
|
1343
|
+
"Rank Radar keywords are now read page by page (`get_rank_radar_data`, up to 100 keywords per page), so large Rank Radars load reliably."
|
|
1344
|
+
]
|
|
1345
|
+
},
|
|
1346
|
+
{
|
|
1347
|
+
version: "0.13.0",
|
|
1348
|
+
released: "2026-09-09",
|
|
1349
|
+
items: [
|
|
1350
|
+
"Before creating a Rank Radar, you are warned when the same product family is already tracked by another of your Rank Radars."
|
|
1351
|
+
]
|
|
1352
|
+
},
|
|
1353
|
+
{
|
|
1354
|
+
version: "0.12.0",
|
|
1355
|
+
released: "2026-09-07",
|
|
1356
|
+
items: ["Search and sort your niches by name, hero keyword or ASIN (`list_niches`)."]
|
|
1357
|
+
}
|
|
1358
|
+
];
|
|
1359
|
+
var INSTRUCTIONS_RELEASES = 2;
|
|
1360
|
+
function formatEntries(entries) {
|
|
1361
|
+
return entries.map((e) => `${e.released} (v${e.version}):
|
|
1362
|
+
${e.items.map((i) => `- ${i}`).join("\n")}`).join("\n\n");
|
|
1363
|
+
}
|
|
1364
|
+
var SERVER_INSTRUCTIONS = `DataDive tools for Amazon sellers: niche research (niches, keywords, roots, competitors, Ranking Juice), Rank Radar keyword rank tracking with SQP and PPC data, the seller's catalog, listing changes, inventory, PPC campaigns and alerts. Start with a discovery tool: \`list_niches\`, \`list_rank_radars\` or \`list_seller_profiles\`. Tools that spend tokens ask for confirmation first.
|
|
1365
|
+
|
|
1366
|
+
Recently added:
|
|
1367
|
+
${formatEntries(WHATS_NEW.slice(0, INSTRUCTIONS_RELEASES))}
|
|
1368
|
+
|
|
1369
|
+
When one of these additions fits what the user is doing, mention it once. The user can see the full list with the \`whats_new\` prompt.`;
|
|
1370
|
+
var WHATS_NEW_PROMPT = {
|
|
1371
|
+
name: "whats_new",
|
|
1372
|
+
title: "What's new in DataDive",
|
|
1373
|
+
description: "Recent additions to the DataDive tools, newest first."
|
|
1374
|
+
};
|
|
1375
|
+
function whatsNewPromptText() {
|
|
1376
|
+
return `Here is what is new in the DataDive tools, newest first:
|
|
1377
|
+
|
|
1378
|
+
${formatEntries(WHATS_NEW)}
|
|
1379
|
+
|
|
1380
|
+
Summarize this for me in a few short lines, and for each addition give one example question I could ask you.`;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1184
1383
|
// src/server.ts
|
|
1185
1384
|
function requiredScope(tool) {
|
|
1186
1385
|
return tool.annotations?.readOnlyHint === true ? SCOPE_READ : SCOPE_WRITE;
|
|
1187
1386
|
}
|
|
1188
1387
|
function buildServer(config) {
|
|
1189
|
-
const server = new McpServer(
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1388
|
+
const server = new McpServer(
|
|
1389
|
+
{
|
|
1390
|
+
name: "datadive",
|
|
1391
|
+
version: PKG_VERSION
|
|
1392
|
+
},
|
|
1393
|
+
{ instructions: SERVER_INSTRUCTIONS }
|
|
1394
|
+
);
|
|
1395
|
+
server.registerPrompt(
|
|
1396
|
+
WHATS_NEW_PROMPT.name,
|
|
1397
|
+
{ title: WHATS_NEW_PROMPT.title, description: WHATS_NEW_PROMPT.description },
|
|
1398
|
+
() => ({
|
|
1399
|
+
messages: [{ role: "user", content: { type: "text", text: whatsNewPromptText() } }]
|
|
1400
|
+
})
|
|
1401
|
+
);
|
|
1193
1402
|
for (const tool of allTools) {
|
|
1194
1403
|
server.registerTool(
|
|
1195
1404
|
tool.name,
|