@datadive-tools/mcp 0.10.0 → 0.12.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 +37 -16
- package/dist/index.js +371 -63
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +29 -5
- package/dist/lib.js +371 -63
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,6 +31,13 @@ import { z } from "zod";
|
|
|
31
31
|
|
|
32
32
|
// src/http/errors.ts
|
|
33
33
|
var KEY_HELP_URL2 = "https://2.datadive.tools/api-key";
|
|
34
|
+
var FEATURE_LABELS = {
|
|
35
|
+
DIVED_ASINS: "Dive tokens",
|
|
36
|
+
RANK_RADAR_KEYWORDS: "Rank Radar tracked keywords",
|
|
37
|
+
PRODUCT_BRIEF_ASINS: "Product Brief ASINs",
|
|
38
|
+
AI_COPYWRITER_PROMPTS: "AI Copywriter prompts",
|
|
39
|
+
INDEXING_DIAGNOSIS: "Indexing Diagnosis checks"
|
|
40
|
+
};
|
|
34
41
|
var ApiError = class _ApiError extends Error {
|
|
35
42
|
kind;
|
|
36
43
|
status;
|
|
@@ -43,6 +50,9 @@ var ApiError = class _ApiError extends Error {
|
|
|
43
50
|
this.body = body;
|
|
44
51
|
}
|
|
45
52
|
static fromHttp(status, body) {
|
|
53
|
+
if (isQuotaExceededBody(body)) {
|
|
54
|
+
return new _ApiError("quota", status, quotaExceededMessage(body), body);
|
|
55
|
+
}
|
|
46
56
|
const serverMsg = extractMessage(body);
|
|
47
57
|
if (status === 400) {
|
|
48
58
|
return new _ApiError(
|
|
@@ -93,6 +103,35 @@ var ApiError = class _ApiError extends Error {
|
|
|
93
103
|
return new _ApiError("http", status, serverMsg ?? `HTTP ${status}`, body);
|
|
94
104
|
}
|
|
95
105
|
};
|
|
106
|
+
function isQuotaExceededBody(body) {
|
|
107
|
+
if (!body || typeof body !== "object") return false;
|
|
108
|
+
const b = body;
|
|
109
|
+
return b.error === "QUOTA_EXCEEDED" && typeof b.subscriptionUrl === "string";
|
|
110
|
+
}
|
|
111
|
+
function quotaExceededMessage(body) {
|
|
112
|
+
const lead = typeof body.message === "string" && body.message.length > 0 ? body.message : "Quota exceeded";
|
|
113
|
+
const feature = body.feature ? FEATURE_LABELS[body.feature] ?? body.feature : null;
|
|
114
|
+
const parts = [];
|
|
115
|
+
if (feature) {
|
|
116
|
+
parts.push(`This subscription has used up its ${feature} quota${usageSuffix(body)}.`);
|
|
117
|
+
} else {
|
|
118
|
+
parts.push(`This subscription has used up its quota for this action${usageSuffix(body)}.`);
|
|
119
|
+
}
|
|
120
|
+
if (body.nextRefreshDate) {
|
|
121
|
+
parts.push(`It refreshes on ${body.nextRefreshDate.slice(0, 10)}.`);
|
|
122
|
+
}
|
|
123
|
+
parts.push(
|
|
124
|
+
`Tell the user which quota ran out and that they can review or raise it on their subscription page: ${body.subscriptionUrl}`
|
|
125
|
+
);
|
|
126
|
+
parts.push("Do not retry this call until the quota has been raised.");
|
|
127
|
+
return `${lead}. ${parts.join(" ")}`;
|
|
128
|
+
}
|
|
129
|
+
function usageSuffix(body) {
|
|
130
|
+
if (typeof body.used === "number" && typeof body.capacity === "number") {
|
|
131
|
+
return ` (${body.used} of ${body.capacity} used)`;
|
|
132
|
+
}
|
|
133
|
+
return "";
|
|
134
|
+
}
|
|
96
135
|
function extractMessage(body) {
|
|
97
136
|
if (!body || typeof body !== "object") return null;
|
|
98
137
|
const b = body;
|
|
@@ -105,7 +144,7 @@ function extractMessage(body) {
|
|
|
105
144
|
}
|
|
106
145
|
|
|
107
146
|
// package.json
|
|
108
|
-
var version = "0.
|
|
147
|
+
var version = "0.12.0";
|
|
109
148
|
|
|
110
149
|
// src/http/client.ts
|
|
111
150
|
var PKG_VERSION = version;
|
|
@@ -173,6 +212,23 @@ async function httpPost(ctx, path, body) {
|
|
|
173
212
|
}
|
|
174
213
|
return handleResponse(res);
|
|
175
214
|
}
|
|
215
|
+
async function httpDelete(ctx, path) {
|
|
216
|
+
const url = buildUrl(ctx.config.baseUrl, path);
|
|
217
|
+
let res;
|
|
218
|
+
try {
|
|
219
|
+
res = await fetch(url, {
|
|
220
|
+
method: "DELETE",
|
|
221
|
+
headers: {
|
|
222
|
+
...authHeaders(ctx.config),
|
|
223
|
+
accept: "application/json",
|
|
224
|
+
"user-agent": userAgent(ctx.toolName)
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
} catch (e) {
|
|
228
|
+
throw networkError(url, e);
|
|
229
|
+
}
|
|
230
|
+
return handleResponse(res);
|
|
231
|
+
}
|
|
176
232
|
function networkError(url, e) {
|
|
177
233
|
const msg = e instanceof Error ? e.message : String(e);
|
|
178
234
|
return new ApiError("network", 0, `Network error reaching ${url}: ${msg}`);
|
|
@@ -303,7 +359,7 @@ var inputSchema4 = {
|
|
|
303
359
|
var getNicheCompetitorsTool = {
|
|
304
360
|
name: "get_niche_competitors",
|
|
305
361
|
title: "Get Competitors and Niche Statistics",
|
|
306
|
-
description: "Use this for competitor ASINs, sales/revenue benchmarks, or niche opportunity scoring. Retrieves the list of Competitors within the specified Niche along with Niche statistics. For the Niche: keyword statistics, opportunity evaluation, benchmark median values, and overall competitor strength assessment. For each Competitor: ASIN, sales, revenue, ratings, reviews, price, image URL, and ranking data.",
|
|
362
|
+
description: "Use this for competitor ASINs, product titles, BSR, sales/revenue benchmarks, or niche opportunity scoring. Retrieves the list of Competitors within the specified Niche along with Niche statistics. For the Niche: keyword statistics, opportunity evaluation, benchmark median values, and overall competitor strength assessment. For each Competitor: ASIN, product title, BSR, category and full category tree, sales, revenue, ratings, reviews, price, number of variations, image URL, total Ranking Juice, and ranking data. BSR supports ranking Competitors by sales position within mentioned category. For the Ranking Juice breakdown by title, bullets and description, use `get_ranking_juice`.",
|
|
307
363
|
inputSchema: inputSchema4,
|
|
308
364
|
annotations: { readOnlyHint: true },
|
|
309
365
|
handler: async (args, ctx) => {
|
|
@@ -350,7 +406,8 @@ var SUPPORTED_MARKETPLACES = [
|
|
|
350
406
|
"it",
|
|
351
407
|
"co.jp"
|
|
352
408
|
];
|
|
353
|
-
var
|
|
409
|
+
var RANK_RADAR_STATES = ["ACTIVE", "PAUSED", "ARCHIVED"];
|
|
410
|
+
var RANK_RADAR_STATUSES = [...RANK_RADAR_STATES, "ALL"];
|
|
354
411
|
var ALERT_STATUSES = ["active", "resolved", "all"];
|
|
355
412
|
var BILLABLE_FEATURE_TYPES = [
|
|
356
413
|
"DIVED_ASINS",
|
|
@@ -362,25 +419,32 @@ var CATALOG_STATUSES = ["Active", "all"];
|
|
|
362
419
|
var LISTING_CHANGE_TYPES = ["Price", "Content", "Image"];
|
|
363
420
|
var LISTING_CHANGE_SORT_BY = ["date", "type"];
|
|
364
421
|
var SORT_ORDER = ["ASC", "DESC"];
|
|
422
|
+
var ADD_SEARCH_TERMS_MAX = 1e3;
|
|
423
|
+
var LISTING_COPY_STRATEGIES = ["cosmo", "ranking-juice", "nlp", "cosmo-rufus"];
|
|
365
424
|
|
|
366
425
|
// src/tools/list-rank-radars.ts
|
|
426
|
+
var LIST_RANK_RADARS_MAX_PAGE_SIZE = 50;
|
|
367
427
|
var inputSchema6 = {
|
|
368
428
|
currentPage: z6.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
369
|
-
pageSize: z6.number().int().min(1).max(
|
|
429
|
+
pageSize: z6.number().int().min(1).max(LIST_RANK_RADARS_MAX_PAGE_SIZE).optional().describe(`Items per page (max ${LIST_RANK_RADARS_MAX_PAGE_SIZE}). Defaults to 20.`),
|
|
370
430
|
nicheId: z6.string().min(1).optional().describe("Filter Rank Radars by Niche identifier. Use after `list_niches`."),
|
|
371
431
|
status: z6.enum(RANK_RADAR_STATUSES).optional().describe(
|
|
372
|
-
"
|
|
432
|
+
"Which Rank Radars to return. ACTIVE (the default) are tracking; PAUSED have been stopped but keep their history and can be resumed; ARCHIVED have been deleted; ALL means active and paused together. Archived Rank Radars are returned only by an explicit ARCHIVED."
|
|
373
433
|
),
|
|
374
434
|
searchText: z6.string().optional().describe("Filter Rank Radars by ASIN or product title.")
|
|
375
435
|
};
|
|
436
|
+
function minimize(item) {
|
|
437
|
+
const { asin, ...rest } = item;
|
|
438
|
+
return { ...rest, asin: asin?.asin };
|
|
439
|
+
}
|
|
376
440
|
var listRankRadarsTool = {
|
|
377
441
|
name: "list_rank_radars",
|
|
378
442
|
title: "List Rank Radars",
|
|
379
|
-
description:
|
|
443
|
+
description: `Use this to find a \`rankRadarId\` before calling \`get_rank_radar_data\`. Filter by \`nicheId\` if the user has already identified a niche. Retrieves a paginated list of Rank Radars \u2014 keyword-rank trackers monitoring organic and sponsored positions for specific ASINs over time. Each item includes id, status (ACTIVE, PAUSED or ARCHIVED), asin, marketplace, keywordCount, title, imageUrl, and summary metrics: top10KW, top10SV, top50KW, top50SV. Supports pagination metadata (currentPage, pageSize, total, lastPage, hasNext, hasPrev); a page holds at most ${LIST_RANK_RADARS_MAX_PAGE_SIZE} Rank Radars, so a large account needs several calls.`,
|
|
380
444
|
inputSchema: inputSchema6,
|
|
381
445
|
annotations: { readOnlyHint: true },
|
|
382
446
|
handler: async (args, ctx) => {
|
|
383
|
-
|
|
447
|
+
const page = await httpGet(
|
|
384
448
|
{ config: ctx.config, toolName: "list_rank_radars" },
|
|
385
449
|
"/v1/niches/rank-radars",
|
|
386
450
|
{
|
|
@@ -391,6 +455,7 @@ var listRankRadarsTool = {
|
|
|
391
455
|
searchText: args.searchText
|
|
392
456
|
}
|
|
393
457
|
);
|
|
458
|
+
return { ...page, data: (page.data ?? []).map(minimize) };
|
|
394
459
|
}
|
|
395
460
|
};
|
|
396
461
|
|
|
@@ -447,7 +512,7 @@ var createRankRadarTool = {
|
|
|
447
512
|
// destructiveHint is technically "additive" here (this creates a new Rank Radar, it
|
|
448
513
|
// doesn't destroy data), but we flag it destructive so clients prompt before the
|
|
449
514
|
// irreversible token spend. The confirm gate enforces this server-side regardless.
|
|
450
|
-
annotations: { readOnlyHint: false, destructiveHint: true },
|
|
515
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
451
516
|
handler: async (args, ctx) => {
|
|
452
517
|
const pending = requireConfirmation(
|
|
453
518
|
args.confirm,
|
|
@@ -485,7 +550,7 @@ var createNicheDiveTool = {
|
|
|
485
550
|
// destructiveHint is technically "additive" here (a dive creates a new niche, it
|
|
486
551
|
// doesn't destroy data), but we flag it destructive so clients prompt before the
|
|
487
552
|
// irreversible token spend. The confirm gate enforces this server-side regardless.
|
|
488
|
-
annotations: { readOnlyHint: false, destructiveHint: true },
|
|
553
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
489
554
|
handler: async (args, ctx) => {
|
|
490
555
|
const pending = requireConfirmation(
|
|
491
556
|
args.confirm,
|
|
@@ -533,7 +598,7 @@ var rediveNicheTool = {
|
|
|
533
598
|
inputSchema: inputSchema10,
|
|
534
599
|
// Same reasoning as create_niche_dive: a re-dive is additive rather than destructive, but the
|
|
535
600
|
// irreversible token spend is what clients need to prompt on. The confirm gate enforces it regardless.
|
|
536
|
-
annotations: { readOnlyHint: false, destructiveHint: true },
|
|
601
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
537
602
|
handler: async (args, ctx) => {
|
|
538
603
|
if (args.mode === "discover" && args.numberOfCompetitors === void 0) {
|
|
539
604
|
throw new ApiError(
|
|
@@ -581,17 +646,251 @@ var getDiveStatusTool = {
|
|
|
581
646
|
}
|
|
582
647
|
};
|
|
583
648
|
|
|
584
|
-
// src/tools/
|
|
649
|
+
// src/tools/delete-niche.ts
|
|
585
650
|
import { z as z12 } from "zod";
|
|
586
651
|
var inputSchema12 = {
|
|
587
|
-
|
|
588
|
-
|
|
652
|
+
nicheId: z12.string().min(1).describe("The niche to delete. Get one from `list_niches`."),
|
|
653
|
+
confirm: z12.boolean().optional().describe(
|
|
654
|
+
"Must be true to proceed \u2014 deleting a niche destroys its keywords, competitors and dive history permanently. Confirm with the user first."
|
|
655
|
+
)
|
|
656
|
+
};
|
|
657
|
+
var deleteNicheTool = {
|
|
658
|
+
name: "delete_niche",
|
|
659
|
+
title: "Delete a Niche",
|
|
660
|
+
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).",
|
|
661
|
+
inputSchema: inputSchema12,
|
|
662
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
663
|
+
handler: async (args, ctx) => {
|
|
664
|
+
const pending = requireConfirmation(
|
|
665
|
+
args.confirm,
|
|
666
|
+
ctx,
|
|
667
|
+
"Deleting this niche removes its keywords, competitors and all dive history permanently. The dive tokens already spent on it are not refunded."
|
|
668
|
+
);
|
|
669
|
+
if (pending) return pending;
|
|
670
|
+
await httpDelete(
|
|
671
|
+
{ config: ctx.config, toolName: "delete_niche" },
|
|
672
|
+
`/v1/niches/${encodeURIComponent(args.nicheId)}`
|
|
673
|
+
);
|
|
674
|
+
return { status: "deleted", nicheId: args.nicheId };
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
// src/tools/pause-rank-radar.ts
|
|
679
|
+
import { z as z13 } from "zod";
|
|
680
|
+
var inputSchema13 = {
|
|
681
|
+
rankRadarId: z13.string().uuid().describe("The Rank Radar UUID to pause (from `list_rank_radars`).")
|
|
682
|
+
};
|
|
683
|
+
var pauseRankRadarTool = {
|
|
684
|
+
name: "pause_rank_radar",
|
|
685
|
+
title: "Pause a Rank Radar",
|
|
686
|
+
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.",
|
|
687
|
+
inputSchema: inputSchema13,
|
|
688
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
689
|
+
handler: async (args, ctx) => {
|
|
690
|
+
await httpPost(
|
|
691
|
+
{ config: ctx.config, toolName: "pause_rank_radar" },
|
|
692
|
+
`/v1/niches/rank-radars/${encodeURIComponent(args.rankRadarId)}/archive`,
|
|
693
|
+
{}
|
|
694
|
+
);
|
|
695
|
+
return { status: "paused", rankRadarId: args.rankRadarId };
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
|
|
699
|
+
// src/tools/resume-rank-radar.ts
|
|
700
|
+
import { z as z14 } from "zod";
|
|
701
|
+
var inputSchema14 = {
|
|
702
|
+
rankRadarId: z14.string().uuid().describe("The Rank Radar UUID to resume (from `list_rank_radars`).")
|
|
703
|
+
};
|
|
704
|
+
var resumeRankRadarTool = {
|
|
705
|
+
name: "resume_rank_radar",
|
|
706
|
+
title: "Resume a Paused Rank Radar",
|
|
707
|
+
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.",
|
|
708
|
+
inputSchema: inputSchema14,
|
|
709
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
710
|
+
handler: async (args, ctx) => {
|
|
711
|
+
await httpPost(
|
|
712
|
+
{ config: ctx.config, toolName: "resume_rank_radar" },
|
|
713
|
+
`/v1/niches/rank-radars/${encodeURIComponent(args.rankRadarId)}/resume`,
|
|
714
|
+
{}
|
|
715
|
+
);
|
|
716
|
+
return { status: "resumed", rankRadarId: args.rankRadarId };
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// src/tools/delete-rank-radar.ts
|
|
721
|
+
import { z as z15 } from "zod";
|
|
722
|
+
var inputSchema15 = {
|
|
723
|
+
rankRadarId: z15.string().uuid().describe("The Rank Radar UUID to delete (from `list_rank_radars`)."),
|
|
724
|
+
confirm: z15.boolean().optional().describe(
|
|
725
|
+
"Must be true to proceed \u2014 deleting a Rank Radar destroys its ranking history permanently. Confirm with the user first."
|
|
726
|
+
)
|
|
727
|
+
};
|
|
728
|
+
var deleteRankRadarTool = {
|
|
729
|
+
name: "delete_rank_radar",
|
|
730
|
+
title: "Delete a Rank Radar",
|
|
731
|
+
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`.",
|
|
732
|
+
inputSchema: inputSchema15,
|
|
733
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
734
|
+
handler: async (args, ctx) => {
|
|
735
|
+
const pending = requireConfirmation(
|
|
736
|
+
args.confirm,
|
|
737
|
+
ctx,
|
|
738
|
+
"Deleting this Rank Radar removes its keyword ranking history permanently. It frees the Daily Tracked Keywords quota, but the history cannot be recovered \u2014 `pause_rank_radar` frees the same quota and is reversible."
|
|
739
|
+
);
|
|
740
|
+
if (pending) return pending;
|
|
741
|
+
await httpDelete(
|
|
742
|
+
{ config: ctx.config, toolName: "delete_rank_radar" },
|
|
743
|
+
`/v1/niches/rank-radars/${encodeURIComponent(args.rankRadarId)}`
|
|
744
|
+
);
|
|
745
|
+
return { status: "deleted", rankRadarId: args.rankRadarId };
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
// src/tools/add-rank-radar-search-terms.ts
|
|
750
|
+
import { z as z16 } from "zod";
|
|
751
|
+
var inputSchema16 = {
|
|
752
|
+
rankRadarId: z16.string().uuid().describe("The Rank Radar UUID to add the search terms to (from `list_rank_radars`)."),
|
|
753
|
+
searchTerms: z16.array(z16.string().min(1)).min(1).max(ADD_SEARCH_TERMS_MAX).describe(
|
|
754
|
+
`The keywords to start tracking, 1\u2013${ADD_SEARCH_TERMS_MAX} per call. Must be unique. Amazon-ignored special characters (@, #, _, parentheses, \u2026) are rejected.`
|
|
755
|
+
)
|
|
756
|
+
};
|
|
757
|
+
var addRankRadarSearchTermsTool = {
|
|
758
|
+
name: "add_rank_radar_search_terms",
|
|
759
|
+
title: "Add Search Terms to a Rank Radar",
|
|
760
|
+
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.",
|
|
761
|
+
inputSchema: inputSchema16,
|
|
762
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
763
|
+
handler: async (args, ctx) => {
|
|
764
|
+
return await httpPost(
|
|
765
|
+
{ config: ctx.config, toolName: "add_rank_radar_search_terms" },
|
|
766
|
+
`/v1/niches/rank-radars/${encodeURIComponent(args.rankRadarId)}/search-terms`,
|
|
767
|
+
{ searchTerms: args.searchTerms }
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
// src/tools/pause-rank-radar-search-terms.ts
|
|
773
|
+
import { z as z17 } from "zod";
|
|
774
|
+
var inputSchema17 = {
|
|
775
|
+
rankRadarId: z17.string().uuid().describe("The Rank Radar UUID the search terms belong to."),
|
|
776
|
+
rankRadarKeywordIds: z17.array(z17.string().uuid()).min(1).describe(
|
|
777
|
+
"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."
|
|
778
|
+
)
|
|
779
|
+
};
|
|
780
|
+
var pauseRankRadarSearchTermsTool = {
|
|
781
|
+
name: "pause_rank_radar_search_terms",
|
|
782
|
+
title: "Pause Search Terms of a Rank Radar",
|
|
783
|
+
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.",
|
|
784
|
+
inputSchema: inputSchema17,
|
|
785
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
786
|
+
handler: async (args, ctx) => {
|
|
787
|
+
await httpPost(
|
|
788
|
+
{ config: ctx.config, toolName: "pause_rank_radar_search_terms" },
|
|
789
|
+
`/v1/niches/rank-radars/${encodeURIComponent(args.rankRadarId)}/search-terms/archive`,
|
|
790
|
+
{ rankRadarKeywordIds: args.rankRadarKeywordIds }
|
|
791
|
+
);
|
|
792
|
+
return {
|
|
793
|
+
status: "paused",
|
|
794
|
+
rankRadarId: args.rankRadarId,
|
|
795
|
+
rankRadarKeywordIds: args.rankRadarKeywordIds
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
// src/tools/resume-rank-radar-search-terms.ts
|
|
801
|
+
import { z as z18 } from "zod";
|
|
802
|
+
var inputSchema18 = {
|
|
803
|
+
rankRadarId: z18.string().uuid().describe("The Rank Radar UUID the search terms belong to."),
|
|
804
|
+
rankRadarKeywordIds: z18.array(z18.string().uuid()).min(1).describe(
|
|
805
|
+
"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."
|
|
806
|
+
)
|
|
807
|
+
};
|
|
808
|
+
var resumeRankRadarSearchTermsTool = {
|
|
809
|
+
name: "resume_rank_radar_search_terms",
|
|
810
|
+
title: "Resume Paused Search Terms of a Rank Radar",
|
|
811
|
+
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.",
|
|
812
|
+
inputSchema: inputSchema18,
|
|
813
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
814
|
+
handler: async (args, ctx) => {
|
|
815
|
+
await httpPost(
|
|
816
|
+
{ config: ctx.config, toolName: "resume_rank_radar_search_terms" },
|
|
817
|
+
`/v1/niches/rank-radars/${encodeURIComponent(args.rankRadarId)}/search-terms/resume`,
|
|
818
|
+
{ rankRadarKeywordIds: args.rankRadarKeywordIds }
|
|
819
|
+
);
|
|
820
|
+
return {
|
|
821
|
+
status: "resumed",
|
|
822
|
+
rankRadarId: args.rankRadarId,
|
|
823
|
+
rankRadarKeywordIds: args.rankRadarKeywordIds
|
|
824
|
+
};
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
// src/tools/generate-listing-copy.ts
|
|
829
|
+
import { z as z19 } from "zod";
|
|
830
|
+
var inputSchema19 = {
|
|
831
|
+
nicheId: z19.string().min(1).describe("The niche whose keyword data the copy is written from. Get one from `list_niches`."),
|
|
832
|
+
strategy: z19.enum(LISTING_COPY_STRATEGIES).describe(
|
|
833
|
+
"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."
|
|
834
|
+
),
|
|
835
|
+
currentListing: z19.record(z19.union([z19.string(), z19.array(z19.string())])).describe(
|
|
836
|
+
'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.'
|
|
837
|
+
),
|
|
838
|
+
confirm: z19.boolean().optional().describe(
|
|
839
|
+
"Must be true to proceed \u2014 each generation spends one AI Copywriter prompt from the quota. Confirm the cost with the user first."
|
|
840
|
+
)
|
|
841
|
+
};
|
|
842
|
+
var generateListingCopyTool = {
|
|
843
|
+
name: "generate_listing_copy",
|
|
844
|
+
title: "Generate Listing Copy for a Niche",
|
|
845
|
+
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`.",
|
|
846
|
+
inputSchema: inputSchema19,
|
|
847
|
+
annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false },
|
|
848
|
+
handler: async (args, ctx) => {
|
|
849
|
+
const pending = requireConfirmation(
|
|
850
|
+
args.confirm,
|
|
851
|
+
ctx,
|
|
852
|
+
"Generating listing copy consumes one AI Copywriter prompt from the organization's quota. Check the remaining balance with `get_quota` if the user needs it."
|
|
853
|
+
);
|
|
854
|
+
if (pending) return pending;
|
|
855
|
+
return await httpPost(
|
|
856
|
+
{ config: ctx.config, toolName: "generate_listing_copy" },
|
|
857
|
+
`/v1/niches/${encodeURIComponent(args.nicheId)}/ai-copywriter`,
|
|
858
|
+
{ prompt: args.strategy, listingToInclude: args.currentListing }
|
|
859
|
+
);
|
|
860
|
+
}
|
|
861
|
+
};
|
|
862
|
+
|
|
863
|
+
// src/tools/get-listing-copy-generation-status.ts
|
|
864
|
+
import { z as z20 } from "zod";
|
|
865
|
+
var inputSchema20 = {
|
|
866
|
+
nicheId: z20.string().min(1).describe("The niche the generation was started for."),
|
|
867
|
+
generationId: z20.string().min(1).describe("The `generationId` returned by `generate_listing_copy`.")
|
|
868
|
+
};
|
|
869
|
+
var getListingCopyGenerationStatusTool = {
|
|
870
|
+
name: "get_listing_copy_generation_status",
|
|
871
|
+
title: "Get Listing Copy Generation Status",
|
|
872
|
+
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`.",
|
|
873
|
+
inputSchema: inputSchema20,
|
|
874
|
+
annotations: { readOnlyHint: true },
|
|
875
|
+
handler: async (args, ctx) => {
|
|
876
|
+
return await httpGet(
|
|
877
|
+
{ config: ctx.config, toolName: "get_listing_copy_generation_status" },
|
|
878
|
+
`/v1/niches/${encodeURIComponent(args.nicheId)}/ai-copywriter/${encodeURIComponent(args.generationId)}`
|
|
879
|
+
);
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
// src/tools/list-seller-profiles.ts
|
|
884
|
+
import { z as z21 } from "zod";
|
|
885
|
+
var inputSchema21 = {
|
|
886
|
+
currentPage: z21.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
887
|
+
pageSize: z21.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
589
888
|
};
|
|
590
889
|
var listSellerProfilesTool = {
|
|
591
890
|
name: "list_seller_profiles",
|
|
592
891
|
title: "List Connected Amazon Seller Profiles",
|
|
593
892
|
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).',
|
|
594
|
-
inputSchema:
|
|
893
|
+
inputSchema: inputSchema21,
|
|
595
894
|
annotations: { readOnlyHint: true },
|
|
596
895
|
handler: async (args, ctx) => {
|
|
597
896
|
return await httpGet(
|
|
@@ -606,15 +905,15 @@ var listSellerProfilesTool = {
|
|
|
606
905
|
};
|
|
607
906
|
|
|
608
907
|
// src/tools/get-seller-catalog.ts
|
|
609
|
-
import { z as
|
|
908
|
+
import { z as z23 } from "zod";
|
|
610
909
|
|
|
611
910
|
// src/tools/seller-scoped.ts
|
|
612
|
-
import { z as
|
|
911
|
+
import { z as z22 } from "zod";
|
|
613
912
|
var sellerScopedInputSchema = {
|
|
614
|
-
sellerId:
|
|
913
|
+
sellerId: z22.string().min(1).describe(
|
|
615
914
|
"Amazon seller account ID. Get it from `list_seller_profiles`, or find it on the Connections page at https://2.datadive.tools."
|
|
616
915
|
),
|
|
617
|
-
marketplace:
|
|
916
|
+
marketplace: z22.enum(SUPPORTED_MARKETPLACES).describe('Amazon marketplace code, e.g. "com" for amazon.com or "co.uk" for amazon.co.uk.')
|
|
618
917
|
};
|
|
619
918
|
function sellerMarketplacePath(sellerId, marketplace, suffix) {
|
|
620
919
|
return `/v1/seller_profiles/${encodeURIComponent(sellerId)}/marketplaces/${encodeURIComponent(
|
|
@@ -623,19 +922,19 @@ function sellerMarketplacePath(sellerId, marketplace, suffix) {
|
|
|
623
922
|
}
|
|
624
923
|
|
|
625
924
|
// src/tools/get-seller-catalog.ts
|
|
626
|
-
var
|
|
925
|
+
var inputSchema22 = {
|
|
627
926
|
...sellerScopedInputSchema,
|
|
628
|
-
search:
|
|
629
|
-
brand:
|
|
630
|
-
status:
|
|
631
|
-
currentPage:
|
|
632
|
-
pageSize:
|
|
927
|
+
search: z23.string().min(1).optional().describe("Case-insensitive partial match on product title or brand."),
|
|
928
|
+
brand: z23.string().min(1).optional().describe("Case-insensitive partial match on brand name."),
|
|
929
|
+
status: z23.enum(CATALOG_STATUSES).optional().describe('Listing status filter. "Active" (default) or "all".'),
|
|
930
|
+
currentPage: z23.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
931
|
+
pageSize: z23.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
633
932
|
};
|
|
634
933
|
var getSellerCatalogTool = {
|
|
635
934
|
name: "get_seller_catalog",
|
|
636
935
|
title: "List Catalog ASINs for a Seller",
|
|
637
936
|
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).",
|
|
638
|
-
inputSchema:
|
|
937
|
+
inputSchema: inputSchema22,
|
|
639
938
|
annotations: { readOnlyHint: true },
|
|
640
939
|
handler: async (args, ctx) => {
|
|
641
940
|
return await httpGet(
|
|
@@ -653,28 +952,28 @@ var getSellerCatalogTool = {
|
|
|
653
952
|
};
|
|
654
953
|
|
|
655
954
|
// src/tools/get-seller-listing-changes.ts
|
|
656
|
-
import { z as
|
|
657
|
-
var
|
|
955
|
+
import { z as z24 } from "zod";
|
|
956
|
+
var inputSchema23 = {
|
|
658
957
|
...sellerScopedInputSchema,
|
|
659
|
-
types:
|
|
660
|
-
asin:
|
|
661
|
-
brand:
|
|
662
|
-
search:
|
|
663
|
-
startDate:
|
|
664
|
-
endDate:
|
|
665
|
-
sortBy:
|
|
666
|
-
sortOrder:
|
|
667
|
-
includeCorrelations:
|
|
958
|
+
types: z24.array(z24.enum(LISTING_CHANGE_TYPES)).min(1).optional().describe('Filter to specific change types. Omit for all. Any of "Price", "Content", "Image".'),
|
|
959
|
+
asin: z24.string().min(1).optional().describe("Filter to an exact ASIN or parent ASIN."),
|
|
960
|
+
brand: z24.string().min(1).optional().describe("Case-insensitive partial match on brand name."),
|
|
961
|
+
search: z24.string().min(1).optional().describe("Case-insensitive partial match on product title or brand."),
|
|
962
|
+
startDate: z24.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."),
|
|
963
|
+
endDate: z24.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."),
|
|
964
|
+
sortBy: z24.enum(LISTING_CHANGE_SORT_BY).optional().describe('Sort field. "date" (default) or "type".'),
|
|
965
|
+
sortOrder: z24.enum(SORT_ORDER).optional().describe('Sort direction. "DESC" (default) or "ASC".'),
|
|
966
|
+
includeCorrelations: z24.boolean().optional().describe(
|
|
668
967
|
"When true, include the ranking/conversion `correlation` object per change (CVR and search-term movement before vs after). Defaults to false."
|
|
669
968
|
),
|
|
670
|
-
currentPage:
|
|
671
|
-
pageSize:
|
|
969
|
+
currentPage: z24.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
970
|
+
pageSize: z24.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
672
971
|
};
|
|
673
972
|
var getSellerListingChangesTool = {
|
|
674
973
|
name: "get_seller_listing_changes",
|
|
675
974
|
title: "List Listing Changes for a Seller",
|
|
676
975
|
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).",
|
|
677
|
-
inputSchema:
|
|
976
|
+
inputSchema: inputSchema23,
|
|
678
977
|
annotations: { readOnlyHint: true },
|
|
679
978
|
handler: async (args, ctx) => {
|
|
680
979
|
return await httpGet(
|
|
@@ -699,13 +998,13 @@ var getSellerListingChangesTool = {
|
|
|
699
998
|
};
|
|
700
999
|
|
|
701
1000
|
// src/tools/get-asin-inventory-distribution.ts
|
|
702
|
-
import { z as
|
|
703
|
-
var
|
|
704
|
-
sellerId:
|
|
1001
|
+
import { z as z25 } from "zod";
|
|
1002
|
+
var inputSchema24 = {
|
|
1003
|
+
sellerId: z25.string().min(1).describe(
|
|
705
1004
|
"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."
|
|
706
1005
|
),
|
|
707
|
-
marketplace:
|
|
708
|
-
asin:
|
|
1006
|
+
marketplace: z25.enum(SUPPORTED_MARKETPLACES).describe('Amazon marketplace code, e.g. "com" for amazon.com or "co.uk" for amazon.co.uk.'),
|
|
1007
|
+
asin: z25.string().regex(/^[A-Z0-9]{10}$/, "ASIN must be 10 uppercase alphanumeric characters (e.g. B08XYZ1234).").describe(
|
|
709
1008
|
"Amazon Standard Identification Number (10 uppercase alphanumeric characters, e.g. B08XYZ1234)."
|
|
710
1009
|
)
|
|
711
1010
|
};
|
|
@@ -713,7 +1012,7 @@ var getAsinInventoryDistributionTool = {
|
|
|
713
1012
|
name: "get_asin_inventory_distribution",
|
|
714
1013
|
title: "Get Per-Fulfillment-Center Inventory Distribution for an ASIN",
|
|
715
1014
|
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.",
|
|
716
|
-
inputSchema:
|
|
1015
|
+
inputSchema: inputSchema24,
|
|
717
1016
|
annotations: { readOnlyHint: true },
|
|
718
1017
|
handler: async (args, ctx) => {
|
|
719
1018
|
return await httpGet(
|
|
@@ -726,18 +1025,18 @@ var getAsinInventoryDistributionTool = {
|
|
|
726
1025
|
};
|
|
727
1026
|
|
|
728
1027
|
// src/tools/alert-query.ts
|
|
729
|
-
import { z as
|
|
1028
|
+
import { z as z26 } from "zod";
|
|
730
1029
|
var alertsQueryInputSchema = {
|
|
731
|
-
sellerId:
|
|
732
|
-
marketplace:
|
|
733
|
-
status:
|
|
1030
|
+
sellerId: z26.string().min(1).max(50).optional().describe('Filter to a single connected Amazon seller account ID, e.g. "A1B2C3D4E5".'),
|
|
1031
|
+
marketplace: z26.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.'),
|
|
1032
|
+
status: z26.enum(ALERT_STATUSES).optional().describe(
|
|
734
1033
|
"Lifecycle filter. `active` (default) returns unresolved alerts, `resolved` returns resolved alerts, `all` returns both. Dismissed alerts are never returned."
|
|
735
1034
|
),
|
|
736
|
-
updatedSince:
|
|
1035
|
+
updatedSince: z26.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(
|
|
737
1036
|
"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."
|
|
738
1037
|
),
|
|
739
|
-
currentPage:
|
|
740
|
-
pageSize:
|
|
1038
|
+
currentPage: z26.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1039
|
+
pageSize: z26.number().int().min(1).max(50).optional().describe("Items per page (max 50). Defaults to 20.")
|
|
741
1040
|
};
|
|
742
1041
|
|
|
743
1042
|
// src/tools/list-indexing-issue-alerts.ts
|
|
@@ -787,12 +1086,12 @@ var listBlindSpendAlertsTool = {
|
|
|
787
1086
|
};
|
|
788
1087
|
|
|
789
1088
|
// src/tools/get-quota.ts
|
|
790
|
-
var
|
|
1089
|
+
var inputSchema25 = {};
|
|
791
1090
|
var getQuotaTool = {
|
|
792
1091
|
name: "get_quota",
|
|
793
1092
|
title: "Get Quota Usage",
|
|
794
1093
|
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.",
|
|
795
|
-
inputSchema:
|
|
1094
|
+
inputSchema: inputSchema25,
|
|
796
1095
|
annotations: { readOnlyHint: true },
|
|
797
1096
|
handler: async (_args, ctx) => {
|
|
798
1097
|
return await httpGet({ config: ctx.config, toolName: "get_quota" }, "/v1/quota");
|
|
@@ -800,20 +1099,20 @@ var getQuotaTool = {
|
|
|
800
1099
|
};
|
|
801
1100
|
|
|
802
1101
|
// src/tools/list-usage.ts
|
|
803
|
-
import { z as
|
|
804
|
-
var
|
|
805
|
-
type:
|
|
806
|
-
search:
|
|
807
|
-
startDate:
|
|
808
|
-
endDate:
|
|
809
|
-
currentPage:
|
|
810
|
-
pageSize:
|
|
1102
|
+
import { z as z27 } from "zod";
|
|
1103
|
+
var inputSchema26 = {
|
|
1104
|
+
type: z27.enum(BILLABLE_FEATURE_TYPES).optional().describe("Filter to a single billable feature type. Omit to return all types."),
|
|
1105
|
+
search: z27.string().min(1).optional().describe("Case-insensitive partial match on the user's name or email."),
|
|
1106
|
+
startDate: z27.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."),
|
|
1107
|
+
endDate: z27.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."),
|
|
1108
|
+
currentPage: z27.number().int().min(1).optional().describe("Page number, 1-indexed. Defaults to 1."),
|
|
1109
|
+
pageSize: z27.number().int().min(1).max(200).optional().describe("Items per page (max 200). Defaults to 50.")
|
|
811
1110
|
};
|
|
812
1111
|
var listUsageTool = {
|
|
813
1112
|
name: "list_usage",
|
|
814
1113
|
title: "List Billable Usage Logs",
|
|
815
1114
|
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).",
|
|
816
|
-
inputSchema:
|
|
1115
|
+
inputSchema: inputSchema26,
|
|
817
1116
|
annotations: { readOnlyHint: true },
|
|
818
1117
|
handler: async (args, ctx) => {
|
|
819
1118
|
return await httpGet(
|
|
@@ -844,6 +1143,15 @@ var allTools = [
|
|
|
844
1143
|
createNicheDiveTool,
|
|
845
1144
|
rediveNicheTool,
|
|
846
1145
|
getDiveStatusTool,
|
|
1146
|
+
addRankRadarSearchTermsTool,
|
|
1147
|
+
pauseRankRadarSearchTermsTool,
|
|
1148
|
+
resumeRankRadarSearchTermsTool,
|
|
1149
|
+
pauseRankRadarTool,
|
|
1150
|
+
resumeRankRadarTool,
|
|
1151
|
+
deleteRankRadarTool,
|
|
1152
|
+
deleteNicheTool,
|
|
1153
|
+
generateListingCopyTool,
|
|
1154
|
+
getListingCopyGenerationStatusTool,
|
|
847
1155
|
listSellerProfilesTool,
|
|
848
1156
|
getSellerCatalogTool,
|
|
849
1157
|
getSellerListingChangesTool,
|