@affset/mcp 0.1.0 → 0.2.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/.env.example +5 -0
- package/README.md +158 -37
- package/dist/client.d.ts +43 -0
- package/dist/client.js +15 -2
- package/dist/config.d.ts +7 -0
- package/dist/config.js +15 -54
- package/dist/core.d.ts +18 -0
- package/dist/core.js +18 -0
- package/dist/docs.d.ts +39 -0
- package/dist/docs.js +105 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +0 -0
- package/dist/lib/format.d.ts +46 -0
- package/dist/lib/format.js +3 -0
- package/dist/lib/integrationUrls.d.ts +57 -0
- package/dist/lib/linkArgs.d.ts +27 -0
- package/dist/lib/patch.d.ts +10 -0
- package/dist/lib/payoutRules.d.ts +38 -0
- package/dist/lib/readBody.d.ts +17 -0
- package/dist/lib/readBody.js +69 -0
- package/dist/lib/targeting.d.ts +51 -0
- package/dist/lib/time.d.ts +38 -0
- package/dist/lib/toolResult.d.ts +7 -0
- package/dist/lib/urls.d.ts +2 -0
- package/dist/lib/zones.d.ts +24 -0
- package/dist/registerTools.d.ts +40 -0
- package/dist/registerTools.js +401 -0
- package/dist/runtimeConfig.d.ts +37 -0
- package/dist/runtimeConfig.js +93 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.js +3 -306
- package/dist/tools/createCampaign.d.ts +25 -0
- package/dist/tools/createCampaign.js +3 -2
- package/dist/tools/createTeamMember.d.ts +26 -0
- package/dist/tools/createTeamMember.js +204 -0
- package/dist/tools/createZone.d.ts +22 -0
- package/dist/tools/cutZones.d.ts +29 -0
- package/dist/tools/deletePayoutRule.d.ts +16 -0
- package/dist/tools/getCampaign.d.ts +12 -0
- package/dist/tools/getCampaign.js +150 -0
- package/dist/tools/getStats.d.ts +40 -0
- package/dist/tools/getStats.js +37 -2
- package/dist/tools/getTrackingLink.d.ts +23 -0
- package/dist/tools/getZoneUrl.d.ts +21 -0
- package/dist/tools/listCampaigns.d.ts +23 -0
- package/dist/tools/listConversions.d.ts +29 -0
- package/dist/tools/listPayoutRules.d.ts +12 -0
- package/dist/tools/listSubLabels.d.ts +5 -0
- package/dist/tools/listTargetingRules.d.ts +12 -0
- package/dist/tools/listTargetingTypes.d.ts +5 -0
- package/dist/tools/listTeam.d.ts +14 -0
- package/dist/tools/listZones.d.ts +23 -0
- package/dist/tools/removeTargetingRule.d.ts +21 -0
- package/dist/tools/setCampaignStatus.d.ts +18 -0
- package/dist/tools/setPayoutGoal.d.ts +16 -0
- package/dist/tools/setPayoutRule.d.ts +18 -0
- package/dist/tools/setSubLabels.d.ts +22 -0
- package/dist/tools/setTargetingRule.d.ts +21 -0
- package/dist/tools/updateCampaign.d.ts +35 -0
- package/dist/tools/updateZone.d.ts +25 -0
- package/dist/tools/whoami.d.ts +6 -0
- package/dist/types.d.ts +210 -0
- package/dist/types.js +1 -0
- package/dist/version.d.ts +7 -0
- package/dist/version.js +8 -0
- package/package.json +16 -2
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AffsetApiError } from "../client.js";
|
|
3
|
+
import { formatInstant } from "../lib/time.js";
|
|
4
|
+
import { mdCell, money, moneyPrecise } from "../lib/format.js";
|
|
5
|
+
import { fetchPayoutRules } from "../lib/payoutRules.js";
|
|
6
|
+
import { fetchTargetingRules, fetchTargetingTypes, UNENFORCED_TYPES } from "../lib/targeting.js";
|
|
7
|
+
import { errorResult, textError, textResult } from "../lib/toolResult.js";
|
|
8
|
+
export const GET_CAMPAIGN_DESCRIPTION = "Get one campaign's full record: every field (including the untruncated offer URL, " +
|
|
9
|
+
"exact schedule, budgets/pacing, silent-conversions flag, payout goal type) plus its " +
|
|
10
|
+
"targeting rules and payout rules in one call. `list_campaigns` renders a summary table " +
|
|
11
|
+
"(offer URL truncated, no dates/pacing/silent) meant for scanning many campaigns; use " +
|
|
12
|
+
"this when you need one campaign's complete data — e.g. before recreating it as a new " +
|
|
13
|
+
"campaign, or before editing it with `update_campaign`.";
|
|
14
|
+
export const getCampaignInputSchema = {
|
|
15
|
+
campaign_id: z
|
|
16
|
+
.union([
|
|
17
|
+
z
|
|
18
|
+
.string()
|
|
19
|
+
.trim()
|
|
20
|
+
.regex(/^[1-9]\d*$/, "campaign_id must be a positive integer")
|
|
21
|
+
.refine((value) => Number.isSafeInteger(Number(value)), "campaign_id is too large"),
|
|
22
|
+
z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
|
23
|
+
])
|
|
24
|
+
.describe("Campaign id to fetch."),
|
|
25
|
+
};
|
|
26
|
+
export async function getCampaign(client, args) {
|
|
27
|
+
try {
|
|
28
|
+
const campaignId = String(args.campaign_id).trim();
|
|
29
|
+
if (!campaignId)
|
|
30
|
+
return textError("campaign_id is required.");
|
|
31
|
+
let campaign;
|
|
32
|
+
try {
|
|
33
|
+
campaign = await client.get(`/api/campaigns/${encodeURIComponent(campaignId)}`);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
if (err instanceof AffsetApiError && err.status === 404) {
|
|
37
|
+
return textError(`Campaign \`${campaignId}\` not found in this namespace.`);
|
|
38
|
+
}
|
|
39
|
+
throw err;
|
|
40
|
+
}
|
|
41
|
+
const [targetingRules, payoutRules, targetingTypes, timeZone] = await Promise.all([
|
|
42
|
+
fetchTargetingRules(client, campaignId),
|
|
43
|
+
fetchPayoutRules(client, campaignId),
|
|
44
|
+
// Names are a nicety; the rule table still works with bare type ids.
|
|
45
|
+
fetchTargetingTypes(client).catch(() => []),
|
|
46
|
+
client.getTenantTimezone(),
|
|
47
|
+
]);
|
|
48
|
+
const typeById = new Map(targetingTypes.map((t) => [t.id, t]));
|
|
49
|
+
const fmt = (ms) => ms == null ? "—" : `${formatInstant(ms, timeZone)} ${mdCell(timeZone)} (${ms} epoch ms)`;
|
|
50
|
+
const deadTargetingRules = targetingRules.filter((rule) => {
|
|
51
|
+
const name = typeById.get(rule.targeting_rule_type_id)?.name.toLowerCase();
|
|
52
|
+
return name !== undefined && UNENFORCED_TYPES[name] !== undefined;
|
|
53
|
+
});
|
|
54
|
+
const payoutGoal = campaign.payout_goal_type?.trim();
|
|
55
|
+
const fields = [
|
|
56
|
+
"| Field | Value |",
|
|
57
|
+
"|---|---|",
|
|
58
|
+
`| Id | ${campaign.id} |`,
|
|
59
|
+
`| Name | ${mdCell(campaign.name)} |`,
|
|
60
|
+
`| Status | ${mdCell(campaign.status)} |`,
|
|
61
|
+
`| Advertiser | ${mdCell(campaign.user_email ?? "—")} |`,
|
|
62
|
+
`| Offer URL | ${mdCell(campaign.redirect_url ?? "—")} |`,
|
|
63
|
+
`| Model | ${mdCell(campaign.payment_model ?? "—")} |`,
|
|
64
|
+
`| Rate | ${campaign.rate != null ? moneyPrecise(campaign.rate) : "—"} |`,
|
|
65
|
+
`| Start date | ${fmt(campaign.start_date)} |`,
|
|
66
|
+
`| End date | ${fmt(campaign.end_date)} |`,
|
|
67
|
+
`| Daily budget | ${money(campaign.daily_budget)} |`,
|
|
68
|
+
`| Total budget | ${money(campaign.total_budget)} |`,
|
|
69
|
+
`| Pacing | ${mdCell(campaign.pacing ?? "—")} |`,
|
|
70
|
+
`| Budget paused | ${formatBudgetPaused(campaign)} |`,
|
|
71
|
+
`| Silent conversions | ${formatFlag(campaign.silent)} |`,
|
|
72
|
+
`| Payout goal type | ${payoutGoal ? mdCell(payoutGoal) : "_none — every conversion type gets the resolved payout_"} |`,
|
|
73
|
+
`| Created | ${fmt(campaign.created_at)} |`,
|
|
74
|
+
`| Updated | ${fmt(campaign.updated_at)} |`,
|
|
75
|
+
];
|
|
76
|
+
return textResult([
|
|
77
|
+
`**Campaign** \`${campaign.id}\` — ${mdCell(campaign.name)}`,
|
|
78
|
+
"",
|
|
79
|
+
fields.join("\n"),
|
|
80
|
+
"",
|
|
81
|
+
`**Targeting rules** (${targetingRules.length})`,
|
|
82
|
+
"",
|
|
83
|
+
renderTargetingRules(targetingRules, typeById),
|
|
84
|
+
...(deadTargetingRules.length
|
|
85
|
+
? ["", ...renderDeadTargetingWarnings(deadTargetingRules, typeById)]
|
|
86
|
+
: []),
|
|
87
|
+
"",
|
|
88
|
+
`**Payout rules** (${payoutRules.length})`,
|
|
89
|
+
"",
|
|
90
|
+
renderPayoutRules(payoutRules),
|
|
91
|
+
"",
|
|
92
|
+
"_Recreate elsewhere with `create_campaign` + `update_campaign`, then " +
|
|
93
|
+
"`set_targeting_rule` / `set_payout_rule` for each rule above._",
|
|
94
|
+
"_Manage this campaign with `update_campaign`, `set_campaign_status`, " +
|
|
95
|
+
"`set_targeting_rule`, `set_payout_rule`, `set_payout_goal`._",
|
|
96
|
+
].join("\n"));
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
return errorResult(err);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function formatFlag(value) {
|
|
103
|
+
if (value == null)
|
|
104
|
+
return "—";
|
|
105
|
+
return value ? "yes" : "no";
|
|
106
|
+
}
|
|
107
|
+
function formatBudgetPaused(campaign) {
|
|
108
|
+
if (campaign.budget_paused == null)
|
|
109
|
+
return "—";
|
|
110
|
+
if (!campaign.budget_paused)
|
|
111
|
+
return "no";
|
|
112
|
+
const reason = campaign.budget_pause_reason?.trim();
|
|
113
|
+
return reason ? `yes (${mdCell(reason)})` : "yes (reason unavailable)";
|
|
114
|
+
}
|
|
115
|
+
function renderTargetingRules(rules, typeById) {
|
|
116
|
+
if (rules.length === 0) {
|
|
117
|
+
return "_No targeting rules — campaign is unrestricted on /serve._";
|
|
118
|
+
}
|
|
119
|
+
const lines = ["| Id | Type | Method | Rule |", "|---|---|---|---|"];
|
|
120
|
+
for (const r of rules) {
|
|
121
|
+
const t = typeById.get(r.targeting_rule_type_id);
|
|
122
|
+
const typeLabel = t
|
|
123
|
+
? `${mdCell(t.name)} (${r.targeting_rule_type_id})`
|
|
124
|
+
: String(r.targeting_rule_type_id);
|
|
125
|
+
const inert = t && UNENFORCED_TYPES[t.name.toLowerCase()] ? " ⚠️" : "";
|
|
126
|
+
lines.push(`| ${r.id ?? "—"} | ${typeLabel}${inert} | ${mdCell(r.targeting_method)} | ${mdCell(r.rule)} |`);
|
|
127
|
+
}
|
|
128
|
+
return lines.join("\n");
|
|
129
|
+
}
|
|
130
|
+
function renderDeadTargetingWarnings(rules, typeById) {
|
|
131
|
+
const names = [...new Set(rules.map((rule) => typeById.get(rule.targeting_rule_type_id).name))];
|
|
132
|
+
return names.map((name) => `⚠️ \`${mdCell(name)}\` — ${UNENFORCED_TYPES[name.toLowerCase()]}. This rule has no effect.`);
|
|
133
|
+
}
|
|
134
|
+
function renderPayoutRules(rules) {
|
|
135
|
+
if (rules.length === 0) {
|
|
136
|
+
return "_No payout rules — conversions resolve to $0 until you set one._";
|
|
137
|
+
}
|
|
138
|
+
const lines = ["| Scope | Zone | Payout | Rule id |", "|---|---|--:|---|"];
|
|
139
|
+
for (const r of rules) {
|
|
140
|
+
const scope = r.zone_id == null ? "global" : "zone";
|
|
141
|
+
const zone = r.zone_id == null ? "—" : `\`${r.zone_id}\``;
|
|
142
|
+
lines.push(`| ${scope} | ${zone} | ${moneyPrecise(r.payout)} | \`${r.id}\` |`);
|
|
143
|
+
}
|
|
144
|
+
if (!rules.some((rule) => rule.zone_id == null)) {
|
|
145
|
+
lines.push("");
|
|
146
|
+
lines.push("_⚠️ No global rule — conversions from any zone without an override resolve to **$0**._");
|
|
147
|
+
}
|
|
148
|
+
return lines.join("\n");
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=getCampaign.js.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { AffsetClient } from "../client.js";
|
|
4
|
+
import { RANGE_PRESETS } from "../lib/time.js";
|
|
5
|
+
import { type GroupBy } from "../types.js";
|
|
6
|
+
export declare const GET_STATS_DESCRIPTION: string;
|
|
7
|
+
export declare const getStatsInputSchema: {
|
|
8
|
+
group_by: z.ZodDefault<z.ZodEnum<["date", "campaign_id", "zone_id", "country", "conversion_type", "publisher_email", "advertiser_email", "sub1", "sub2", "sub3", "sub4", "sub5"]>>;
|
|
9
|
+
range: z.ZodOptional<z.ZodEnum<["today", "yesterday", "last_7_days", "last_30_days", "this_month"]>>;
|
|
10
|
+
from: z.ZodOptional<z.ZodString>;
|
|
11
|
+
to: z.ZodOptional<z.ZodString>;
|
|
12
|
+
campaign_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
+
zone_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
sub1: z.ZodOptional<z.ZodString>;
|
|
15
|
+
sub2: z.ZodOptional<z.ZodString>;
|
|
16
|
+
sub3: z.ZodOptional<z.ZodString>;
|
|
17
|
+
sub4: z.ZodOptional<z.ZodString>;
|
|
18
|
+
sub5: z.ZodOptional<z.ZodString>;
|
|
19
|
+
conversion_type: z.ZodOptional<z.ZodString>;
|
|
20
|
+
advertiser_email: z.ZodOptional<z.ZodString>;
|
|
21
|
+
publisher_email: z.ZodOptional<z.ZodString>;
|
|
22
|
+
};
|
|
23
|
+
type GetStatsArgs = {
|
|
24
|
+
group_by: GroupBy;
|
|
25
|
+
range?: (typeof RANGE_PRESETS)[number];
|
|
26
|
+
from?: string;
|
|
27
|
+
to?: string;
|
|
28
|
+
campaign_ids?: string[];
|
|
29
|
+
zone_ids?: string[];
|
|
30
|
+
sub1?: string;
|
|
31
|
+
sub2?: string;
|
|
32
|
+
sub3?: string;
|
|
33
|
+
sub4?: string;
|
|
34
|
+
sub5?: string;
|
|
35
|
+
conversion_type?: string;
|
|
36
|
+
advertiser_email?: string;
|
|
37
|
+
publisher_email?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare function getStats(client: AffsetClient, args: GetStatsArgs): Promise<CallToolResult>;
|
|
40
|
+
export {};
|
package/dist/tools/getStats.js
CHANGED
|
@@ -6,10 +6,18 @@ import { GROUP_BY_VALUES, SUB_KEYS } from "../types.js";
|
|
|
6
6
|
export const GET_STATS_DESCRIPTION = "Pull affset traffic stats grouped by a single dimension. Returns impressions, clicks, " +
|
|
7
7
|
"conversions, CR, payout, media cost and ROI as a table. Drill down by calling " +
|
|
8
8
|
"repeatedly: first group_by=date or campaign_id, then narrow with filters " +
|
|
9
|
-
"(campaign_ids, zone_ids, sub1..sub5
|
|
9
|
+
"(campaign_ids, zone_ids, sub1..sub5, conversion_type, advertiser_email, publisher_email) " +
|
|
10
|
+
"and change group_by (zone_id, sub1, ...). " +
|
|
10
11
|
'Sub columns are titled with the tenant\'s configured labels (e.g. "Zone (sub1)") ' +
|
|
11
12
|
"when set; group_by/filters always take the raw subN key. " +
|
|
12
|
-
"
|
|
13
|
+
"conversion_type only matches conversion rows, so filtering by it zeroes impressions, clicks " +
|
|
14
|
+
"and media cost — it narrows to conversions of that type, not clicks that led to one. " +
|
|
15
|
+
"ROI is blank until traffic cost has been imported for the slice. " +
|
|
16
|
+
"group_by=advertiser_email / publisher_email break down by team member; the API limits them " +
|
|
17
|
+
"to owner/manager plus the matching side's manager role (403 otherwise). " +
|
|
18
|
+
"advertiser_email / publisher_email are also standalone filters — narrow every row to one " +
|
|
19
|
+
"advertiser's campaigns or one publisher's zones regardless of group_by, instead of breaking " +
|
|
20
|
+
"every user out into its own row. Same role limits as the matching group_by value.";
|
|
13
21
|
export const getStatsInputSchema = {
|
|
14
22
|
group_by: z
|
|
15
23
|
.enum(GROUP_BY_VALUES)
|
|
@@ -34,6 +42,25 @@ export const getStatsInputSchema = {
|
|
|
34
42
|
sub3: z.string().optional().describe("Filter by sub3 value(s)."),
|
|
35
43
|
sub4: z.string().optional().describe("Filter by sub4 value(s)."),
|
|
36
44
|
sub5: z.string().optional().describe("Filter by sub5 value(s)."),
|
|
45
|
+
conversion_type: z
|
|
46
|
+
.string()
|
|
47
|
+
.optional()
|
|
48
|
+
.describe("Filter by conversion type value(s) (e.g. deposit, register), comma-separated for multiple. " +
|
|
49
|
+
'Pass "" to select conversions recorded without a type.'),
|
|
50
|
+
advertiser_email: z
|
|
51
|
+
.string()
|
|
52
|
+
.trim()
|
|
53
|
+
.email()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe("Narrow to one advertiser's campaigns, independent of group_by. Owner/manager: any advertiser. " +
|
|
56
|
+
"advertiser_manager: only one of their own assigned advertisers (else 403). Other roles: 403."),
|
|
57
|
+
publisher_email: z
|
|
58
|
+
.string()
|
|
59
|
+
.trim()
|
|
60
|
+
.email()
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("Narrow to one publisher's zones, independent of group_by. Owner/manager: any publisher. " +
|
|
63
|
+
"publisher_manager: only one of their own assigned publishers (else 403). Other roles: 403."),
|
|
37
64
|
};
|
|
38
65
|
export async function getStats(client, args) {
|
|
39
66
|
try {
|
|
@@ -53,6 +80,14 @@ export async function getStats(client, args) {
|
|
|
53
80
|
if (value !== undefined)
|
|
54
81
|
query[key] = value;
|
|
55
82
|
}
|
|
83
|
+
if (args.conversion_type !== undefined)
|
|
84
|
+
query.conversion_type = args.conversion_type;
|
|
85
|
+
if (args.advertiser_email !== undefined) {
|
|
86
|
+
query.advertiser_email = args.advertiser_email.trim();
|
|
87
|
+
}
|
|
88
|
+
if (args.publisher_email !== undefined) {
|
|
89
|
+
query.publisher_email = args.publisher_email.trim();
|
|
90
|
+
}
|
|
56
91
|
const data = await client.get("/api/stats", query);
|
|
57
92
|
const table = formatStatsTable(data.stats ?? [], args.group_by, data.sub_labels);
|
|
58
93
|
const heading = groupHeader(args.group_by, data.sub_labels);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type AffsetClient } from "../client.js";
|
|
4
|
+
import type { Config } from "../runtimeConfig.js";
|
|
5
|
+
import { type LinkArgs } from "../lib/linkArgs.js";
|
|
6
|
+
export declare const GET_TRACKING_LINK_DESCRIPTION: string;
|
|
7
|
+
export declare const getTrackingLinkInputSchema: {
|
|
8
|
+
source_click_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
9
|
+
cost: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
10
|
+
sub1: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
11
|
+
sub2: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
12
|
+
sub3: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
13
|
+
sub4: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
14
|
+
sub5: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
15
|
+
campaign_id: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodNumber]>;
|
|
16
|
+
zone_id: z.ZodOptional<z.ZodString>;
|
|
17
|
+
};
|
|
18
|
+
type GetTrackingLinkArgs = LinkArgs & {
|
|
19
|
+
campaign_id: string | number;
|
|
20
|
+
zone_id?: string;
|
|
21
|
+
};
|
|
22
|
+
export declare function getTrackingLink(client: AffsetClient, config: Config, args: GetTrackingLinkArgs): Promise<CallToolResult>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { AffsetClient } from "../client.js";
|
|
4
|
+
import type { Config } from "../runtimeConfig.js";
|
|
5
|
+
import { type LinkArgs } from "../lib/linkArgs.js";
|
|
6
|
+
export declare const GET_ZONE_URL_DESCRIPTION: string;
|
|
7
|
+
export declare const getZoneUrlInputSchema: {
|
|
8
|
+
source_click_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
9
|
+
cost: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
10
|
+
sub1: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
11
|
+
sub2: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
12
|
+
sub3: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
13
|
+
sub4: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
14
|
+
sub5: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
15
|
+
zone_id: z.ZodOptional<z.ZodString>;
|
|
16
|
+
};
|
|
17
|
+
type GetZoneUrlArgs = LinkArgs & {
|
|
18
|
+
zone_id?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function getZoneUrl(client: AffsetClient, config: Config, args: GetZoneUrlArgs): Promise<CallToolResult>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { AffsetClient } from "../client.js";
|
|
4
|
+
import { CAMPAIGN_STATUSES } from "../types.js";
|
|
5
|
+
export declare const LIST_CAMPAIGNS_DESCRIPTION: string;
|
|
6
|
+
export declare const listCampaignsInputSchema: {
|
|
7
|
+
status: z.ZodOptional<z.ZodEnum<["active", "paused", "archived"]>>;
|
|
8
|
+
name_contains: z.ZodOptional<z.ZodString>;
|
|
9
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
11
|
+
sort: z.ZodDefault<z.ZodEnum<["name", "created_at", "start_date"]>>;
|
|
12
|
+
order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
13
|
+
};
|
|
14
|
+
type ListCampaignsArgs = {
|
|
15
|
+
status?: (typeof CAMPAIGN_STATUSES)[number];
|
|
16
|
+
name_contains?: string;
|
|
17
|
+
limit: number;
|
|
18
|
+
offset: number;
|
|
19
|
+
sort: "name" | "created_at" | "start_date";
|
|
20
|
+
order: "asc" | "desc";
|
|
21
|
+
};
|
|
22
|
+
export declare function listCampaigns(client: AffsetClient, args: ListCampaignsArgs): Promise<CallToolResult>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { AffsetClient } from "../client.js";
|
|
4
|
+
declare const SORT_FIELDS: readonly ["created_at", "ad_event_id", "click_id"];
|
|
5
|
+
export declare const LIST_CONVERSIONS_DESCRIPTION: string;
|
|
6
|
+
export declare const listConversionsInputSchema: {
|
|
7
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
sort: z.ZodDefault<z.ZodEnum<["created_at", "ad_event_id", "click_id"]>>;
|
|
10
|
+
order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
11
|
+
click_id: z.ZodOptional<z.ZodString>;
|
|
12
|
+
source_click_id: z.ZodOptional<z.ZodString>;
|
|
13
|
+
type: z.ZodOptional<z.ZodString>;
|
|
14
|
+
payload_contains: z.ZodOptional<z.ZodString>;
|
|
15
|
+
zero_payout: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
};
|
|
17
|
+
type ListConversionsArgs = {
|
|
18
|
+
limit: number;
|
|
19
|
+
offset: number;
|
|
20
|
+
sort: (typeof SORT_FIELDS)[number];
|
|
21
|
+
order: "asc" | "desc";
|
|
22
|
+
click_id?: string;
|
|
23
|
+
source_click_id?: string;
|
|
24
|
+
type?: string;
|
|
25
|
+
payload_contains?: string;
|
|
26
|
+
zero_payout?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare function listConversions(client: AffsetClient, args: ListConversionsArgs): Promise<CallToolResult>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type AffsetClient } from "../client.js";
|
|
4
|
+
export declare const LIST_PAYOUT_RULES_DESCRIPTION: string;
|
|
5
|
+
export declare const listPayoutRulesInputSchema: {
|
|
6
|
+
campaign_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
7
|
+
};
|
|
8
|
+
type ListPayoutRulesArgs = {
|
|
9
|
+
campaign_id: string | number;
|
|
10
|
+
};
|
|
11
|
+
export declare function listPayoutRules(client: AffsetClient, args: ListPayoutRulesArgs): Promise<CallToolResult>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import type { AffsetClient } from "../client.js";
|
|
3
|
+
export declare const LIST_SUB_LABELS_DESCRIPTION: string;
|
|
4
|
+
export declare const listSubLabelsInputSchema: {};
|
|
5
|
+
export declare function listSubLabels(client: AffsetClient): Promise<CallToolResult>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type AffsetClient } from "../client.js";
|
|
4
|
+
export declare const LIST_TARGETING_RULES_DESCRIPTION: string;
|
|
5
|
+
export declare const listTargetingRulesInputSchema: {
|
|
6
|
+
campaign_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
7
|
+
};
|
|
8
|
+
type ListTargetingRulesArgs = {
|
|
9
|
+
campaign_id: string | number;
|
|
10
|
+
};
|
|
11
|
+
export declare function listTargetingRules(client: AffsetClient, args: ListTargetingRulesArgs): Promise<CallToolResult>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import type { AffsetClient } from "../client.js";
|
|
3
|
+
export declare const LIST_TARGETING_TYPES_DESCRIPTION: string;
|
|
4
|
+
export declare const listTargetingTypesInputSchema: {};
|
|
5
|
+
export declare function listTargetingTypes(client: AffsetClient): Promise<CallToolResult>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { AffsetClient } from "../client.js";
|
|
4
|
+
export declare const LIST_TEAM_DESCRIPTION: string;
|
|
5
|
+
export declare const listTeamInputSchema: {
|
|
6
|
+
role: z.ZodOptional<z.ZodString>;
|
|
7
|
+
include_expired: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
+
};
|
|
9
|
+
type ListTeamArgs = {
|
|
10
|
+
role?: string;
|
|
11
|
+
include_expired: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function listTeam(client: AffsetClient, args: ListTeamArgs): Promise<CallToolResult>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { AffsetClient } from "../client.js";
|
|
4
|
+
import { ZONE_STATUSES } from "../types.js";
|
|
5
|
+
export declare const LIST_ZONES_DESCRIPTION: string;
|
|
6
|
+
export declare const listZonesInputSchema: {
|
|
7
|
+
status: z.ZodOptional<z.ZodEnum<["active", "inactive"]>>;
|
|
8
|
+
name_contains: z.ZodOptional<z.ZodString>;
|
|
9
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
11
|
+
sort: z.ZodDefault<z.ZodEnum<["name", "created_at", "site_url"]>>;
|
|
12
|
+
order: z.ZodDefault<z.ZodEnum<["asc", "desc"]>>;
|
|
13
|
+
};
|
|
14
|
+
type ListZonesArgs = {
|
|
15
|
+
status?: (typeof ZONE_STATUSES)[number];
|
|
16
|
+
name_contains?: string;
|
|
17
|
+
limit: number;
|
|
18
|
+
offset: number;
|
|
19
|
+
sort: "name" | "created_at" | "site_url";
|
|
20
|
+
order: "asc" | "desc";
|
|
21
|
+
};
|
|
22
|
+
export declare function listZones(client: AffsetClient, args: ListZonesArgs): Promise<CallToolResult>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type AffsetClient } from "../client.js";
|
|
4
|
+
import { type TargetingMethod } from "../lib/targeting.js";
|
|
5
|
+
export declare const REMOVE_TARGETING_RULE_DESCRIPTION: string;
|
|
6
|
+
export declare const removeTargetingRuleInputSchema: {
|
|
7
|
+
campaign_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
8
|
+
rule_id: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
type: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
10
|
+
method: z.ZodOptional<z.ZodEnum<["whitelist", "blacklist"]>>;
|
|
11
|
+
confirm: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
};
|
|
13
|
+
type RemoveTargetingRuleArgs = {
|
|
14
|
+
campaign_id: string | number;
|
|
15
|
+
rule_id?: number;
|
|
16
|
+
type?: string | number;
|
|
17
|
+
method?: TargetingMethod;
|
|
18
|
+
confirm: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare function removeTargetingRule(client: AffsetClient, args: RemoveTargetingRuleArgs): Promise<CallToolResult>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { AffsetClient } from "../client.js";
|
|
4
|
+
/** Media-buyer verbs → API status. */
|
|
5
|
+
export declare const CAMPAIGN_ACTIONS: readonly ["run", "pause"];
|
|
6
|
+
export declare const SET_CAMPAIGN_STATUS_DESCRIPTION: string;
|
|
7
|
+
export declare const setCampaignStatusInputSchema: {
|
|
8
|
+
campaign_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
9
|
+
action: z.ZodEnum<["run", "pause"]>;
|
|
10
|
+
confirm: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
};
|
|
12
|
+
type SetCampaignStatusArgs = {
|
|
13
|
+
campaign_id: string | number;
|
|
14
|
+
action: (typeof CAMPAIGN_ACTIONS)[number];
|
|
15
|
+
confirm: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function setCampaignStatus(client: AffsetClient, args: SetCampaignStatusArgs): Promise<CallToolResult>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type AffsetClient } from "../client.js";
|
|
4
|
+
export declare const SET_PAYOUT_GOAL_DESCRIPTION: string;
|
|
5
|
+
export declare const setPayoutGoalInputSchema: {
|
|
6
|
+
campaign_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
7
|
+
goal_type: z.ZodUnion<[z.ZodString, z.ZodNull]>;
|
|
8
|
+
confirm: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
+
};
|
|
10
|
+
type SetPayoutGoalArgs = {
|
|
11
|
+
campaign_id: string | number;
|
|
12
|
+
goal_type: string | null;
|
|
13
|
+
confirm: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function setPayoutGoal(client: AffsetClient, args: SetPayoutGoalArgs): Promise<CallToolResult>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type AffsetClient } from "../client.js";
|
|
4
|
+
export declare const SET_PAYOUT_RULE_DESCRIPTION: string;
|
|
5
|
+
export declare const setPayoutRuleInputSchema: {
|
|
6
|
+
campaign_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
7
|
+
payout: z.ZodNumber;
|
|
8
|
+
zone_id: z.ZodOptional<z.ZodString>;
|
|
9
|
+
confirm: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
+
};
|
|
11
|
+
type SetPayoutRuleArgs = {
|
|
12
|
+
campaign_id: string | number;
|
|
13
|
+
payout: number;
|
|
14
|
+
zone_id?: string;
|
|
15
|
+
confirm: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function setPayoutRule(client: AffsetClient, args: SetPayoutRuleArgs): Promise<CallToolResult>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { AffsetClient } from "../client.js";
|
|
4
|
+
export declare const SET_SUB_LABELS_DESCRIPTION: string;
|
|
5
|
+
export declare const setSubLabelsInputSchema: {
|
|
6
|
+
sub1: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
7
|
+
sub2: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
8
|
+
sub3: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
9
|
+
sub4: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
10
|
+
sub5: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
11
|
+
confirm: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
};
|
|
13
|
+
type SetSubLabelsArgs = {
|
|
14
|
+
sub1?: string | null;
|
|
15
|
+
sub2?: string | null;
|
|
16
|
+
sub3?: string | null;
|
|
17
|
+
sub4?: string | null;
|
|
18
|
+
sub5?: string | null;
|
|
19
|
+
confirm: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare function setSubLabels(client: AffsetClient, args: SetSubLabelsArgs): Promise<CallToolResult>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type AffsetClient } from "../client.js";
|
|
4
|
+
import { type TargetingMethod } from "../lib/targeting.js";
|
|
5
|
+
export declare const SET_TARGETING_RULE_DESCRIPTION: string;
|
|
6
|
+
export declare const setTargetingRuleInputSchema: {
|
|
7
|
+
campaign_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
8
|
+
type: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
9
|
+
method: z.ZodEnum<["whitelist", "blacklist"]>;
|
|
10
|
+
rule: z.ZodString;
|
|
11
|
+
confirm: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
};
|
|
13
|
+
type SetTargetingRuleArgs = {
|
|
14
|
+
campaign_id: string | number;
|
|
15
|
+
type: string | number;
|
|
16
|
+
method: TargetingMethod;
|
|
17
|
+
rule: string;
|
|
18
|
+
confirm: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare function setTargetingRule(client: AffsetClient, args: SetTargetingRuleArgs): Promise<CallToolResult>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type AffsetClient } from "../client.js";
|
|
4
|
+
import { CAMPAIGN_STATUSES, PACING_VALUES, PAYMENT_MODELS } from "../types.js";
|
|
5
|
+
export declare const UPDATE_CAMPAIGN_DESCRIPTION: string;
|
|
6
|
+
export declare const updateCampaignInputSchema: {
|
|
7
|
+
campaign_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
8
|
+
name: z.ZodOptional<z.ZodString>;
|
|
9
|
+
redirect_url: z.ZodOptional<z.ZodString>;
|
|
10
|
+
status: z.ZodOptional<z.ZodEnum<["active", "paused", "archived"]>>;
|
|
11
|
+
payment_model: z.ZodOptional<z.ZodEnum<["cpa", "cpm"]>>;
|
|
12
|
+
rate: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
start_date: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
14
|
+
end_date: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
15
|
+
daily_budget: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
|
|
16
|
+
total_budget: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNull]>>;
|
|
17
|
+
pacing: z.ZodOptional<z.ZodEnum<["asap", "even"]>>;
|
|
18
|
+
confirm: z.ZodDefault<z.ZodBoolean>;
|
|
19
|
+
};
|
|
20
|
+
type UpdateCampaignArgs = {
|
|
21
|
+
campaign_id: string | number;
|
|
22
|
+
name?: string;
|
|
23
|
+
redirect_url?: string;
|
|
24
|
+
status?: (typeof CAMPAIGN_STATUSES)[number];
|
|
25
|
+
payment_model?: (typeof PAYMENT_MODELS)[number];
|
|
26
|
+
rate?: number;
|
|
27
|
+
start_date?: string | number | null;
|
|
28
|
+
end_date?: string | number | null;
|
|
29
|
+
daily_budget?: number | null;
|
|
30
|
+
total_budget?: number | null;
|
|
31
|
+
pacing?: (typeof PACING_VALUES)[number];
|
|
32
|
+
confirm: boolean;
|
|
33
|
+
};
|
|
34
|
+
export declare function updateCampaign(client: AffsetClient, args: UpdateCampaignArgs): Promise<CallToolResult>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { type AffsetClient } from "../client.js";
|
|
4
|
+
import { ZONE_STATUSES } from "../types.js";
|
|
5
|
+
export declare const UPDATE_ZONE_DESCRIPTION: string;
|
|
6
|
+
export declare const updateZoneInputSchema: {
|
|
7
|
+
zone_id: z.ZodString;
|
|
8
|
+
name: z.ZodOptional<z.ZodString>;
|
|
9
|
+
status: z.ZodOptional<z.ZodEnum<["active", "inactive"]>>;
|
|
10
|
+
postback_url: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
11
|
+
site_url: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
12
|
+
traffic_back_url: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
|
|
13
|
+
confirm: z.ZodDefault<z.ZodBoolean>;
|
|
14
|
+
};
|
|
15
|
+
type UpdateZoneArgs = {
|
|
16
|
+
zone_id: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
status?: (typeof ZONE_STATUSES)[number];
|
|
19
|
+
postback_url?: string | null;
|
|
20
|
+
site_url?: string | null;
|
|
21
|
+
traffic_back_url?: string | null;
|
|
22
|
+
confirm: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare function updateZone(client: AffsetClient, args: UpdateZoneArgs): Promise<CallToolResult>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import type { AffsetClient } from "../client.js";
|
|
3
|
+
import type { Config } from "../runtimeConfig.js";
|
|
4
|
+
export declare const WHOAMI_DESCRIPTION: string;
|
|
5
|
+
export declare const whoamiInputSchema: {};
|
|
6
|
+
export declare function whoami(client: AffsetClient, config: Config): Promise<CallToolResult>;
|