@datadive-tools/mcp 0.13.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 +4 -1
- package/dist/index.js +359 -139
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +34 -1
- package/dist/lib.js +364 -140
- 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,31 +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
|
-
var
|
|
492
|
+
var RANK_RADAR_KEYWORDS_MAX_PAGE_SIZE = 100;
|
|
493
|
+
var RANK_RADAR_MAX_DATE_RANGE_DAYS = 90;
|
|
494
|
+
var rankRadarKeywordQueryInputSchema = {
|
|
466
495
|
rankRadarId: z7.string().uuid().describe("The Rank Radar UUID (from `list_rank_radars`)."),
|
|
467
|
-
startDate: z7.string().regex(ISO_DATE, "startDate must be in yyyy-mm-dd format").describe("Start date
|
|
468
|
-
endDate: z7.string().regex(ISO_DATE, "endDate must be in yyyy-mm-dd format").describe(
|
|
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)."),
|
|
497
|
+
endDate: z7.string().regex(ISO_DATE, "endDate must be in yyyy-mm-dd format").describe(
|
|
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.`
|
|
499
|
+
),
|
|
500
|
+
currentPage: z7.number().int().min(1).optional().describe("Page of keywords, 1-indexed. Defaults to 1."),
|
|
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.`)
|
|
469
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;
|
|
470
518
|
var getRankRadarDataTool = {
|
|
471
519
|
name: "get_rank_radar_data",
|
|
472
520
|
title: "Get Keyword Rankings for a Rank Radar",
|
|
473
|
-
description:
|
|
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\`.`,
|
|
474
522
|
inputSchema: inputSchema7,
|
|
475
523
|
annotations: { readOnlyHint: true },
|
|
476
524
|
handler: async (args, ctx) => {
|
|
477
525
|
return await httpGet(
|
|
478
526
|
{ config: ctx.config, toolName: "get_rank_radar_data" },
|
|
479
|
-
|
|
480
|
-
|
|
527
|
+
rankRadarPath(args.rankRadarId),
|
|
528
|
+
rankRadarKeywordQuery(args)
|
|
481
529
|
);
|
|
482
530
|
}
|
|
483
531
|
};
|
|
484
532
|
|
|
485
|
-
// 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
|
|
486
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";
|
|
487
575
|
|
|
488
576
|
// src/tools/confirm.ts
|
|
489
577
|
function needsConfirmation(confirm, ctx) {
|
|
@@ -504,11 +592,11 @@ function requireConfirmation(confirm, ctx, costNote) {
|
|
|
504
592
|
|
|
505
593
|
// src/tools/create-rank-radar.ts
|
|
506
594
|
var PATH = "/v1/niches/rank-radars";
|
|
507
|
-
var
|
|
508
|
-
asin:
|
|
509
|
-
numberOfKeywords:
|
|
510
|
-
nicheId:
|
|
511
|
-
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(
|
|
512
600
|
"Must be true to proceed \u2014 creating a Rank Radar spends Search Term tokens. Confirm the cost with the user first."
|
|
513
601
|
)
|
|
514
602
|
};
|
|
@@ -516,7 +604,7 @@ var createRankRadarTool = {
|
|
|
516
604
|
name: "create_rank_radar",
|
|
517
605
|
title: "Create a Rank Radar",
|
|
518
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`.",
|
|
519
|
-
inputSchema:
|
|
607
|
+
inputSchema: inputSchema10,
|
|
520
608
|
// destructiveHint is technically "additive" here (this creates a new Rank Radar, it
|
|
521
609
|
// doesn't destroy data), but we flag it destructive so clients prompt before the
|
|
522
610
|
// irreversible token spend. The confirm gate enforces this server-side regardless.
|
|
@@ -541,20 +629,20 @@ var createRankRadarTool = {
|
|
|
541
629
|
};
|
|
542
630
|
|
|
543
631
|
// src/tools/create-niche-dive.ts
|
|
544
|
-
import { z as
|
|
545
|
-
var
|
|
546
|
-
marketplace:
|
|
632
|
+
import { z as z10 } from "zod";
|
|
633
|
+
var inputSchema11 = {
|
|
634
|
+
marketplace: z10.enum(SUPPORTED_MARKETPLACES).describe(
|
|
547
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`)."
|
|
548
636
|
),
|
|
549
|
-
asin:
|
|
550
|
-
numberOfCompetitors:
|
|
551
|
-
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.")
|
|
552
640
|
};
|
|
553
641
|
var createNicheDiveTool = {
|
|
554
642
|
name: "create_niche_dive",
|
|
555
643
|
title: "Create a Niche Dive",
|
|
556
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).",
|
|
557
|
-
inputSchema:
|
|
645
|
+
inputSchema: inputSchema11,
|
|
558
646
|
// destructiveHint is technically "additive" here (a dive creates a new niche, it
|
|
559
647
|
// doesn't destroy data), but we flag it destructive so clients prompt before the
|
|
560
648
|
// irreversible token spend. The confirm gate enforces this server-side regardless.
|
|
@@ -579,23 +667,23 @@ var createNicheDiveTool = {
|
|
|
579
667
|
};
|
|
580
668
|
|
|
581
669
|
// src/tools/redive-niche.ts
|
|
582
|
-
import { z as
|
|
583
|
-
var
|
|
584
|
-
nicheId:
|
|
585
|
-
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(
|
|
586
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."
|
|
587
675
|
),
|
|
588
|
-
numberOfCompetitors:
|
|
676
|
+
numberOfCompetitors: z11.number().int().min(2).optional().describe(
|
|
589
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."
|
|
590
678
|
),
|
|
591
|
-
heroAsin:
|
|
679
|
+
heroAsin: z11.string().min(1).optional().describe(
|
|
592
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."
|
|
593
681
|
),
|
|
594
|
-
lockedAsins:
|
|
682
|
+
lockedAsins: z11.array(z11.string().min(1)).optional().describe(
|
|
595
683
|
"`discover` mode only. ASINs that must stay in the competitor set regardless of what discovery finds. Cannot exceed `numberOfCompetitors`, and cannot overlap `excludedAsins`."
|
|
596
684
|
),
|
|
597
|
-
excludedAsins:
|
|
598
|
-
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(
|
|
599
687
|
"Must be true to proceed \u2014 a re-dive spends dive tokens. Confirm the cost with the user first."
|
|
600
688
|
)
|
|
601
689
|
};
|
|
@@ -603,7 +691,7 @@ var rediveNicheTool = {
|
|
|
603
691
|
name: "redive_niche",
|
|
604
692
|
title: "Re-dive an Existing Niche",
|
|
605
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.",
|
|
606
|
-
inputSchema:
|
|
694
|
+
inputSchema: inputSchema12,
|
|
607
695
|
// Same reasoning as create_niche_dive: a re-dive is additive rather than destructive, but the
|
|
608
696
|
// irreversible token spend is what clients need to prompt on. The confirm gate enforces it regardless.
|
|
609
697
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
@@ -636,15 +724,15 @@ var rediveNicheTool = {
|
|
|
636
724
|
};
|
|
637
725
|
|
|
638
726
|
// src/tools/get-dive-status.ts
|
|
639
|
-
import { z as
|
|
640
|
-
var
|
|
641
|
-
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`.")
|
|
642
730
|
};
|
|
643
731
|
var getDiveStatusTool = {
|
|
644
732
|
name: "get_dive_status",
|
|
645
733
|
title: "Get Niche Dive Status",
|
|
646
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.",
|
|
647
|
-
inputSchema:
|
|
735
|
+
inputSchema: inputSchema13,
|
|
648
736
|
annotations: { readOnlyHint: true },
|
|
649
737
|
handler: async (args, ctx) => {
|
|
650
738
|
return await httpGet(
|
|
@@ -655,10 +743,10 @@ var getDiveStatusTool = {
|
|
|
655
743
|
};
|
|
656
744
|
|
|
657
745
|
// src/tools/delete-niche.ts
|
|
658
|
-
import { z as
|
|
659
|
-
var
|
|
660
|
-
nicheId:
|
|
661
|
-
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(
|
|
662
750
|
"Must be true to proceed \u2014 deleting a niche destroys its keywords, competitors and dive history permanently. Confirm with the user first."
|
|
663
751
|
)
|
|
664
752
|
};
|
|
@@ -666,7 +754,7 @@ var deleteNicheTool = {
|
|
|
666
754
|
name: "delete_niche",
|
|
667
755
|
title: "Delete a Niche",
|
|
668
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).",
|
|
669
|
-
inputSchema:
|
|
757
|
+
inputSchema: inputSchema14,
|
|
670
758
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
671
759
|
handler: async (args, ctx) => {
|
|
672
760
|
const pending = requireConfirmation(
|
|
@@ -684,15 +772,15 @@ var deleteNicheTool = {
|
|
|
684
772
|
};
|
|
685
773
|
|
|
686
774
|
// src/tools/pause-rank-radar.ts
|
|
687
|
-
import { z as
|
|
688
|
-
var
|
|
689
|
-
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`).")
|
|
690
778
|
};
|
|
691
779
|
var pauseRankRadarTool = {
|
|
692
780
|
name: "pause_rank_radar",
|
|
693
781
|
title: "Pause a Rank Radar",
|
|
694
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.",
|
|
695
|
-
inputSchema:
|
|
783
|
+
inputSchema: inputSchema15,
|
|
696
784
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
697
785
|
handler: async (args, ctx) => {
|
|
698
786
|
await httpPost(
|
|
@@ -705,15 +793,15 @@ var pauseRankRadarTool = {
|
|
|
705
793
|
};
|
|
706
794
|
|
|
707
795
|
// src/tools/resume-rank-radar.ts
|
|
708
|
-
import { z as
|
|
709
|
-
var
|
|
710
|
-
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`).")
|
|
711
799
|
};
|
|
712
800
|
var resumeRankRadarTool = {
|
|
713
801
|
name: "resume_rank_radar",
|
|
714
802
|
title: "Resume a Paused Rank Radar",
|
|
715
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.",
|
|
716
|
-
inputSchema:
|
|
804
|
+
inputSchema: inputSchema16,
|
|
717
805
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
718
806
|
handler: async (args, ctx) => {
|
|
719
807
|
await httpPost(
|
|
@@ -726,10 +814,10 @@ var resumeRankRadarTool = {
|
|
|
726
814
|
};
|
|
727
815
|
|
|
728
816
|
// src/tools/delete-rank-radar.ts
|
|
729
|
-
import { z as
|
|
730
|
-
var
|
|
731
|
-
rankRadarId:
|
|
732
|
-
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(
|
|
733
821
|
"Must be true to proceed \u2014 deleting a Rank Radar destroys its ranking history permanently. Confirm with the user first."
|
|
734
822
|
)
|
|
735
823
|
};
|
|
@@ -737,7 +825,7 @@ var deleteRankRadarTool = {
|
|
|
737
825
|
name: "delete_rank_radar",
|
|
738
826
|
title: "Delete a Rank Radar",
|
|
739
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`.",
|
|
740
|
-
inputSchema:
|
|
828
|
+
inputSchema: inputSchema17,
|
|
741
829
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
742
830
|
handler: async (args, ctx) => {
|
|
743
831
|
const pending = requireConfirmation(
|
|
@@ -755,10 +843,10 @@ var deleteRankRadarTool = {
|
|
|
755
843
|
};
|
|
756
844
|
|
|
757
845
|
// src/tools/add-rank-radar-search-terms.ts
|
|
758
|
-
import { z as
|
|
759
|
-
var
|
|
760
|
-
rankRadarId:
|
|
761
|
-
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(
|
|
762
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.`
|
|
763
851
|
)
|
|
764
852
|
};
|
|
@@ -766,7 +854,7 @@ var addRankRadarSearchTermsTool = {
|
|
|
766
854
|
name: "add_rank_radar_search_terms",
|
|
767
855
|
title: "Add Search Terms to a Rank Radar",
|
|
768
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.",
|
|
769
|
-
inputSchema:
|
|
857
|
+
inputSchema: inputSchema18,
|
|
770
858
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
771
859
|
handler: async (args, ctx) => {
|
|
772
860
|
return await httpPost(
|
|
@@ -778,10 +866,10 @@ var addRankRadarSearchTermsTool = {
|
|
|
778
866
|
};
|
|
779
867
|
|
|
780
868
|
// src/tools/pause-rank-radar-search-terms.ts
|
|
781
|
-
import { z as
|
|
782
|
-
var
|
|
783
|
-
rankRadarId:
|
|
784
|
-
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(
|
|
785
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."
|
|
786
874
|
)
|
|
787
875
|
};
|
|
@@ -789,7 +877,7 @@ var pauseRankRadarSearchTermsTool = {
|
|
|
789
877
|
name: "pause_rank_radar_search_terms",
|
|
790
878
|
title: "Pause Search Terms of a Rank Radar",
|
|
791
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.",
|
|
792
|
-
inputSchema:
|
|
880
|
+
inputSchema: inputSchema19,
|
|
793
881
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
794
882
|
handler: async (args, ctx) => {
|
|
795
883
|
await httpPost(
|
|
@@ -806,10 +894,10 @@ var pauseRankRadarSearchTermsTool = {
|
|
|
806
894
|
};
|
|
807
895
|
|
|
808
896
|
// src/tools/resume-rank-radar-search-terms.ts
|
|
809
|
-
import { z as
|
|
810
|
-
var
|
|
811
|
-
rankRadarId:
|
|
812
|
-
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(
|
|
813
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."
|
|
814
902
|
)
|
|
815
903
|
};
|
|
@@ -817,7 +905,7 @@ var resumeRankRadarSearchTermsTool = {
|
|
|
817
905
|
name: "resume_rank_radar_search_terms",
|
|
818
906
|
title: "Resume Paused Search Terms of a Rank Radar",
|
|
819
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.",
|
|
820
|
-
inputSchema:
|
|
908
|
+
inputSchema: inputSchema20,
|
|
821
909
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
822
910
|
handler: async (args, ctx) => {
|
|
823
911
|
await httpPost(
|
|
@@ -834,16 +922,16 @@ var resumeRankRadarSearchTermsTool = {
|
|
|
834
922
|
};
|
|
835
923
|
|
|
836
924
|
// src/tools/generate-listing-copy.ts
|
|
837
|
-
import { z as
|
|
838
|
-
var
|
|
839
|
-
nicheId:
|
|
840
|
-
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(
|
|
841
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."
|
|
842
930
|
),
|
|
843
|
-
currentListing:
|
|
931
|
+
currentListing: z20.record(z20.union([z20.string(), z20.array(z20.string())])).describe(
|
|
844
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.'
|
|
845
933
|
),
|
|
846
|
-
confirm:
|
|
934
|
+
confirm: z20.boolean().optional().describe(
|
|
847
935
|
"Must be true to proceed \u2014 each generation spends one AI Copywriter prompt from the quota. Confirm the cost with the user first."
|
|
848
936
|
)
|
|
849
937
|
};
|
|
@@ -851,7 +939,7 @@ var generateListingCopyTool = {
|
|
|
851
939
|
name: "generate_listing_copy",
|
|
852
940
|
title: "Generate Listing Copy for a Niche",
|
|
853
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`.",
|
|
854
|
-
inputSchema:
|
|
942
|
+
inputSchema: inputSchema21,
|
|
855
943
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
856
944
|
handler: async (args, ctx) => {
|
|
857
945
|
const pending = requireConfirmation(
|
|
@@ -869,16 +957,16 @@ var generateListingCopyTool = {
|
|
|
869
957
|
};
|
|
870
958
|
|
|
871
959
|
// src/tools/get-listing-copy-generation-status.ts
|
|
872
|
-
import { z as
|
|
873
|
-
var
|
|
874
|
-
nicheId:
|
|
875
|
-
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`.")
|
|
876
964
|
};
|
|
877
965
|
var getListingCopyGenerationStatusTool = {
|
|
878
966
|
name: "get_listing_copy_generation_status",
|
|
879
967
|
title: "Get Listing Copy Generation Status",
|
|
880
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`.",
|
|
881
|
-
inputSchema:
|
|
969
|
+
inputSchema: inputSchema22,
|
|
882
970
|
annotations: { readOnlyHint: true },
|
|
883
971
|
handler: async (args, ctx) => {
|
|
884
972
|
return await httpGet(
|
|
@@ -889,16 +977,16 @@ var getListingCopyGenerationStatusTool = {
|
|
|
889
977
|
};
|
|
890
978
|
|
|
891
979
|
// src/tools/list-seller-profiles.ts
|
|
892
|
-
import { z as
|
|
893
|
-
var
|
|
894
|
-
currentPage:
|
|
895
|
-
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.")
|
|
896
984
|
};
|
|
897
985
|
var listSellerProfilesTool = {
|
|
898
986
|
name: "list_seller_profiles",
|
|
899
987
|
title: "List Connected Amazon Seller Profiles",
|
|
900
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).',
|
|
901
|
-
inputSchema:
|
|
989
|
+
inputSchema: inputSchema23,
|
|
902
990
|
annotations: { readOnlyHint: true },
|
|
903
991
|
handler: async (args, ctx) => {
|
|
904
992
|
return await httpGet(
|
|
@@ -913,15 +1001,15 @@ var listSellerProfilesTool = {
|
|
|
913
1001
|
};
|
|
914
1002
|
|
|
915
1003
|
// src/tools/get-seller-catalog.ts
|
|
916
|
-
import { z as
|
|
1004
|
+
import { z as z24 } from "zod";
|
|
917
1005
|
|
|
918
1006
|
// src/tools/seller-scoped.ts
|
|
919
|
-
import { z as
|
|
1007
|
+
import { z as z23 } from "zod";
|
|
920
1008
|
var sellerScopedInputSchema = {
|
|
921
|
-
sellerId:
|
|
1009
|
+
sellerId: z23.string().min(1).describe(
|
|
922
1010
|
"Amazon seller account ID. Get it from `list_seller_profiles`, or find it on the Connections page at https://2.datadive.tools."
|
|
923
1011
|
),
|
|
924
|
-
marketplace:
|
|
1012
|
+
marketplace: z23.enum(SUPPORTED_MARKETPLACES).describe('Amazon marketplace code, e.g. "com" for amazon.com or "co.uk" for amazon.co.uk.')
|
|
925
1013
|
};
|
|
926
1014
|
function sellerMarketplacePath(sellerId, marketplace, suffix) {
|
|
927
1015
|
return `/v1/seller_profiles/${encodeURIComponent(sellerId)}/marketplaces/${encodeURIComponent(
|
|
@@ -930,19 +1018,19 @@ function sellerMarketplacePath(sellerId, marketplace, suffix) {
|
|
|
930
1018
|
}
|
|
931
1019
|
|
|
932
1020
|
// src/tools/get-seller-catalog.ts
|
|
933
|
-
var
|
|
1021
|
+
var inputSchema24 = {
|
|
934
1022
|
...sellerScopedInputSchema,
|
|
935
|
-
search:
|
|
936
|
-
brand:
|
|
937
|
-
status:
|
|
938
|
-
currentPage:
|
|
939
|
-
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.")
|
|
940
1028
|
};
|
|
941
1029
|
var getSellerCatalogTool = {
|
|
942
1030
|
name: "get_seller_catalog",
|
|
943
1031
|
title: "List Catalog ASINs for a Seller",
|
|
944
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).",
|
|
945
|
-
inputSchema:
|
|
1033
|
+
inputSchema: inputSchema24,
|
|
946
1034
|
annotations: { readOnlyHint: true },
|
|
947
1035
|
handler: async (args, ctx) => {
|
|
948
1036
|
return await httpGet(
|
|
@@ -960,28 +1048,28 @@ var getSellerCatalogTool = {
|
|
|
960
1048
|
};
|
|
961
1049
|
|
|
962
1050
|
// src/tools/get-seller-listing-changes.ts
|
|
963
|
-
import { z as
|
|
964
|
-
var
|
|
1051
|
+
import { z as z25 } from "zod";
|
|
1052
|
+
var inputSchema25 = {
|
|
965
1053
|
...sellerScopedInputSchema,
|
|
966
|
-
types:
|
|
967
|
-
asin:
|
|
968
|
-
brand:
|
|
969
|
-
search:
|
|
970
|
-
startDate:
|
|
971
|
-
endDate:
|
|
972
|
-
sortBy:
|
|
973
|
-
sortOrder:
|
|
974
|
-
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(
|
|
975
1063
|
"When true, include the ranking/conversion `correlation` object per change (CVR and search-term movement before vs after). Defaults to false."
|
|
976
1064
|
),
|
|
977
|
-
currentPage:
|
|
978
|
-
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.")
|
|
979
1067
|
};
|
|
980
1068
|
var getSellerListingChangesTool = {
|
|
981
1069
|
name: "get_seller_listing_changes",
|
|
982
1070
|
title: "List Listing Changes for a Seller",
|
|
983
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).",
|
|
984
|
-
inputSchema:
|
|
1072
|
+
inputSchema: inputSchema25,
|
|
985
1073
|
annotations: { readOnlyHint: true },
|
|
986
1074
|
handler: async (args, ctx) => {
|
|
987
1075
|
return await httpGet(
|
|
@@ -1005,14 +1093,78 @@ var getSellerListingChangesTool = {
|
|
|
1005
1093
|
}
|
|
1006
1094
|
};
|
|
1007
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
|
+
|
|
1008
1160
|
// src/tools/get-asin-inventory-distribution.ts
|
|
1009
|
-
import { z as
|
|
1010
|
-
var
|
|
1011
|
-
sellerId:
|
|
1161
|
+
import { z as z27 } from "zod";
|
|
1162
|
+
var inputSchema27 = {
|
|
1163
|
+
sellerId: z27.string().min(1).describe(
|
|
1012
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."
|
|
1013
1165
|
),
|
|
1014
|
-
marketplace:
|
|
1015
|
-
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(
|
|
1016
1168
|
"Amazon Standard Identification Number (10 uppercase alphanumeric characters, e.g. B08XYZ1234)."
|
|
1017
1169
|
)
|
|
1018
1170
|
};
|
|
@@ -1020,7 +1172,7 @@ var getAsinInventoryDistributionTool = {
|
|
|
1020
1172
|
name: "get_asin_inventory_distribution",
|
|
1021
1173
|
title: "Get Per-Fulfillment-Center Inventory Distribution for an ASIN",
|
|
1022
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.",
|
|
1023
|
-
inputSchema:
|
|
1175
|
+
inputSchema: inputSchema27,
|
|
1024
1176
|
annotations: { readOnlyHint: true },
|
|
1025
1177
|
handler: async (args, ctx) => {
|
|
1026
1178
|
return await httpGet(
|
|
@@ -1033,18 +1185,18 @@ var getAsinInventoryDistributionTool = {
|
|
|
1033
1185
|
};
|
|
1034
1186
|
|
|
1035
1187
|
// src/tools/alert-query.ts
|
|
1036
|
-
import { z as
|
|
1188
|
+
import { z as z28 } from "zod";
|
|
1037
1189
|
var alertsQueryInputSchema = {
|
|
1038
|
-
sellerId:
|
|
1039
|
-
marketplace:
|
|
1040
|
-
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(
|
|
1041
1193
|
"Lifecycle filter. `active` (default) returns unresolved alerts, `resolved` returns resolved alerts, `all` returns both. Dismissed alerts are never returned."
|
|
1042
1194
|
),
|
|
1043
|
-
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(
|
|
1044
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."
|
|
1045
1197
|
),
|
|
1046
|
-
currentPage:
|
|
1047
|
-
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.")
|
|
1048
1200
|
};
|
|
1049
1201
|
|
|
1050
1202
|
// src/tools/list-indexing-issue-alerts.ts
|
|
@@ -1094,12 +1246,12 @@ var listBlindSpendAlertsTool = {
|
|
|
1094
1246
|
};
|
|
1095
1247
|
|
|
1096
1248
|
// src/tools/get-quota.ts
|
|
1097
|
-
var
|
|
1249
|
+
var inputSchema28 = {};
|
|
1098
1250
|
var getQuotaTool = {
|
|
1099
1251
|
name: "get_quota",
|
|
1100
1252
|
title: "Get Quota Usage",
|
|
1101
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.",
|
|
1102
|
-
inputSchema:
|
|
1254
|
+
inputSchema: inputSchema28,
|
|
1103
1255
|
annotations: { readOnlyHint: true },
|
|
1104
1256
|
handler: async (_args, ctx) => {
|
|
1105
1257
|
return await httpGet({ config: ctx.config, toolName: "get_quota" }, "/v1/quota");
|
|
@@ -1107,20 +1259,20 @@ var getQuotaTool = {
|
|
|
1107
1259
|
};
|
|
1108
1260
|
|
|
1109
1261
|
// src/tools/list-usage.ts
|
|
1110
|
-
import { z as
|
|
1111
|
-
var
|
|
1112
|
-
type:
|
|
1113
|
-
search:
|
|
1114
|
-
startDate:
|
|
1115
|
-
endDate:
|
|
1116
|
-
currentPage:
|
|
1117
|
-
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.")
|
|
1118
1270
|
};
|
|
1119
1271
|
var listUsageTool = {
|
|
1120
1272
|
name: "list_usage",
|
|
1121
1273
|
title: "List Billable Usage Logs",
|
|
1122
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).",
|
|
1123
|
-
inputSchema:
|
|
1275
|
+
inputSchema: inputSchema29,
|
|
1124
1276
|
annotations: { readOnlyHint: true },
|
|
1125
1277
|
handler: async (args, ctx) => {
|
|
1126
1278
|
return await httpGet(
|
|
@@ -1147,6 +1299,8 @@ var allTools = [
|
|
|
1147
1299
|
getRankingJuiceTool,
|
|
1148
1300
|
listRankRadarsTool,
|
|
1149
1301
|
getRankRadarDataTool,
|
|
1302
|
+
getRankRadarSqpDataTool,
|
|
1303
|
+
getRankRadarPpcDataTool,
|
|
1150
1304
|
createRankRadarTool,
|
|
1151
1305
|
createNicheDiveTool,
|
|
1152
1306
|
rediveNicheTool,
|
|
@@ -1163,6 +1317,7 @@ var allTools = [
|
|
|
1163
1317
|
listSellerProfilesTool,
|
|
1164
1318
|
getSellerCatalogTool,
|
|
1165
1319
|
getSellerListingChangesTool,
|
|
1320
|
+
listPpcCampaignsTool,
|
|
1166
1321
|
getAsinInventoryDistributionTool,
|
|
1167
1322
|
listIndexingIssueAlertsTool,
|
|
1168
1323
|
listBlindSpendAlertsTool,
|
|
@@ -1170,15 +1325,80 @@ var allTools = [
|
|
|
1170
1325
|
listUsageTool
|
|
1171
1326
|
];
|
|
1172
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
|
+
|
|
1173
1383
|
// src/server.ts
|
|
1174
1384
|
function requiredScope(tool) {
|
|
1175
1385
|
return tool.annotations?.readOnlyHint === true ? SCOPE_READ : SCOPE_WRITE;
|
|
1176
1386
|
}
|
|
1177
1387
|
function buildServer(config) {
|
|
1178
|
-
const server = new McpServer(
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
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
|
+
);
|
|
1182
1402
|
for (const tool of allTools) {
|
|
1183
1403
|
server.registerTool(
|
|
1184
1404
|
tool.name,
|