@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/lib.js
CHANGED
|
@@ -139,7 +139,7 @@ function extractMessage(body) {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
// package.json
|
|
142
|
-
var version = "0.
|
|
142
|
+
var version = "0.15.0";
|
|
143
143
|
|
|
144
144
|
// src/http/client.ts
|
|
145
145
|
var PKG_VERSION = version;
|
|
@@ -403,6 +403,33 @@ var SUPPORTED_MARKETPLACES = [
|
|
|
403
403
|
];
|
|
404
404
|
var RANK_RADAR_STATES = ["ACTIVE", "PAUSED", "ARCHIVED"];
|
|
405
405
|
var RANK_RADAR_STATUSES = [...RANK_RADAR_STATES, "ALL"];
|
|
406
|
+
var PPC_CAMPAIGN_BASE_SORT_BY = [
|
|
407
|
+
"name",
|
|
408
|
+
"state",
|
|
409
|
+
"bidStrategy",
|
|
410
|
+
"budget",
|
|
411
|
+
"impressions",
|
|
412
|
+
"clicks",
|
|
413
|
+
"ctr",
|
|
414
|
+
"cpc",
|
|
415
|
+
"spend",
|
|
416
|
+
"unitsSold",
|
|
417
|
+
"sales",
|
|
418
|
+
"acos",
|
|
419
|
+
"cvr",
|
|
420
|
+
"tosImpressionShare"
|
|
421
|
+
];
|
|
422
|
+
var PPC_CAMPAIGN_PLACEMENT_SORT_BY = [
|
|
423
|
+
...["tos", "ros", "pp", "off"].flatMap(
|
|
424
|
+
(p) => ["Impressions", "Clicks", "Spend", "Sales", "UnitsSold", "Ctr", "Cpc", "Acos"].map(
|
|
425
|
+
(m) => `${p}${m}`
|
|
426
|
+
)
|
|
427
|
+
),
|
|
428
|
+
"tosBidAdjustment",
|
|
429
|
+
"rosBidAdjustment",
|
|
430
|
+
"ppBidAdjustment"
|
|
431
|
+
];
|
|
432
|
+
var PPC_CAMPAIGN_STATES = ["ENABLED", "PAUSED"];
|
|
406
433
|
var ALERT_STATUSES = ["active", "resolved", "all"];
|
|
407
434
|
var BILLABLE_FEATURE_TYPES = [
|
|
408
435
|
"DIVED_ASINS",
|
|
@@ -454,42 +481,92 @@ var listRankRadarsTool = {
|
|
|
454
481
|
}
|
|
455
482
|
};
|
|
456
483
|
|
|
457
|
-
// src/tools/
|
|
484
|
+
// src/tools/rank-radar-keyword-query.ts
|
|
458
485
|
import { z as z7 } from "zod";
|
|
459
486
|
var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
460
487
|
var RANK_RADAR_KEYWORDS_MAX_PAGE_SIZE = 100;
|
|
461
488
|
var RANK_RADAR_MAX_DATE_RANGE_DAYS = 90;
|
|
462
|
-
var
|
|
489
|
+
var rankRadarKeywordQueryInputSchema = {
|
|
463
490
|
rankRadarId: z7.string().uuid().describe("The Rank Radar UUID (from `list_rank_radars`)."),
|
|
464
|
-
startDate: z7.string().regex(ISO_DATE, "startDate must be in yyyy-mm-dd format").describe("Start date
|
|
491
|
+
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)."),
|
|
465
492
|
endDate: z7.string().regex(ISO_DATE, "endDate must be in yyyy-mm-dd format").describe(
|
|
466
|
-
`End date
|
|
493
|
+
`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.`
|
|
467
494
|
),
|
|
468
495
|
currentPage: z7.number().int().min(1).optional().describe("Page of keywords, 1-indexed. Defaults to 1."),
|
|
469
496
|
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.`)
|
|
470
497
|
};
|
|
498
|
+
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.`;
|
|
499
|
+
function rankRadarPath(rankRadarId, suffix = "") {
|
|
500
|
+
return `/v1/niches/rank-radars/${encodeURIComponent(rankRadarId)}${suffix ? `/${suffix}` : ""}`;
|
|
501
|
+
}
|
|
502
|
+
function rankRadarKeywordQuery(args) {
|
|
503
|
+
return {
|
|
504
|
+
startDate: args.startDate,
|
|
505
|
+
endDate: args.endDate,
|
|
506
|
+
currentPage: args.currentPage,
|
|
507
|
+
pageSize: args.pageSize
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// src/tools/get-rank-radar-data.ts
|
|
512
|
+
var inputSchema7 = rankRadarKeywordQueryInputSchema;
|
|
471
513
|
var getRankRadarDataTool = {
|
|
472
514
|
name: "get_rank_radar_data",
|
|
473
515
|
title: "Get Keyword Rankings for a Rank Radar",
|
|
474
|
-
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.
|
|
516
|
+
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\`.`,
|
|
475
517
|
inputSchema: inputSchema7,
|
|
476
518
|
annotations: { readOnlyHint: true },
|
|
477
519
|
handler: async (args, ctx) => {
|
|
478
520
|
return await httpGet(
|
|
479
521
|
{ config: ctx.config, toolName: "get_rank_radar_data" },
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
startDate: args.startDate,
|
|
483
|
-
endDate: args.endDate,
|
|
484
|
-
currentPage: args.currentPage,
|
|
485
|
-
pageSize: args.pageSize
|
|
486
|
-
}
|
|
522
|
+
rankRadarPath(args.rankRadarId),
|
|
523
|
+
rankRadarKeywordQuery(args)
|
|
487
524
|
);
|
|
488
525
|
}
|
|
489
526
|
};
|
|
490
527
|
|
|
491
|
-
// src/tools/
|
|
528
|
+
// src/tools/get-rank-radar-sqp-data.ts
|
|
529
|
+
var inputSchema8 = rankRadarKeywordQueryInputSchema;
|
|
530
|
+
var getRankRadarSqpDataTool = {
|
|
531
|
+
name: "get_rank_radar_sqp_data",
|
|
532
|
+
title: "Get Search Query Performance for a Rank Radar",
|
|
533
|
+
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\`.`,
|
|
534
|
+
inputSchema: inputSchema8,
|
|
535
|
+
annotations: { readOnlyHint: true },
|
|
536
|
+
handler: async (args, ctx) => {
|
|
537
|
+
return await httpGet(
|
|
538
|
+
{ config: ctx.config, toolName: "get_rank_radar_sqp_data" },
|
|
539
|
+
rankRadarPath(args.rankRadarId, "sqp"),
|
|
540
|
+
rankRadarKeywordQuery(args)
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
// src/tools/get-rank-radar-ppc-data.ts
|
|
492
546
|
import { z as z8 } from "zod";
|
|
547
|
+
var inputSchema9 = {
|
|
548
|
+
...rankRadarKeywordQueryInputSchema,
|
|
549
|
+
includeCampaigns: z8.boolean().optional().describe(
|
|
550
|
+
"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."
|
|
551
|
+
)
|
|
552
|
+
};
|
|
553
|
+
var getRankRadarPpcDataTool = {
|
|
554
|
+
name: "get_rank_radar_ppc_data",
|
|
555
|
+
title: "Get PPC Data for a Rank Radar",
|
|
556
|
+
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\`.`,
|
|
557
|
+
inputSchema: inputSchema9,
|
|
558
|
+
annotations: { readOnlyHint: true },
|
|
559
|
+
handler: async (args, ctx) => {
|
|
560
|
+
return await httpGet(
|
|
561
|
+
{ config: ctx.config, toolName: "get_rank_radar_ppc_data" },
|
|
562
|
+
rankRadarPath(args.rankRadarId, "ppc"),
|
|
563
|
+
{ ...rankRadarKeywordQuery(args), includeCampaigns: args.includeCampaigns }
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
// src/tools/create-rank-radar.ts
|
|
569
|
+
import { z as z9 } from "zod";
|
|
493
570
|
|
|
494
571
|
// src/tools/confirm.ts
|
|
495
572
|
function needsConfirmation(confirm, ctx) {
|
|
@@ -510,11 +587,11 @@ function requireConfirmation(confirm, ctx, costNote) {
|
|
|
510
587
|
|
|
511
588
|
// src/tools/create-rank-radar.ts
|
|
512
589
|
var PATH = "/v1/niches/rank-radars";
|
|
513
|
-
var
|
|
514
|
-
asin:
|
|
515
|
-
numberOfKeywords:
|
|
516
|
-
nicheId:
|
|
517
|
-
confirm:
|
|
590
|
+
var inputSchema10 = {
|
|
591
|
+
asin: z9.string().min(1).describe("The ASIN to track keyword rankings for."),
|
|
592
|
+
numberOfKeywords: z9.number().int().min(1).describe("How many keywords to track (minimum 1). More keywords = broader tracking but more Search Term tokens."),
|
|
593
|
+
nicheId: z9.string().min(1).describe("The niche this Rank Radar belongs to. Get one from `list_niches`."),
|
|
594
|
+
confirm: z9.boolean().optional().describe(
|
|
518
595
|
"Must be true to proceed \u2014 creating a Rank Radar spends Search Term tokens. Confirm the cost with the user first."
|
|
519
596
|
)
|
|
520
597
|
};
|
|
@@ -522,7 +599,7 @@ var createRankRadarTool = {
|
|
|
522
599
|
name: "create_rank_radar",
|
|
523
600
|
title: "Create a Rank Radar",
|
|
524
601
|
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`.",
|
|
525
|
-
inputSchema:
|
|
602
|
+
inputSchema: inputSchema10,
|
|
526
603
|
// destructiveHint is technically "additive" here (this creates a new Rank Radar, it
|
|
527
604
|
// doesn't destroy data), but we flag it destructive so clients prompt before the
|
|
528
605
|
// irreversible token spend. The confirm gate enforces this server-side regardless.
|
|
@@ -547,20 +624,20 @@ var createRankRadarTool = {
|
|
|
547
624
|
};
|
|
548
625
|
|
|
549
626
|
// src/tools/create-niche-dive.ts
|
|
550
|
-
import { z as
|
|
551
|
-
var
|
|
552
|
-
marketplace:
|
|
627
|
+
import { z as z10 } from "zod";
|
|
628
|
+
var inputSchema11 = {
|
|
629
|
+
marketplace: z10.enum(SUPPORTED_MARKETPLACES).describe(
|
|
553
630
|
"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`)."
|
|
554
631
|
),
|
|
555
|
-
asin:
|
|
556
|
-
numberOfCompetitors:
|
|
557
|
-
confirm:
|
|
632
|
+
asin: z10.string().min(1).describe("The seed ASIN to start the dive from (e.g. B08N5WRWNW). Competitors are built around it."),
|
|
633
|
+
numberOfCompetitors: z10.number().int().min(2).describe("How many competitors to analyze (minimum 2). More competitors = deeper niche but more dive tokens."),
|
|
634
|
+
confirm: z10.boolean().optional().describe("Must be true to proceed \u2014 creating a dive spends dive tokens. Confirm the cost with the user first.")
|
|
558
635
|
};
|
|
559
636
|
var createNicheDiveTool = {
|
|
560
637
|
name: "create_niche_dive",
|
|
561
638
|
title: "Create a Niche Dive",
|
|
562
639
|
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).",
|
|
563
|
-
inputSchema:
|
|
640
|
+
inputSchema: inputSchema11,
|
|
564
641
|
// destructiveHint is technically "additive" here (a dive creates a new niche, it
|
|
565
642
|
// doesn't destroy data), but we flag it destructive so clients prompt before the
|
|
566
643
|
// irreversible token spend. The confirm gate enforces this server-side regardless.
|
|
@@ -585,23 +662,23 @@ var createNicheDiveTool = {
|
|
|
585
662
|
};
|
|
586
663
|
|
|
587
664
|
// src/tools/redive-niche.ts
|
|
588
|
-
import { z as
|
|
589
|
-
var
|
|
590
|
-
nicheId:
|
|
591
|
-
mode:
|
|
665
|
+
import { z as z11 } from "zod";
|
|
666
|
+
var inputSchema12 = {
|
|
667
|
+
nicheId: z11.string().min(1).describe("The niche to re-dive. Get one from `list_niches`."),
|
|
668
|
+
mode: z11.enum(["same_competitors", "discover"]).describe(
|
|
592
669
|
"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."
|
|
593
670
|
),
|
|
594
|
-
numberOfCompetitors:
|
|
671
|
+
numberOfCompetitors: z11.number().int().min(2).optional().describe(
|
|
595
672
|
"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."
|
|
596
673
|
),
|
|
597
|
-
heroAsin:
|
|
674
|
+
heroAsin: z11.string().min(1).optional().describe(
|
|
598
675
|
"`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."
|
|
599
676
|
),
|
|
600
|
-
lockedAsins:
|
|
677
|
+
lockedAsins: z11.array(z11.string().min(1)).optional().describe(
|
|
601
678
|
"`discover` mode only. ASINs that must stay in the competitor set regardless of what discovery finds. Cannot exceed `numberOfCompetitors`, and cannot overlap `excludedAsins`."
|
|
602
679
|
),
|
|
603
|
-
excludedAsins:
|
|
604
|
-
confirm:
|
|
680
|
+
excludedAsins: z11.array(z11.string().min(1)).optional().describe("`discover` mode only. ASINs discovery must never select."),
|
|
681
|
+
confirm: z11.boolean().optional().describe(
|
|
605
682
|
"Must be true to proceed \u2014 a re-dive spends dive tokens. Confirm the cost with the user first."
|
|
606
683
|
)
|
|
607
684
|
};
|
|
@@ -609,7 +686,7 @@ var rediveNicheTool = {
|
|
|
609
686
|
name: "redive_niche",
|
|
610
687
|
title: "Re-dive an Existing Niche",
|
|
611
688
|
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.",
|
|
612
|
-
inputSchema:
|
|
689
|
+
inputSchema: inputSchema12,
|
|
613
690
|
// Same reasoning as create_niche_dive: a re-dive is additive rather than destructive, but the
|
|
614
691
|
// irreversible token spend is what clients need to prompt on. The confirm gate enforces it regardless.
|
|
615
692
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
@@ -642,15 +719,15 @@ var rediveNicheTool = {
|
|
|
642
719
|
};
|
|
643
720
|
|
|
644
721
|
// src/tools/get-dive-status.ts
|
|
645
|
-
import { z as
|
|
646
|
-
var
|
|
647
|
-
diveId:
|
|
722
|
+
import { z as z12 } from "zod";
|
|
723
|
+
var inputSchema13 = {
|
|
724
|
+
diveId: z12.string().min(1).describe("The dive identifier returned by `create_niche_dive` or `redive_niche`.")
|
|
648
725
|
};
|
|
649
726
|
var getDiveStatusTool = {
|
|
650
727
|
name: "get_dive_status",
|
|
651
728
|
title: "Get Niche Dive Status",
|
|
652
729
|
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.",
|
|
653
|
-
inputSchema:
|
|
730
|
+
inputSchema: inputSchema13,
|
|
654
731
|
annotations: { readOnlyHint: true },
|
|
655
732
|
handler: async (args, ctx) => {
|
|
656
733
|
return await httpGet(
|
|
@@ -661,10 +738,10 @@ var getDiveStatusTool = {
|
|
|
661
738
|
};
|
|
662
739
|
|
|
663
740
|
// src/tools/delete-niche.ts
|
|
664
|
-
import { z as
|
|
665
|
-
var
|
|
666
|
-
nicheId:
|
|
667
|
-
confirm:
|
|
741
|
+
import { z as z13 } from "zod";
|
|
742
|
+
var inputSchema14 = {
|
|
743
|
+
nicheId: z13.string().min(1).describe("The niche to delete. Get one from `list_niches`."),
|
|
744
|
+
confirm: z13.boolean().optional().describe(
|
|
668
745
|
"Must be true to proceed \u2014 deleting a niche destroys its keywords, competitors and dive history permanently. Confirm with the user first."
|
|
669
746
|
)
|
|
670
747
|
};
|
|
@@ -672,7 +749,7 @@ var deleteNicheTool = {
|
|
|
672
749
|
name: "delete_niche",
|
|
673
750
|
title: "Delete a Niche",
|
|
674
751
|
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).",
|
|
675
|
-
inputSchema:
|
|
752
|
+
inputSchema: inputSchema14,
|
|
676
753
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
677
754
|
handler: async (args, ctx) => {
|
|
678
755
|
const pending = requireConfirmation(
|
|
@@ -690,15 +767,15 @@ var deleteNicheTool = {
|
|
|
690
767
|
};
|
|
691
768
|
|
|
692
769
|
// src/tools/pause-rank-radar.ts
|
|
693
|
-
import { z as
|
|
694
|
-
var
|
|
695
|
-
rankRadarId:
|
|
770
|
+
import { z as z14 } from "zod";
|
|
771
|
+
var inputSchema15 = {
|
|
772
|
+
rankRadarId: z14.string().uuid().describe("The Rank Radar UUID to pause (from `list_rank_radars`).")
|
|
696
773
|
};
|
|
697
774
|
var pauseRankRadarTool = {
|
|
698
775
|
name: "pause_rank_radar",
|
|
699
776
|
title: "Pause a Rank Radar",
|
|
700
777
|
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.",
|
|
701
|
-
inputSchema:
|
|
778
|
+
inputSchema: inputSchema15,
|
|
702
779
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
703
780
|
handler: async (args, ctx) => {
|
|
704
781
|
await httpPost(
|
|
@@ -711,15 +788,15 @@ var pauseRankRadarTool = {
|
|
|
711
788
|
};
|
|
712
789
|
|
|
713
790
|
// src/tools/resume-rank-radar.ts
|
|
714
|
-
import { z as
|
|
715
|
-
var
|
|
716
|
-
rankRadarId:
|
|
791
|
+
import { z as z15 } from "zod";
|
|
792
|
+
var inputSchema16 = {
|
|
793
|
+
rankRadarId: z15.string().uuid().describe("The Rank Radar UUID to resume (from `list_rank_radars`).")
|
|
717
794
|
};
|
|
718
795
|
var resumeRankRadarTool = {
|
|
719
796
|
name: "resume_rank_radar",
|
|
720
797
|
title: "Resume a Paused Rank Radar",
|
|
721
798
|
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.",
|
|
722
|
-
inputSchema:
|
|
799
|
+
inputSchema: inputSchema16,
|
|
723
800
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
724
801
|
handler: async (args, ctx) => {
|
|
725
802
|
await httpPost(
|
|
@@ -732,10 +809,10 @@ var resumeRankRadarTool = {
|
|
|
732
809
|
};
|
|
733
810
|
|
|
734
811
|
// src/tools/delete-rank-radar.ts
|
|
735
|
-
import { z as
|
|
736
|
-
var
|
|
737
|
-
rankRadarId:
|
|
738
|
-
confirm:
|
|
812
|
+
import { z as z16 } from "zod";
|
|
813
|
+
var inputSchema17 = {
|
|
814
|
+
rankRadarId: z16.string().uuid().describe("The Rank Radar UUID to delete (from `list_rank_radars`)."),
|
|
815
|
+
confirm: z16.boolean().optional().describe(
|
|
739
816
|
"Must be true to proceed \u2014 deleting a Rank Radar destroys its ranking history permanently. Confirm with the user first."
|
|
740
817
|
)
|
|
741
818
|
};
|
|
@@ -743,7 +820,7 @@ var deleteRankRadarTool = {
|
|
|
743
820
|
name: "delete_rank_radar",
|
|
744
821
|
title: "Delete a Rank Radar",
|
|
745
822
|
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`.",
|
|
746
|
-
inputSchema:
|
|
823
|
+
inputSchema: inputSchema17,
|
|
747
824
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
748
825
|
handler: async (args, ctx) => {
|
|
749
826
|
const pending = requireConfirmation(
|
|
@@ -761,10 +838,10 @@ var deleteRankRadarTool = {
|
|
|
761
838
|
};
|
|
762
839
|
|
|
763
840
|
// src/tools/add-rank-radar-search-terms.ts
|
|
764
|
-
import { z as
|
|
765
|
-
var
|
|
766
|
-
rankRadarId:
|
|
767
|
-
searchTerms:
|
|
841
|
+
import { z as z17 } from "zod";
|
|
842
|
+
var inputSchema18 = {
|
|
843
|
+
rankRadarId: z17.string().uuid().describe("The Rank Radar UUID to add the search terms to (from `list_rank_radars`)."),
|
|
844
|
+
searchTerms: z17.array(z17.string().min(1)).min(1).max(ADD_SEARCH_TERMS_MAX).describe(
|
|
768
845
|
`The keywords to start tracking, 1\u2013${ADD_SEARCH_TERMS_MAX} per call. Must be unique. Amazon-ignored special characters (@, #, _, parentheses, \u2026) are rejected.`
|
|
769
846
|
)
|
|
770
847
|
};
|
|
@@ -772,7 +849,7 @@ var addRankRadarSearchTermsTool = {
|
|
|
772
849
|
name: "add_rank_radar_search_terms",
|
|
773
850
|
title: "Add Search Terms to a Rank Radar",
|
|
774
851
|
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.",
|
|
775
|
-
inputSchema:
|
|
852
|
+
inputSchema: inputSchema18,
|
|
776
853
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
777
854
|
handler: async (args, ctx) => {
|
|
778
855
|
return await httpPost(
|
|
@@ -784,10 +861,10 @@ var addRankRadarSearchTermsTool = {
|
|
|
784
861
|
};
|
|
785
862
|
|
|
786
863
|
// src/tools/pause-rank-radar-search-terms.ts
|
|
787
|
-
import { z as
|
|
788
|
-
var
|
|
789
|
-
rankRadarId:
|
|
790
|
-
rankRadarKeywordIds:
|
|
864
|
+
import { z as z18 } from "zod";
|
|
865
|
+
var inputSchema19 = {
|
|
866
|
+
rankRadarId: z18.string().uuid().describe("The Rank Radar UUID the search terms belong to."),
|
|
867
|
+
rankRadarKeywordIds: z18.array(z18.string().uuid()).min(1).describe(
|
|
791
868
|
"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."
|
|
792
869
|
)
|
|
793
870
|
};
|
|
@@ -795,7 +872,7 @@ var pauseRankRadarSearchTermsTool = {
|
|
|
795
872
|
name: "pause_rank_radar_search_terms",
|
|
796
873
|
title: "Pause Search Terms of a Rank Radar",
|
|
797
874
|
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.",
|
|
798
|
-
inputSchema:
|
|
875
|
+
inputSchema: inputSchema19,
|
|
799
876
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
800
877
|
handler: async (args, ctx) => {
|
|
801
878
|
await httpPost(
|
|
@@ -812,10 +889,10 @@ var pauseRankRadarSearchTermsTool = {
|
|
|
812
889
|
};
|
|
813
890
|
|
|
814
891
|
// src/tools/resume-rank-radar-search-terms.ts
|
|
815
|
-
import { z as
|
|
816
|
-
var
|
|
817
|
-
rankRadarId:
|
|
818
|
-
rankRadarKeywordIds:
|
|
892
|
+
import { z as z19 } from "zod";
|
|
893
|
+
var inputSchema20 = {
|
|
894
|
+
rankRadarId: z19.string().uuid().describe("The Rank Radar UUID the search terms belong to."),
|
|
895
|
+
rankRadarKeywordIds: z19.array(z19.string().uuid()).min(1).describe(
|
|
819
896
|
"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."
|
|
820
897
|
)
|
|
821
898
|
};
|
|
@@ -823,7 +900,7 @@ var resumeRankRadarSearchTermsTool = {
|
|
|
823
900
|
name: "resume_rank_radar_search_terms",
|
|
824
901
|
title: "Resume Paused Search Terms of a Rank Radar",
|
|
825
902
|
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.",
|
|
826
|
-
inputSchema:
|
|
903
|
+
inputSchema: inputSchema20,
|
|
827
904
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
828
905
|
handler: async (args, ctx) => {
|
|
829
906
|
await httpPost(
|
|
@@ -840,16 +917,16 @@ var resumeRankRadarSearchTermsTool = {
|
|
|
840
917
|
};
|
|
841
918
|
|
|
842
919
|
// src/tools/generate-listing-copy.ts
|
|
843
|
-
import { z as
|
|
844
|
-
var
|
|
845
|
-
nicheId:
|
|
846
|
-
strategy:
|
|
920
|
+
import { z as z20 } from "zod";
|
|
921
|
+
var inputSchema21 = {
|
|
922
|
+
nicheId: z20.string().min(1).describe("The niche whose keyword data the copy is written from. Get one from `list_niches`."),
|
|
923
|
+
strategy: z20.enum(LISTING_COPY_STRATEGIES).describe(
|
|
847
924
|
"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."
|
|
848
925
|
),
|
|
849
|
-
currentListing:
|
|
926
|
+
currentListing: z20.record(z20.union([z20.string(), z20.array(z20.string())])).describe(
|
|
850
927
|
'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.'
|
|
851
928
|
),
|
|
852
|
-
confirm:
|
|
929
|
+
confirm: z20.boolean().optional().describe(
|
|
853
930
|
"Must be true to proceed \u2014 each generation spends one AI Copywriter prompt from the quota. Confirm the cost with the user first."
|
|
854
931
|
)
|
|
855
932
|
};
|
|
@@ -857,7 +934,7 @@ var generateListingCopyTool = {
|
|
|
857
934
|
name: "generate_listing_copy",
|
|
858
935
|
title: "Generate Listing Copy for a Niche",
|
|
859
936
|
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`.",
|
|
860
|
-
inputSchema:
|
|
937
|
+
inputSchema: inputSchema21,
|
|
861
938
|
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
862
939
|
handler: async (args, ctx) => {
|
|
863
940
|
const pending = requireConfirmation(
|
|
@@ -875,16 +952,16 @@ var generateListingCopyTool = {
|
|
|
875
952
|
};
|
|
876
953
|
|
|
877
954
|
// src/tools/get-listing-copy-generation-status.ts
|
|
878
|
-
import { z as
|
|
879
|
-
var
|
|
880
|
-
nicheId:
|
|
881
|
-
generationId:
|
|
955
|
+
import { z as z21 } from "zod";
|
|
956
|
+
var inputSchema22 = {
|
|
957
|
+
nicheId: z21.string().min(1).describe("The niche the generation was started for."),
|
|
958
|
+
generationId: z21.string().min(1).describe("The `generationId` returned by `generate_listing_copy`.")
|
|
882
959
|
};
|
|
883
960
|
var getListingCopyGenerationStatusTool = {
|
|
884
961
|
name: "get_listing_copy_generation_status",
|
|
885
962
|
title: "Get Listing Copy Generation Status",
|
|
886
963
|
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`.",
|
|
887
|
-
inputSchema:
|
|
964
|
+
inputSchema: inputSchema22,
|
|
888
965
|
annotations: { readOnlyHint: true },
|
|
889
966
|
handler: async (args, ctx) => {
|
|
890
967
|
return await httpGet(
|
|
@@ -895,16 +972,16 @@ var getListingCopyGenerationStatusTool = {
|
|
|
895
972
|
};
|
|
896
973
|
|
|
897
974
|
// src/tools/list-seller-profiles.ts
|
|
898
|
-
import { z as
|
|
899
|
-
var
|
|
900
|
-
currentPage:
|
|
901
|
-
pageSize:
|
|
975
|
+
import { z as z22 } from "zod";
|
|
976
|
+
var inputSchema23 = {
|
|
977
|
+
currentPage: z22.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
978
|
+
pageSize: z22.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
902
979
|
};
|
|
903
980
|
var listSellerProfilesTool = {
|
|
904
981
|
name: "list_seller_profiles",
|
|
905
982
|
title: "List Connected Amazon Seller Profiles",
|
|
906
983
|
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).',
|
|
907
|
-
inputSchema:
|
|
984
|
+
inputSchema: inputSchema23,
|
|
908
985
|
annotations: { readOnlyHint: true },
|
|
909
986
|
handler: async (args, ctx) => {
|
|
910
987
|
return await httpGet(
|
|
@@ -919,15 +996,15 @@ var listSellerProfilesTool = {
|
|
|
919
996
|
};
|
|
920
997
|
|
|
921
998
|
// src/tools/get-seller-catalog.ts
|
|
922
|
-
import { z as
|
|
999
|
+
import { z as z24 } from "zod";
|
|
923
1000
|
|
|
924
1001
|
// src/tools/seller-scoped.ts
|
|
925
|
-
import { z as
|
|
1002
|
+
import { z as z23 } from "zod";
|
|
926
1003
|
var sellerScopedInputSchema = {
|
|
927
|
-
sellerId:
|
|
1004
|
+
sellerId: z23.string().min(1).describe(
|
|
928
1005
|
"Amazon seller account ID. Get it from `list_seller_profiles`, or find it on the Connections page at https://2.datadive.tools."
|
|
929
1006
|
),
|
|
930
|
-
marketplace:
|
|
1007
|
+
marketplace: z23.enum(SUPPORTED_MARKETPLACES).describe('Amazon marketplace code, e.g. "com" for amazon.com or "co.uk" for amazon.co.uk.')
|
|
931
1008
|
};
|
|
932
1009
|
function sellerMarketplacePath(sellerId, marketplace, suffix) {
|
|
933
1010
|
return `/v1/seller_profiles/${encodeURIComponent(sellerId)}/marketplaces/${encodeURIComponent(
|
|
@@ -936,19 +1013,19 @@ function sellerMarketplacePath(sellerId, marketplace, suffix) {
|
|
|
936
1013
|
}
|
|
937
1014
|
|
|
938
1015
|
// src/tools/get-seller-catalog.ts
|
|
939
|
-
var
|
|
1016
|
+
var inputSchema24 = {
|
|
940
1017
|
...sellerScopedInputSchema,
|
|
941
|
-
search:
|
|
942
|
-
brand:
|
|
943
|
-
status:
|
|
944
|
-
currentPage:
|
|
945
|
-
pageSize:
|
|
1018
|
+
search: z24.string().min(1).optional().describe("Case-insensitive partial match on product title or brand."),
|
|
1019
|
+
brand: z24.string().min(1).optional().describe("Case-insensitive partial match on brand name."),
|
|
1020
|
+
status: z24.enum(CATALOG_STATUSES).optional().describe('Listing status filter. "Active" (default) or "all".'),
|
|
1021
|
+
currentPage: z24.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1022
|
+
pageSize: z24.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
946
1023
|
};
|
|
947
1024
|
var getSellerCatalogTool = {
|
|
948
1025
|
name: "get_seller_catalog",
|
|
949
1026
|
title: "List Catalog ASINs for a Seller",
|
|
950
1027
|
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).",
|
|
951
|
-
inputSchema:
|
|
1028
|
+
inputSchema: inputSchema24,
|
|
952
1029
|
annotations: { readOnlyHint: true },
|
|
953
1030
|
handler: async (args, ctx) => {
|
|
954
1031
|
return await httpGet(
|
|
@@ -966,28 +1043,28 @@ var getSellerCatalogTool = {
|
|
|
966
1043
|
};
|
|
967
1044
|
|
|
968
1045
|
// src/tools/get-seller-listing-changes.ts
|
|
969
|
-
import { z as
|
|
970
|
-
var
|
|
1046
|
+
import { z as z25 } from "zod";
|
|
1047
|
+
var inputSchema25 = {
|
|
971
1048
|
...sellerScopedInputSchema,
|
|
972
|
-
types:
|
|
973
|
-
asin:
|
|
974
|
-
brand:
|
|
975
|
-
search:
|
|
976
|
-
startDate:
|
|
977
|
-
endDate:
|
|
978
|
-
sortBy:
|
|
979
|
-
sortOrder:
|
|
980
|
-
includeCorrelations:
|
|
1049
|
+
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".'),
|
|
1050
|
+
asin: z25.string().min(1).optional().describe("Filter to an exact ASIN or parent ASIN."),
|
|
1051
|
+
brand: z25.string().min(1).optional().describe("Case-insensitive partial match on brand name."),
|
|
1052
|
+
search: z25.string().min(1).optional().describe("Case-insensitive partial match on product title or brand."),
|
|
1053
|
+
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."),
|
|
1054
|
+
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."),
|
|
1055
|
+
sortBy: z25.enum(LISTING_CHANGE_SORT_BY).optional().describe('Sort field. "date" (default) or "type".'),
|
|
1056
|
+
sortOrder: z25.enum(SORT_ORDER).optional().describe('Sort direction. "DESC" (default) or "ASC".'),
|
|
1057
|
+
includeCorrelations: z25.boolean().optional().describe(
|
|
981
1058
|
"When true, include the ranking/conversion `correlation` object per change (CVR and search-term movement before vs after). Defaults to false."
|
|
982
1059
|
),
|
|
983
|
-
currentPage:
|
|
984
|
-
pageSize:
|
|
1060
|
+
currentPage: z25.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1061
|
+
pageSize: z25.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
985
1062
|
};
|
|
986
1063
|
var getSellerListingChangesTool = {
|
|
987
1064
|
name: "get_seller_listing_changes",
|
|
988
1065
|
title: "List Listing Changes for a Seller",
|
|
989
1066
|
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).",
|
|
990
|
-
inputSchema:
|
|
1067
|
+
inputSchema: inputSchema25,
|
|
991
1068
|
annotations: { readOnlyHint: true },
|
|
992
1069
|
handler: async (args, ctx) => {
|
|
993
1070
|
return await httpGet(
|
|
@@ -1011,14 +1088,78 @@ var getSellerListingChangesTool = {
|
|
|
1011
1088
|
}
|
|
1012
1089
|
};
|
|
1013
1090
|
|
|
1091
|
+
// src/tools/list-ppc-campaigns.ts
|
|
1092
|
+
import { z as z26 } from "zod";
|
|
1093
|
+
var PPC_CAMPAIGNS_MAX_WINDOW_DAYS = 90;
|
|
1094
|
+
var PPC_CAMPAIGNS_MAX_PAGE_SIZE = 50;
|
|
1095
|
+
var inputSchema26 = {
|
|
1096
|
+
...sellerScopedInputSchema,
|
|
1097
|
+
startDate: z26.string().regex(
|
|
1098
|
+
ISO_8601,
|
|
1099
|
+
"startDate must be an ISO-8601 date or timestamp (e.g. 2026-05-01 or 2026-05-01T00:00:00Z)"
|
|
1100
|
+
).optional().describe("Start of the reporting window, ISO-8601. Defaults to 30 days before endDate."),
|
|
1101
|
+
endDate: z26.string().regex(
|
|
1102
|
+
ISO_8601,
|
|
1103
|
+
"endDate must be an ISO-8601 date or timestamp (e.g. 2026-05-31 or 2026-05-31T23:59:59Z)"
|
|
1104
|
+
).optional().describe(
|
|
1105
|
+
`End of the reporting window, ISO-8601. Defaults to now. At most ${PPC_CAMPAIGNS_MAX_WINDOW_DAYS} days after startDate.`
|
|
1106
|
+
),
|
|
1107
|
+
asin: z26.string().min(1).optional().describe("Only campaigns advertising this ASIN. Cannot be combined with parentAsin."),
|
|
1108
|
+
parentAsin: z26.string().min(1).optional().describe("Only campaigns advertising any ASIN of this variation family. Cannot be combined with asin."),
|
|
1109
|
+
search: z26.string().min(3).max(200).optional().describe("Partial match on campaign name or advertised ASIN. At least 3 characters."),
|
|
1110
|
+
includePlacements: z26.boolean().optional().describe(
|
|
1111
|
+
"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."
|
|
1112
|
+
),
|
|
1113
|
+
sortBy: z26.enum([...PPC_CAMPAIGN_BASE_SORT_BY, ...PPC_CAMPAIGN_PLACEMENT_SORT_BY]).optional().describe(
|
|
1114
|
+
`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.`
|
|
1115
|
+
),
|
|
1116
|
+
sortOrder: z26.enum(SORT_ORDER).optional().describe('Sort direction. "ASC" (default) or "DESC".'),
|
|
1117
|
+
state: z26.enum(PPC_CAMPAIGN_STATES).optional().describe("Only ENABLED or only PAUSED campaigns. Omit for both."),
|
|
1118
|
+
currentPage: z26.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1119
|
+
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.`)
|
|
1120
|
+
};
|
|
1121
|
+
var listPpcCampaignsTool = {
|
|
1122
|
+
name: "list_ppc_campaigns",
|
|
1123
|
+
title: "List PPC Campaigns for a Seller",
|
|
1124
|
+
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\`.`,
|
|
1125
|
+
inputSchema: inputSchema26,
|
|
1126
|
+
annotations: { readOnlyHint: true },
|
|
1127
|
+
handler: async (args, ctx) => {
|
|
1128
|
+
if (args.asin && args.parentAsin) {
|
|
1129
|
+
throw new ApiError(
|
|
1130
|
+
"bad_request",
|
|
1131
|
+
400,
|
|
1132
|
+
"Pass either `asin` (one product) or `parentAsin` (its whole variation family), not both."
|
|
1133
|
+
);
|
|
1134
|
+
}
|
|
1135
|
+
return await httpGet(
|
|
1136
|
+
{ config: ctx.config, toolName: "list_ppc_campaigns" },
|
|
1137
|
+
sellerMarketplacePath(args.sellerId, args.marketplace, "ppc/campaigns"),
|
|
1138
|
+
{
|
|
1139
|
+
startDate: args.startDate,
|
|
1140
|
+
endDate: args.endDate,
|
|
1141
|
+
asin: args.asin,
|
|
1142
|
+
parentAsin: args.parentAsin,
|
|
1143
|
+
search: args.search,
|
|
1144
|
+
includePlacements: args.includePlacements,
|
|
1145
|
+
sortBy: args.sortBy,
|
|
1146
|
+
sortOrder: args.sortOrder,
|
|
1147
|
+
state: args.state,
|
|
1148
|
+
currentPage: args.currentPage,
|
|
1149
|
+
pageSize: args.pageSize
|
|
1150
|
+
}
|
|
1151
|
+
);
|
|
1152
|
+
}
|
|
1153
|
+
};
|
|
1154
|
+
|
|
1014
1155
|
// src/tools/get-asin-inventory-distribution.ts
|
|
1015
|
-
import { z as
|
|
1016
|
-
var
|
|
1017
|
-
sellerId:
|
|
1156
|
+
import { z as z27 } from "zod";
|
|
1157
|
+
var inputSchema27 = {
|
|
1158
|
+
sellerId: z27.string().min(1).describe(
|
|
1018
1159
|
"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."
|
|
1019
1160
|
),
|
|
1020
|
-
marketplace:
|
|
1021
|
-
asin:
|
|
1161
|
+
marketplace: z27.enum(SUPPORTED_MARKETPLACES).describe('Amazon marketplace code, e.g. "com" for amazon.com or "co.uk" for amazon.co.uk.'),
|
|
1162
|
+
asin: z27.string().regex(/^[A-Z0-9]{10}$/, "ASIN must be 10 uppercase alphanumeric characters (e.g. B08XYZ1234).").describe(
|
|
1022
1163
|
"Amazon Standard Identification Number (10 uppercase alphanumeric characters, e.g. B08XYZ1234)."
|
|
1023
1164
|
)
|
|
1024
1165
|
};
|
|
@@ -1026,7 +1167,7 @@ var getAsinInventoryDistributionTool = {
|
|
|
1026
1167
|
name: "get_asin_inventory_distribution",
|
|
1027
1168
|
title: "Get Per-Fulfillment-Center Inventory Distribution for an ASIN",
|
|
1028
1169
|
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.",
|
|
1029
|
-
inputSchema:
|
|
1170
|
+
inputSchema: inputSchema27,
|
|
1030
1171
|
annotations: { readOnlyHint: true },
|
|
1031
1172
|
handler: async (args, ctx) => {
|
|
1032
1173
|
return await httpGet(
|
|
@@ -1039,18 +1180,18 @@ var getAsinInventoryDistributionTool = {
|
|
|
1039
1180
|
};
|
|
1040
1181
|
|
|
1041
1182
|
// src/tools/alert-query.ts
|
|
1042
|
-
import { z as
|
|
1183
|
+
import { z as z28 } from "zod";
|
|
1043
1184
|
var alertsQueryInputSchema = {
|
|
1044
|
-
sellerId:
|
|
1045
|
-
marketplace:
|
|
1046
|
-
status:
|
|
1185
|
+
sellerId: z28.string().min(1).max(50).optional().describe('Filter to a single connected Amazon seller account ID, e.g. "A1B2C3D4E5".'),
|
|
1186
|
+
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.'),
|
|
1187
|
+
status: z28.enum(ALERT_STATUSES).optional().describe(
|
|
1047
1188
|
"Lifecycle filter. `active` (default) returns unresolved alerts, `resolved` returns resolved alerts, `all` returns both. Dismissed alerts are never returned."
|
|
1048
1189
|
),
|
|
1049
|
-
updatedSince:
|
|
1190
|
+
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(
|
|
1050
1191
|
"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."
|
|
1051
1192
|
),
|
|
1052
|
-
currentPage:
|
|
1053
|
-
pageSize:
|
|
1193
|
+
currentPage: z28.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1194
|
+
pageSize: z28.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
1054
1195
|
};
|
|
1055
1196
|
|
|
1056
1197
|
// src/tools/list-indexing-issue-alerts.ts
|
|
@@ -1100,12 +1241,12 @@ var listBlindSpendAlertsTool = {
|
|
|
1100
1241
|
};
|
|
1101
1242
|
|
|
1102
1243
|
// src/tools/get-quota.ts
|
|
1103
|
-
var
|
|
1244
|
+
var inputSchema28 = {};
|
|
1104
1245
|
var getQuotaTool = {
|
|
1105
1246
|
name: "get_quota",
|
|
1106
1247
|
title: "Get Quota Usage",
|
|
1107
1248
|
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.",
|
|
1108
|
-
inputSchema:
|
|
1249
|
+
inputSchema: inputSchema28,
|
|
1109
1250
|
annotations: { readOnlyHint: true },
|
|
1110
1251
|
handler: async (_args, ctx) => {
|
|
1111
1252
|
return await httpGet({ config: ctx.config, toolName: "get_quota" }, "/v1/quota");
|
|
@@ -1113,20 +1254,20 @@ var getQuotaTool = {
|
|
|
1113
1254
|
};
|
|
1114
1255
|
|
|
1115
1256
|
// src/tools/list-usage.ts
|
|
1116
|
-
import { z as
|
|
1117
|
-
var
|
|
1118
|
-
type:
|
|
1119
|
-
search:
|
|
1120
|
-
startDate:
|
|
1121
|
-
endDate:
|
|
1122
|
-
currentPage:
|
|
1123
|
-
pageSize:
|
|
1257
|
+
import { z as z29 } from "zod";
|
|
1258
|
+
var inputSchema29 = {
|
|
1259
|
+
type: z29.enum(BILLABLE_FEATURE_TYPES).optional().describe("Filter to a single billable feature type. Omit to return all types."),
|
|
1260
|
+
search: z29.string().min(1).optional().describe("Case-insensitive partial match on the user's name or email."),
|
|
1261
|
+
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."),
|
|
1262
|
+
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."),
|
|
1263
|
+
currentPage: z29.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1264
|
+
pageSize: z29.number().int().min(1).max(200).optional().describe("Items per page (max 200). Defaults to 50.")
|
|
1124
1265
|
};
|
|
1125
1266
|
var listUsageTool = {
|
|
1126
1267
|
name: "list_usage",
|
|
1127
1268
|
title: "List Billable Usage Logs",
|
|
1128
1269
|
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).",
|
|
1129
|
-
inputSchema:
|
|
1270
|
+
inputSchema: inputSchema29,
|
|
1130
1271
|
annotations: { readOnlyHint: true },
|
|
1131
1272
|
handler: async (args, ctx) => {
|
|
1132
1273
|
return await httpGet(
|
|
@@ -1153,6 +1294,8 @@ var allTools = [
|
|
|
1153
1294
|
getRankingJuiceTool,
|
|
1154
1295
|
listRankRadarsTool,
|
|
1155
1296
|
getRankRadarDataTool,
|
|
1297
|
+
getRankRadarSqpDataTool,
|
|
1298
|
+
getRankRadarPpcDataTool,
|
|
1156
1299
|
createRankRadarTool,
|
|
1157
1300
|
createNicheDiveTool,
|
|
1158
1301
|
rediveNicheTool,
|
|
@@ -1169,6 +1312,7 @@ var allTools = [
|
|
|
1169
1312
|
listSellerProfilesTool,
|
|
1170
1313
|
getSellerCatalogTool,
|
|
1171
1314
|
getSellerListingChangesTool,
|
|
1315
|
+
listPpcCampaignsTool,
|
|
1172
1316
|
getAsinInventoryDistributionTool,
|
|
1173
1317
|
listIndexingIssueAlertsTool,
|
|
1174
1318
|
listBlindSpendAlertsTool,
|
|
@@ -1176,15 +1320,80 @@ var allTools = [
|
|
|
1176
1320
|
listUsageTool
|
|
1177
1321
|
];
|
|
1178
1322
|
|
|
1323
|
+
// src/whats-new.ts
|
|
1324
|
+
var WHATS_NEW = [
|
|
1325
|
+
{
|
|
1326
|
+
version: "0.15.0",
|
|
1327
|
+
released: "2026-09-28",
|
|
1328
|
+
items: [
|
|
1329
|
+
"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.",
|
|
1330
|
+
"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.",
|
|
1331
|
+
"Your Sponsored Products campaigns (`list_ppc_campaigns`): totals and placement performance per campaign, sortable by any metric, e.g. the top spenders first."
|
|
1332
|
+
]
|
|
1333
|
+
},
|
|
1334
|
+
{
|
|
1335
|
+
version: "0.14.0",
|
|
1336
|
+
released: "2026-09-25",
|
|
1337
|
+
items: [
|
|
1338
|
+
"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."
|
|
1339
|
+
]
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
version: "0.13.0",
|
|
1343
|
+
released: "2026-09-09",
|
|
1344
|
+
items: [
|
|
1345
|
+
"Before creating a Rank Radar, you are warned when the same product family is already tracked by another of your Rank Radars."
|
|
1346
|
+
]
|
|
1347
|
+
},
|
|
1348
|
+
{
|
|
1349
|
+
version: "0.12.0",
|
|
1350
|
+
released: "2026-09-07",
|
|
1351
|
+
items: ["Search and sort your niches by name, hero keyword or ASIN (`list_niches`)."]
|
|
1352
|
+
}
|
|
1353
|
+
];
|
|
1354
|
+
var INSTRUCTIONS_RELEASES = 2;
|
|
1355
|
+
function formatEntries(entries) {
|
|
1356
|
+
return entries.map((e) => `${e.released} (v${e.version}):
|
|
1357
|
+
${e.items.map((i) => `- ${i}`).join("\n")}`).join("\n\n");
|
|
1358
|
+
}
|
|
1359
|
+
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.
|
|
1360
|
+
|
|
1361
|
+
Recently added:
|
|
1362
|
+
${formatEntries(WHATS_NEW.slice(0, INSTRUCTIONS_RELEASES))}
|
|
1363
|
+
|
|
1364
|
+
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.`;
|
|
1365
|
+
var WHATS_NEW_PROMPT = {
|
|
1366
|
+
name: "whats_new",
|
|
1367
|
+
title: "What's new in DataDive",
|
|
1368
|
+
description: "Recent additions to the DataDive tools, newest first."
|
|
1369
|
+
};
|
|
1370
|
+
function whatsNewPromptText() {
|
|
1371
|
+
return `Here is what is new in the DataDive tools, newest first:
|
|
1372
|
+
|
|
1373
|
+
${formatEntries(WHATS_NEW)}
|
|
1374
|
+
|
|
1375
|
+
Summarize this for me in a few short lines, and for each addition give one example question I could ask you.`;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1179
1378
|
// src/server.ts
|
|
1180
1379
|
function requiredScope(tool) {
|
|
1181
1380
|
return tool.annotations?.readOnlyHint === true ? SCOPE_READ : SCOPE_WRITE;
|
|
1182
1381
|
}
|
|
1183
1382
|
function buildServer(config) {
|
|
1184
|
-
const server = new McpServer(
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1383
|
+
const server = new McpServer(
|
|
1384
|
+
{
|
|
1385
|
+
name: "datadive",
|
|
1386
|
+
version: PKG_VERSION
|
|
1387
|
+
},
|
|
1388
|
+
{ instructions: SERVER_INSTRUCTIONS }
|
|
1389
|
+
);
|
|
1390
|
+
server.registerPrompt(
|
|
1391
|
+
WHATS_NEW_PROMPT.name,
|
|
1392
|
+
{ title: WHATS_NEW_PROMPT.title, description: WHATS_NEW_PROMPT.description },
|
|
1393
|
+
() => ({
|
|
1394
|
+
messages: [{ role: "user", content: { type: "text", text: whatsNewPromptText() } }]
|
|
1395
|
+
})
|
|
1396
|
+
);
|
|
1188
1397
|
for (const tool of allTools) {
|
|
1189
1398
|
server.registerTool(
|
|
1190
1399
|
tool.name,
|
|
@@ -1244,9 +1453,13 @@ export {
|
|
|
1244
1453
|
PKG_VERSION,
|
|
1245
1454
|
SCOPE_READ,
|
|
1246
1455
|
SCOPE_WRITE,
|
|
1456
|
+
SERVER_INSTRUCTIONS,
|
|
1457
|
+
WHATS_NEW,
|
|
1458
|
+
WHATS_NEW_PROMPT,
|
|
1247
1459
|
allTools,
|
|
1248
1460
|
buildServer,
|
|
1249
1461
|
loadConfig,
|
|
1250
|
-
requiredScope
|
|
1462
|
+
requiredScope,
|
|
1463
|
+
whatsNewPromptText
|
|
1251
1464
|
};
|
|
1252
1465
|
//# sourceMappingURL=lib.js.map
|