@cesteral/msads-mcp 1.0.0 → 1.1.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/dist/cesteral-manifest.json +22 -0
- package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.js +1 -1
- package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.js.map +1 -1
- package/dist/mcp-server/tools/definitions/download-report.tool.d.ts +16 -16
- package/dist/mcp-server/tools/definitions/get-entity.tool.d.ts +92 -74
- package/dist/mcp-server/tools/definitions/get-entity.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-entity.tool.js +48 -25
- package/dist/mcp-server/tools/definitions/get-entity.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/manage-criterions.tool.d.ts +4 -4
- package/dist/mcp-server/tools/definitions/update-entity.tool.d.ts +1929 -17
- package/dist/mcp-server/tools/definitions/update-entity.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/update-entity.tool.js +173 -11
- package/dist/mcp-server/tools/definitions/update-entity.tool.js.map +1 -1
- package/dist/mcp-server/tools/utils/capture-snapshot.d.ts +11 -0
- package/dist/mcp-server/tools/utils/capture-snapshot.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/capture-snapshot.js +113 -0
- package/dist/mcp-server/tools/utils/capture-snapshot.js.map +1 -0
- package/dist/mcp-server/tools/utils/dry-run.d.ts +13 -0
- package/dist/mcp-server/tools/utils/dry-run.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/dry-run.js +98 -0
- package/dist/mcp-server/tools/utils/dry-run.js.map +1 -0
- package/dist/testkit/fixtures/index.d.ts +11 -0
- package/dist/testkit/fixtures/index.d.ts.map +1 -0
- package/dist/testkit/fixtures/index.js +246 -0
- package/dist/testkit/fixtures/index.js.map +1 -0
- package/dist/testkit/index.d.ts +6 -0
- package/dist/testkit/index.d.ts.map +1 -0
- package/dist/testkit/index.js +26 -0
- package/dist/testkit/index.js.map +1 -0
- package/dist/testkit/types.d.ts +17 -0
- package/dist/testkit/types.d.ts.map +1 -0
- package/dist/testkit/types.js +2 -0
- package/dist/testkit/types.js.map +1 -0
- package/package.json +12 -2
- package/dist/mcp-server/tools/definitions/get-ad-preview.tool.d.ts +0 -68
- package/dist/mcp-server/tools/definitions/get-ad-preview.tool.d.ts.map +0 -1
- package/dist/mcp-server/tools/definitions/get-ad-preview.tool.js +0 -90
- package/dist/mcp-server/tools/definitions/get-ad-preview.tool.js.map +0 -1
- package/dist/types-global/mcp.d.ts +0 -2
- package/dist/types-global/mcp.d.ts.map +0 -1
- package/dist/types-global/mcp.js +0 -2
- package/dist/types-global/mcp.js.map +0 -1
- package/dist/utils/errors/index.d.ts +0 -2
- package/dist/utils/errors/index.d.ts.map +0 -1
- package/dist/utils/errors/index.js +0 -2
- package/dist/utils/errors/index.js.map +0 -1
- package/dist/utils/security/rate-limiter.d.ts +0 -3
- package/dist/utils/security/rate-limiter.d.ts.map +0 -1
- package/dist/utils/security/rate-limiter.js +0 -5
- package/dist/utils/security/rate-limiter.js.map +0 -1
- package/dist/utils/telemetry/index.d.ts +0 -2
- package/dist/utils/telemetry/index.d.ts.map +0 -1
- package/dist/utils/telemetry/index.js +0 -2
- package/dist/utils/telemetry/index.js.map +0 -1
- package/dist/utils/telemetry/tracing.d.ts +0 -3
- package/dist/utils/telemetry/tracing.d.ts.map +0 -1
- package/dist/utils/telemetry/tracing.js +0 -4
- package/dist/utils/telemetry/tracing.js.map +0 -1
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
const accountId = "account-REDACTED-001";
|
|
2
|
+
export const updateBudgetCampaign = {
|
|
3
|
+
operation: "update_budget",
|
|
4
|
+
entityKind: "campaign",
|
|
5
|
+
args: {
|
|
6
|
+
entityType: "campaign",
|
|
7
|
+
entityId: "cmp-REDACTED-1",
|
|
8
|
+
data: { DailyBudget: 75 },
|
|
9
|
+
},
|
|
10
|
+
preState: {
|
|
11
|
+
Id: "cmp-REDACTED-1",
|
|
12
|
+
Name: "Sample Campaign",
|
|
13
|
+
Status: "Active",
|
|
14
|
+
AccountId: accountId,
|
|
15
|
+
BudgetType: "DailyBudgetStandard",
|
|
16
|
+
DailyBudget: 50,
|
|
17
|
+
},
|
|
18
|
+
expectedPostState: {
|
|
19
|
+
schemaVersion: 1,
|
|
20
|
+
platform: "msads",
|
|
21
|
+
entityKind: "campaign",
|
|
22
|
+
platformEntityId: "cmp-REDACTED-1",
|
|
23
|
+
displayName: "Sample Campaign",
|
|
24
|
+
accountId,
|
|
25
|
+
status: { canonical: "active", platformRaw: "Active" },
|
|
26
|
+
budget: {
|
|
27
|
+
daily: { amountMinor: 7_500, currency: "USD" },
|
|
28
|
+
lifetime: null,
|
|
29
|
+
},
|
|
30
|
+
schedule: { startAt: null, endAt: null },
|
|
31
|
+
},
|
|
32
|
+
description: "update_budget: campaign daily budget increase $50 → $75",
|
|
33
|
+
};
|
|
34
|
+
export const updateBudgetBudget = {
|
|
35
|
+
operation: "update_budget",
|
|
36
|
+
entityKind: "budget",
|
|
37
|
+
args: {
|
|
38
|
+
entityType: "budget",
|
|
39
|
+
entityId: "bud-REDACTED-1",
|
|
40
|
+
data: { Amount: 250 },
|
|
41
|
+
},
|
|
42
|
+
preState: {
|
|
43
|
+
Id: "bud-REDACTED-1",
|
|
44
|
+
Name: "Shared Budget A",
|
|
45
|
+
Amount: 200,
|
|
46
|
+
BudgetType: "DailyBudgetStandard",
|
|
47
|
+
},
|
|
48
|
+
expectedPostState: {
|
|
49
|
+
schemaVersion: 1,
|
|
50
|
+
platform: "msads",
|
|
51
|
+
entityKind: "campaign_budget",
|
|
52
|
+
platformEntityId: "bud-REDACTED-1",
|
|
53
|
+
displayName: "Shared Budget A",
|
|
54
|
+
accountId: null,
|
|
55
|
+
status: { canonical: "unknown", platformRaw: "" },
|
|
56
|
+
budget: {
|
|
57
|
+
daily: { amountMinor: 25_000, currency: "USD" },
|
|
58
|
+
lifetime: null,
|
|
59
|
+
},
|
|
60
|
+
schedule: { startAt: null, endAt: null },
|
|
61
|
+
},
|
|
62
|
+
description: "update_budget: shared budget amount increase $200 → $250",
|
|
63
|
+
};
|
|
64
|
+
export const pauseCampaign = {
|
|
65
|
+
operation: "pause",
|
|
66
|
+
entityKind: "campaign",
|
|
67
|
+
args: {
|
|
68
|
+
entityType: "campaign",
|
|
69
|
+
entityId: "cmp-REDACTED-2",
|
|
70
|
+
data: { Status: "Paused" },
|
|
71
|
+
},
|
|
72
|
+
preState: {
|
|
73
|
+
Id: "cmp-REDACTED-2",
|
|
74
|
+
Name: "Sample Campaign 2",
|
|
75
|
+
Status: "Active",
|
|
76
|
+
AccountId: accountId,
|
|
77
|
+
BudgetType: "DailyBudgetStandard",
|
|
78
|
+
DailyBudget: 50,
|
|
79
|
+
},
|
|
80
|
+
expectedPostState: {
|
|
81
|
+
schemaVersion: 1,
|
|
82
|
+
platform: "msads",
|
|
83
|
+
entityKind: "campaign",
|
|
84
|
+
platformEntityId: "cmp-REDACTED-2",
|
|
85
|
+
displayName: "Sample Campaign 2",
|
|
86
|
+
accountId,
|
|
87
|
+
status: { canonical: "paused", platformRaw: "Paused" },
|
|
88
|
+
budget: {
|
|
89
|
+
daily: { amountMinor: 5_000, currency: "USD" },
|
|
90
|
+
lifetime: null,
|
|
91
|
+
},
|
|
92
|
+
schedule: { startAt: null, endAt: null },
|
|
93
|
+
},
|
|
94
|
+
description: "pause: campaign transition Active → Paused (budget preserved)",
|
|
95
|
+
};
|
|
96
|
+
export const pauseAdGroup = {
|
|
97
|
+
operation: "pause",
|
|
98
|
+
entityKind: "adGroup",
|
|
99
|
+
args: {
|
|
100
|
+
entityType: "adGroup",
|
|
101
|
+
entityId: "ag-REDACTED-1",
|
|
102
|
+
data: { Status: "Paused" },
|
|
103
|
+
},
|
|
104
|
+
preState: {
|
|
105
|
+
Id: "ag-REDACTED-1",
|
|
106
|
+
Name: "Sample Ad Group",
|
|
107
|
+
Status: "Active",
|
|
108
|
+
StartDate: { Day: 1, Month: 1, Year: 2026 },
|
|
109
|
+
EndDate: { Day: 31, Month: 12, Year: 2026 },
|
|
110
|
+
},
|
|
111
|
+
expectedPostState: {
|
|
112
|
+
schemaVersion: 1,
|
|
113
|
+
platform: "msads",
|
|
114
|
+
entityKind: "ad_group",
|
|
115
|
+
platformEntityId: "ag-REDACTED-1",
|
|
116
|
+
displayName: "Sample Ad Group",
|
|
117
|
+
accountId: null,
|
|
118
|
+
status: { canonical: "paused", platformRaw: "Paused" },
|
|
119
|
+
budget: { daily: null, lifetime: null },
|
|
120
|
+
schedule: { startAt: "2026-01-01", endAt: "2026-12-31" },
|
|
121
|
+
},
|
|
122
|
+
description: "pause: ad group transition Active → Paused (schedule preserved)",
|
|
123
|
+
};
|
|
124
|
+
export const pauseAd = {
|
|
125
|
+
operation: "pause",
|
|
126
|
+
entityKind: "ad",
|
|
127
|
+
args: {
|
|
128
|
+
entityType: "ad",
|
|
129
|
+
entityId: "ad-REDACTED-1",
|
|
130
|
+
data: { Status: "Paused" },
|
|
131
|
+
},
|
|
132
|
+
preState: {
|
|
133
|
+
Id: "ad-REDACTED-1",
|
|
134
|
+
Name: "Sample Ad",
|
|
135
|
+
Status: "Active",
|
|
136
|
+
},
|
|
137
|
+
expectedPostState: {
|
|
138
|
+
schemaVersion: 1,
|
|
139
|
+
platform: "msads",
|
|
140
|
+
entityKind: "ad",
|
|
141
|
+
platformEntityId: "ad-REDACTED-1",
|
|
142
|
+
displayName: "Sample Ad",
|
|
143
|
+
accountId: null,
|
|
144
|
+
status: { canonical: "paused", platformRaw: "Paused" },
|
|
145
|
+
budget: { daily: null, lifetime: null },
|
|
146
|
+
schedule: { startAt: null, endAt: null },
|
|
147
|
+
},
|
|
148
|
+
description: "pause: ad transition Active → Paused",
|
|
149
|
+
};
|
|
150
|
+
export const resumeCampaign = {
|
|
151
|
+
operation: "resume",
|
|
152
|
+
entityKind: "campaign",
|
|
153
|
+
args: {
|
|
154
|
+
entityType: "campaign",
|
|
155
|
+
entityId: "cmp-REDACTED-3",
|
|
156
|
+
data: { Status: "Active" },
|
|
157
|
+
},
|
|
158
|
+
preState: {
|
|
159
|
+
Id: "cmp-REDACTED-3",
|
|
160
|
+
Name: "Sample Campaign 3",
|
|
161
|
+
Status: "Paused",
|
|
162
|
+
AccountId: accountId,
|
|
163
|
+
BudgetType: "MonthlyBudgetSpendUntilDepleted",
|
|
164
|
+
MonthlyBudget: 1500,
|
|
165
|
+
},
|
|
166
|
+
expectedPostState: {
|
|
167
|
+
schemaVersion: 1,
|
|
168
|
+
platform: "msads",
|
|
169
|
+
entityKind: "campaign",
|
|
170
|
+
platformEntityId: "cmp-REDACTED-3",
|
|
171
|
+
displayName: "Sample Campaign 3",
|
|
172
|
+
accountId,
|
|
173
|
+
status: { canonical: "active", platformRaw: "Active" },
|
|
174
|
+
budget: {
|
|
175
|
+
daily: null,
|
|
176
|
+
lifetime: { amountMinor: 150_000, currency: "USD" },
|
|
177
|
+
},
|
|
178
|
+
schedule: { startAt: null, endAt: null },
|
|
179
|
+
},
|
|
180
|
+
description: "resume: campaign transition Paused → Active (monthly budget preserved)",
|
|
181
|
+
};
|
|
182
|
+
export const resumeAdGroup = {
|
|
183
|
+
operation: "resume",
|
|
184
|
+
entityKind: "adGroup",
|
|
185
|
+
args: {
|
|
186
|
+
entityType: "adGroup",
|
|
187
|
+
entityId: "ag-REDACTED-2",
|
|
188
|
+
data: { Status: "Active" },
|
|
189
|
+
},
|
|
190
|
+
preState: {
|
|
191
|
+
Id: "ag-REDACTED-2",
|
|
192
|
+
Name: "Sample Ad Group 2",
|
|
193
|
+
Status: "Paused",
|
|
194
|
+
StartDate: { Day: 1, Month: 6, Year: 2026 },
|
|
195
|
+
EndDate: { Day: 30, Month: 9, Year: 2026 },
|
|
196
|
+
},
|
|
197
|
+
expectedPostState: {
|
|
198
|
+
schemaVersion: 1,
|
|
199
|
+
platform: "msads",
|
|
200
|
+
entityKind: "ad_group",
|
|
201
|
+
platformEntityId: "ag-REDACTED-2",
|
|
202
|
+
displayName: "Sample Ad Group 2",
|
|
203
|
+
accountId: null,
|
|
204
|
+
status: { canonical: "active", platformRaw: "Active" },
|
|
205
|
+
budget: { daily: null, lifetime: null },
|
|
206
|
+
schedule: { startAt: "2026-06-01", endAt: "2026-09-30" },
|
|
207
|
+
},
|
|
208
|
+
description: "resume: ad group transition Paused → Active (schedule preserved)",
|
|
209
|
+
};
|
|
210
|
+
export const resumeAd = {
|
|
211
|
+
operation: "resume",
|
|
212
|
+
entityKind: "ad",
|
|
213
|
+
args: {
|
|
214
|
+
entityType: "ad",
|
|
215
|
+
entityId: "ad-REDACTED-2",
|
|
216
|
+
data: { Status: "Active" },
|
|
217
|
+
},
|
|
218
|
+
preState: {
|
|
219
|
+
Id: "ad-REDACTED-2",
|
|
220
|
+
Name: "Sample Ad 2",
|
|
221
|
+
Status: "Paused",
|
|
222
|
+
},
|
|
223
|
+
expectedPostState: {
|
|
224
|
+
schemaVersion: 1,
|
|
225
|
+
platform: "msads",
|
|
226
|
+
entityKind: "ad",
|
|
227
|
+
platformEntityId: "ad-REDACTED-2",
|
|
228
|
+
displayName: "Sample Ad 2",
|
|
229
|
+
accountId: null,
|
|
230
|
+
status: { canonical: "active", platformRaw: "Active" },
|
|
231
|
+
budget: { daily: null, lifetime: null },
|
|
232
|
+
schedule: { startAt: null, endAt: null },
|
|
233
|
+
},
|
|
234
|
+
description: "resume: ad transition Paused → Active",
|
|
235
|
+
};
|
|
236
|
+
export const allFixtures = [
|
|
237
|
+
updateBudgetCampaign,
|
|
238
|
+
updateBudgetBudget,
|
|
239
|
+
pauseCampaign,
|
|
240
|
+
pauseAdGroup,
|
|
241
|
+
pauseAd,
|
|
242
|
+
resumeCampaign,
|
|
243
|
+
resumeAdGroup,
|
|
244
|
+
resumeAd,
|
|
245
|
+
];
|
|
246
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testkit/fixtures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AAU,EAAE,IAAI;IAChB,IAAI,EAAE;QACJ,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,eAAe;QACzB,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;KAC3B;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,QAAQ;KACjB;IACD,iBAAiB,EAAE;QACjB,aAAa,EAAE,CAAC;QAChB,QAAQ,EAAE,OAAO;QACjB,UAAU,EAAE,IAAI;QAChB,gBAAgB,EAAE,eAAe;QACjC,WAAW,EAAE,aAAa;QAC1B,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE;QACtD,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;QACvC,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;KACzC;IACD,WAAW,EAAE,uCAAuC;CACrD,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAiC;IACvD,oBAAoB;IACpB,kBAAkB;IAClB,aAAa;IACb,YAAY;IACZ,OAAO;IACP,cAAc;IACd,aAAa;IACb,QAAQ;CACT,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MsAdsEntityKindKey, MsAdsOperation, MsAdsWriteFixture } from "./types.js";
|
|
2
|
+
export type { MsAdsEntityKindKey, MsAdsFixtureArgs, MsAdsOperation, MsAdsWriteFixture, } from "./types.js";
|
|
3
|
+
export { applyMsAdsPatch } from "../mcp-server/tools/utils/dry-run.js";
|
|
4
|
+
export declare function getFixtures(operation?: MsAdsOperation, entityKind?: MsAdsEntityKindKey): readonly MsAdsWriteFixture[];
|
|
5
|
+
export declare function assertContract(operation: MsAdsOperation, entityKind: MsAdsEntityKindKey, fixture: MsAdsWriteFixture): void;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testkit/index.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGxF,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAMvE,wBAAgB,WAAW,CACzB,SAAS,CAAC,EAAE,cAAc,EAC1B,UAAU,CAAC,EAAE,kBAAkB,GAC9B,SAAS,iBAAiB,EAAE,CAM9B;AAMD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,cAAc,EACzB,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,iBAAiB,GACzB,IAAI,CA6BN"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { applyMsAdsPatch } from "../mcp-server/tools/utils/dry-run.js";
|
|
2
|
+
import { allFixtures } from "./fixtures/index.js";
|
|
3
|
+
export { applyMsAdsPatch } from "../mcp-server/tools/utils/dry-run.js";
|
|
4
|
+
export function getFixtures(operation, entityKind) {
|
|
5
|
+
return allFixtures.filter((fx) => (operation == null || fx.operation === operation) &&
|
|
6
|
+
(entityKind == null || fx.entityKind === entityKind));
|
|
7
|
+
}
|
|
8
|
+
export function assertContract(operation, entityKind, fixture) {
|
|
9
|
+
if (fixture.operation !== operation) {
|
|
10
|
+
throw new Error(`assertContract: fixture.operation=${fixture.operation} does not match expected ${operation}`);
|
|
11
|
+
}
|
|
12
|
+
if (fixture.entityKind !== entityKind) {
|
|
13
|
+
throw new Error(`assertContract: fixture.entityKind=${fixture.entityKind} does not match expected ${entityKind}`);
|
|
14
|
+
}
|
|
15
|
+
const got = applyMsAdsPatch(fixture.args.entityType, fixture.args.entityId, fixture.preState, fixture.args.data);
|
|
16
|
+
if (got == null) {
|
|
17
|
+
throw new Error(`assertContract(${fixture.description}): symbolic apply returned undefined`);
|
|
18
|
+
}
|
|
19
|
+
const a = JSON.stringify(got);
|
|
20
|
+
const b = JSON.stringify(fixture.expectedPostState);
|
|
21
|
+
if (a !== b) {
|
|
22
|
+
throw new Error(`assertContract(${fixture.description}): symbolic post-state did not match expected.\n` +
|
|
23
|
+
`expected: ${b}\n got: ${a}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testkit/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AASlD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAMvE,MAAM,UAAU,WAAW,CACzB,SAA0B,EAC1B,UAA+B;IAE/B,OAAO,WAAW,CAAC,MAAM,CACvB,CAAC,EAAE,EAAE,EAAE,CACL,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC;QACjD,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,CAAC,UAAU,KAAK,UAAU,CAAC,CACvD,CAAC;AACJ,CAAC;AAMD,MAAM,UAAU,cAAc,CAC5B,SAAyB,EACzB,UAA8B,EAC9B,OAA0B;IAE1B,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CACb,qCAAqC,OAAO,CAAC,SAAS,4BAA4B,SAAS,EAAE,CAC9F,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,UAAU,KAAK,UAAU,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,sCAAsC,OAAO,CAAC,UAAU,4BAA4B,UAAU,EAAE,CACjG,CAAC;IACJ,CAAC;IACD,MAAM,GAAG,GAAG,eAAe,CACzB,OAAO,CAAC,IAAI,CAAC,UAAU,EACvB,OAAO,CAAC,IAAI,CAAC,QAAQ,EACrB,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,IAAI,CAAC,IAAI,CAClB,CAAC;IACF,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,kBAAkB,OAAO,CAAC,WAAW,sCAAsC,CAAC,CAAC;IAC/F,CAAC;IAED,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IACpD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,kBAAkB,OAAO,CAAC,WAAW,kDAAkD;YACrF,aAAa,CAAC,eAAe,CAAC,EAAE,CACnC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NormalizedEntitySnapshot } from "@cesteral/shared";
|
|
2
|
+
export type MsAdsOperation = "update_budget" | "pause" | "resume";
|
|
3
|
+
export type MsAdsEntityKindKey = "campaign" | "adGroup" | "ad" | "budget";
|
|
4
|
+
export interface MsAdsFixtureArgs {
|
|
5
|
+
entityType: MsAdsEntityKindKey;
|
|
6
|
+
entityId: string;
|
|
7
|
+
data: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface MsAdsWriteFixture {
|
|
10
|
+
operation: MsAdsOperation;
|
|
11
|
+
entityKind: MsAdsEntityKindKey;
|
|
12
|
+
args: MsAdsFixtureArgs;
|
|
13
|
+
preState: Record<string, unknown>;
|
|
14
|
+
expectedPostState: NormalizedEntitySnapshot;
|
|
15
|
+
description: string;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/testkit/types.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAQjE,MAAM,MAAM,cAAc,GAAG,eAAe,GAAG,OAAO,GAAG,QAAQ,CAAC;AAMlE,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,GAAG,IAAI,GAAG,QAAQ,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAE/B,UAAU,EAAE,kBAAkB,CAAC;IAE/B,QAAQ,EAAE,MAAM,CAAC;IAEjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAMD,MAAM,WAAW,iBAAiB;IAEhC,SAAS,EAAE,cAAc,CAAC;IAE1B,UAAU,EAAE,kBAAkB,CAAC;IAE/B,IAAI,EAAE,gBAAgB,CAAC;IAEvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC,iBAAiB,EAAE,wBAAwB,CAAC;IAE5C,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/testkit/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cesteral/msads-mcp",
|
|
3
3
|
"mcpName": "io.github.cesteral/msads-mcp",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"description": "Microsoft Advertising MCP Server - campaign management and reporting via Microsoft Advertising API v13 JSON endpoints",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -25,6 +25,16 @@
|
|
|
25
25
|
"type": "module",
|
|
26
26
|
"main": "./dist/index.js",
|
|
27
27
|
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./testkit": {
|
|
34
|
+
"types": "./dist/testkit/index.d.ts",
|
|
35
|
+
"import": "./dist/testkit/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
28
38
|
"bin": {
|
|
29
39
|
"msads-mcp": "./dist/index.js"
|
|
30
40
|
},
|
|
@@ -35,7 +45,7 @@
|
|
|
35
45
|
"@modelcontextprotocol/sdk": "1.27.1",
|
|
36
46
|
"pino": "^10.1.0",
|
|
37
47
|
"zod": "3.25.76",
|
|
38
|
-
"@cesteral/shared": "1.
|
|
48
|
+
"@cesteral/shared": "1.1.0"
|
|
39
49
|
},
|
|
40
50
|
"devDependencies": {
|
|
41
51
|
"@types/node": "^20.17.6",
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { RequestContext, McpTextContent, SdkContext } from "@cesteral/shared";
|
|
3
|
-
export declare const GetAdPreviewInputSchema: z.ZodObject<{
|
|
4
|
-
adIds: z.ZodArray<z.ZodString, "many">;
|
|
5
|
-
adGroupId: z.ZodString;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
adGroupId: string;
|
|
8
|
-
adIds: string[];
|
|
9
|
-
}, {
|
|
10
|
-
adGroupId: string;
|
|
11
|
-
adIds: string[];
|
|
12
|
-
}>;
|
|
13
|
-
export declare const GetAdPreviewOutputSchema: z.ZodObject<{
|
|
14
|
-
ads: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>, "many">;
|
|
15
|
-
timestamp: z.ZodString;
|
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
timestamp: string;
|
|
18
|
-
ads: Record<string, any>[];
|
|
19
|
-
}, {
|
|
20
|
-
timestamp: string;
|
|
21
|
-
ads: Record<string, any>[];
|
|
22
|
-
}>;
|
|
23
|
-
type GetAdPreviewInput = z.infer<typeof GetAdPreviewInputSchema>;
|
|
24
|
-
type GetAdPreviewOutput = z.infer<typeof GetAdPreviewOutputSchema>;
|
|
25
|
-
export declare function getAdPreviewLogic(input: GetAdPreviewInput, context: RequestContext, sdkContext?: SdkContext): Promise<GetAdPreviewOutput>;
|
|
26
|
-
export declare function getAdPreviewResponseFormatter(result: GetAdPreviewOutput): McpTextContent[];
|
|
27
|
-
export declare const getAdPreviewTool: {
|
|
28
|
-
name: string;
|
|
29
|
-
title: string;
|
|
30
|
-
description: string;
|
|
31
|
-
inputSchema: z.ZodObject<{
|
|
32
|
-
adIds: z.ZodArray<z.ZodString, "many">;
|
|
33
|
-
adGroupId: z.ZodString;
|
|
34
|
-
}, "strip", z.ZodTypeAny, {
|
|
35
|
-
adGroupId: string;
|
|
36
|
-
adIds: string[];
|
|
37
|
-
}, {
|
|
38
|
-
adGroupId: string;
|
|
39
|
-
adIds: string[];
|
|
40
|
-
}>;
|
|
41
|
-
outputSchema: z.ZodObject<{
|
|
42
|
-
ads: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodAny>, "many">;
|
|
43
|
-
timestamp: z.ZodString;
|
|
44
|
-
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
timestamp: string;
|
|
46
|
-
ads: Record<string, any>[];
|
|
47
|
-
}, {
|
|
48
|
-
timestamp: string;
|
|
49
|
-
ads: Record<string, any>[];
|
|
50
|
-
}>;
|
|
51
|
-
annotations: {
|
|
52
|
-
readOnlyHint: boolean;
|
|
53
|
-
openWorldHint: boolean;
|
|
54
|
-
idempotentHint: boolean;
|
|
55
|
-
destructiveHint: boolean;
|
|
56
|
-
};
|
|
57
|
-
inputExamples: {
|
|
58
|
-
label: string;
|
|
59
|
-
input: {
|
|
60
|
-
adIds: string[];
|
|
61
|
-
adGroupId: string;
|
|
62
|
-
};
|
|
63
|
-
}[];
|
|
64
|
-
logic: typeof getAdPreviewLogic;
|
|
65
|
-
responseFormatter: typeof getAdPreviewResponseFormatter;
|
|
66
|
-
};
|
|
67
|
-
export {};
|
|
68
|
-
//# sourceMappingURL=get-ad-preview.tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-ad-preview.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-ad-preview.tool.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAMnF,eAAO,MAAM,uBAAuB;;;;;;;;;EAUa,CAAC;AAElD,eAAO,MAAM,wBAAwB;;;;;;;;;EAKL,CAAC;AAEjC,KAAK,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACjE,KAAK,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEnE,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,iBAAiB,EACxB,OAAO,EAAE,cAAc,EACvB,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC,kBAAkB,CAAC,CAmB7B;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,EAAE,CA2B1F;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoB5B,CAAC"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { resolveSessionServices } from "../utils/resolve-session.js";
|
|
3
|
-
const TOOL_NAME = "msads_get_ad_preview";
|
|
4
|
-
const TOOL_TITLE = "Get Microsoft Ads Ad Preview";
|
|
5
|
-
const TOOL_DESCRIPTION = `Get a preview of a Microsoft Advertising ad by retrieving its full details including ad copy, URLs, and extensions.`;
|
|
6
|
-
export const GetAdPreviewInputSchema = z
|
|
7
|
-
.object({
|
|
8
|
-
adIds: z
|
|
9
|
-
.array(z.string())
|
|
10
|
-
.min(1)
|
|
11
|
-
.describe("Ad IDs to preview"),
|
|
12
|
-
adGroupId: z
|
|
13
|
-
.string()
|
|
14
|
-
.describe("Ad Group ID containing the ads"),
|
|
15
|
-
})
|
|
16
|
-
.describe("Parameters for getting ad previews");
|
|
17
|
-
export const GetAdPreviewOutputSchema = z
|
|
18
|
-
.object({
|
|
19
|
-
ads: z.array(z.record(z.any())),
|
|
20
|
-
timestamp: z.string().datetime(),
|
|
21
|
-
})
|
|
22
|
-
.describe("Ad preview result");
|
|
23
|
-
export async function getAdPreviewLogic(input, context, sdkContext) {
|
|
24
|
-
const { msadsService } = resolveSessionServices(sdkContext);
|
|
25
|
-
const result = (await msadsService.executeReadOperation("/Ads/QueryByIds", {
|
|
26
|
-
AdIds: input.adIds.map(Number),
|
|
27
|
-
AdGroupId: Number(input.adGroupId),
|
|
28
|
-
AdTypes: null,
|
|
29
|
-
}, context));
|
|
30
|
-
const ads = result.Ads ?? [];
|
|
31
|
-
return {
|
|
32
|
-
ads,
|
|
33
|
-
timestamp: new Date().toISOString(),
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export function getAdPreviewResponseFormatter(result) {
|
|
37
|
-
if (result.ads.length === 0) {
|
|
38
|
-
return [{ type: "text", text: "No ads found for the given IDs." }];
|
|
39
|
-
}
|
|
40
|
-
const previews = result.ads.map((ad) => {
|
|
41
|
-
const lines = [
|
|
42
|
-
`Ad ID: ${ad.Id}`,
|
|
43
|
-
`Type: ${ad.Type ?? "Unknown"}`,
|
|
44
|
-
`Status: ${ad.Status ?? "Unknown"}`,
|
|
45
|
-
];
|
|
46
|
-
if (ad.TitlePart1)
|
|
47
|
-
lines.push(`Title 1: ${ad.TitlePart1}`);
|
|
48
|
-
if (ad.TitlePart2)
|
|
49
|
-
lines.push(`Title 2: ${ad.TitlePart2}`);
|
|
50
|
-
if (ad.TitlePart3)
|
|
51
|
-
lines.push(`Title 3: ${ad.TitlePart3}`);
|
|
52
|
-
if (ad.Text)
|
|
53
|
-
lines.push(`Description: ${ad.Text}`);
|
|
54
|
-
if (ad.TextPart2)
|
|
55
|
-
lines.push(`Description 2: ${ad.TextPart2}`);
|
|
56
|
-
if (ad.FinalUrls)
|
|
57
|
-
lines.push(`Final URL: ${JSON.stringify(ad.FinalUrls)}`);
|
|
58
|
-
if (ad.Path1)
|
|
59
|
-
lines.push(`Path: /${ad.Path1}${ad.Path2 ? `/${ad.Path2}` : ""}`);
|
|
60
|
-
return lines.join("\n");
|
|
61
|
-
});
|
|
62
|
-
return [
|
|
63
|
-
{
|
|
64
|
-
type: "text",
|
|
65
|
-
text: `Ad Previews:\n\n${previews.join("\n\n---\n\n")}\n\nTimestamp: ${result.timestamp}`,
|
|
66
|
-
},
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
export const getAdPreviewTool = {
|
|
70
|
-
name: TOOL_NAME,
|
|
71
|
-
title: TOOL_TITLE,
|
|
72
|
-
description: TOOL_DESCRIPTION,
|
|
73
|
-
inputSchema: GetAdPreviewInputSchema,
|
|
74
|
-
outputSchema: GetAdPreviewOutputSchema,
|
|
75
|
-
annotations: {
|
|
76
|
-
readOnlyHint: true,
|
|
77
|
-
openWorldHint: false,
|
|
78
|
-
idempotentHint: true,
|
|
79
|
-
destructiveHint: false,
|
|
80
|
-
},
|
|
81
|
-
inputExamples: [
|
|
82
|
-
{
|
|
83
|
-
label: "Preview ads",
|
|
84
|
-
input: { adIds: ["111", "222"], adGroupId: "333" },
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
logic: getAdPreviewLogic,
|
|
88
|
-
responseFormatter: getAdPreviewResponseFormatter,
|
|
89
|
-
};
|
|
90
|
-
//# sourceMappingURL=get-ad-preview.tool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-ad-preview.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-ad-preview.tool.ts"],"names":[],"mappings":"AA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{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/types-global/mcp.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/errors/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,KAAK,YAAY,EACjB,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/errors/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,QAAQ,EACR,YAAY,EAEZ,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limiter.d.ts","sourceRoot":"","sources":["../../../src/utils/security/rate-limiter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C,eAAO,MAAM,WAAW,wCAAwE,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { RateLimiter } from "@cesteral/shared";
|
|
2
|
-
import { createPlatformRateLimiter } from "@cesteral/shared";
|
|
3
|
-
import { mcpConfig } from "../../config/index.js";
|
|
4
|
-
export const rateLimiter = createPlatformRateLimiter("msads", mcpConfig.msadsRateLimitPerMinute);
|
|
5
|
-
//# sourceMappingURL=rate-limiter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limiter.js","sourceRoot":"","sources":["../../../src/utils/security/rate-limiter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAG,yBAAyB,CAAC,OAAO,EAAE,SAAS,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/telemetry/index.ts"],"names":[],"mappings":"AAGA,cAAc,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/telemetry/index.ts"],"names":[],"mappings":"AAGA,cAAc,cAAc,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { initializeOpenTelemetry, shutdownOpenTelemetry, getOpenTelemetrySDK, isOpenTelemetryEnabled, otelLogMixin, getTracer, withSpan, withToolSpan, setSpanAttribute, recordSpanError, createPlatformSpanHelper, type Span, } from "@cesteral/shared";
|
|
2
|
-
export declare const withMsAdsApiSpan: <T>(operation: string, entityType: string | undefined, fn: (span: import("@opentelemetry/api").Span) => Promise<T>) => Promise<T>;
|
|
3
|
-
//# sourceMappingURL=tracing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../../../src/utils/telemetry/tracing.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,KAAK,IAAI,GACV,MAAM,kBAAkB,CAAC;AAI1B,eAAO,MAAM,gBAAgB,mIAAoC,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { initializeOpenTelemetry, shutdownOpenTelemetry, getOpenTelemetrySDK, isOpenTelemetryEnabled, otelLogMixin, getTracer, withSpan, withToolSpan, setSpanAttribute, recordSpanError, createPlatformSpanHelper, } from "@cesteral/shared";
|
|
2
|
-
import { createPlatformSpanHelper } from "@cesteral/shared";
|
|
3
|
-
export const withMsAdsApiSpan = createPlatformSpanHelper("msads");
|
|
4
|
-
//# sourceMappingURL=tracing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../../../src/utils/telemetry/tracing.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,wBAAwB,GAEzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC"}
|