@cesteral/msads-mcp 1.3.0 → 2.0.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 +44 -30
- package/dist/auth/msads-auth-adapter.d.ts.map +1 -1
- package/dist/auth/msads-auth-adapter.js +1 -1
- package/dist/auth/msads-auth-adapter.js.map +1 -1
- package/dist/cesteral-manifest.json +68 -16
- package/dist/config/index.d.ts +36 -67
- package/dist/config/index.d.ts.map +1 -1
- package/dist/index.js +13 -23
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.d.ts +1 -1
- package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.d.ts.map +1 -1
- package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.js +9 -3
- package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.js.map +1 -1
- package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.d.ts +1 -1
- package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.d.ts.map +1 -1
- package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.js +5 -3
- package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.js.map +1 -1
- package/dist/mcp-server/prompts/definitions/google-import-workflow.prompt.d.ts +1 -1
- package/dist/mcp-server/prompts/definitions/google-import-workflow.prompt.d.ts.map +1 -1
- package/dist/mcp-server/prompts/definitions/google-import-workflow.prompt.js +9 -6
- package/dist/mcp-server/prompts/definitions/google-import-workflow.prompt.js.map +1 -1
- package/dist/mcp-server/prompts/definitions/reporting-workflow.prompt.d.ts +1 -1
- package/dist/mcp-server/prompts/definitions/reporting-workflow.prompt.d.ts.map +1 -1
- package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.d.ts +1 -1
- package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.d.ts.map +1 -1
- package/dist/mcp-server/prompts/index.d.ts +1 -1
- package/dist/mcp-server/prompts/index.d.ts.map +1 -1
- package/dist/mcp-server/prompts/index.js +15 -0
- package/dist/mcp-server/prompts/index.js.map +1 -1
- package/dist/mcp-server/resources/definitions/entity-examples.resource.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/entity-examples.resource.js +16 -7
- package/dist/mcp-server/resources/definitions/entity-examples.resource.js.map +1 -1
- package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/resources/definitions/index.js +10 -9
- package/dist/mcp-server/resources/definitions/index.js.map +1 -1
- package/dist/mcp-server/resources/utils/field-rules.d.ts.map +1 -1
- package/dist/mcp-server/resources/utils/field-rules.js +11 -11
- package/dist/mcp-server/resources/utils/field-rules.js.map +1 -1
- package/dist/mcp-server/server.d.ts +2 -1
- package/dist/mcp-server/server.d.ts.map +1 -1
- package/dist/mcp-server/server.js +29 -100
- package/dist/mcp-server/server.js.map +1 -1
- package/dist/mcp-server/tools/definitions/adjust-bids.tool.d.ts +26 -132
- package/dist/mcp-server/tools/definitions/adjust-bids.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/adjust-bids.tool.js +73 -18
- package/dist/mcp-server/tools/definitions/adjust-bids.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.d.ts +31 -65
- package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.js +44 -13
- package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/bulk-update-entities.tool.d.ts +31 -72
- package/dist/mcp-server/tools/definitions/bulk-update-entities.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/bulk-update-entities.tool.js +40 -10
- package/dist/mcp-server/tools/definitions/bulk-update-entities.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/bulk-update-status.tool.d.ts +45 -118
- package/dist/mcp-server/tools/definitions/bulk-update-status.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/bulk-update-status.tool.js +30 -9
- package/dist/mcp-server/tools/definitions/bulk-update-status.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/check-report-status.tool.d.ts +24 -62
- package/dist/mcp-server/tools/definitions/check-report-status.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/check-report-status.tool.js +4 -0
- package/dist/mcp-server/tools/definitions/check-report-status.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/create-entity.tool.d.ts +24 -57
- package/dist/mcp-server/tools/definitions/create-entity.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/create-entity.tool.js +21 -6
- package/dist/mcp-server/tools/definitions/create-entity.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/create-report-schedule.tool.d.ts +29 -119
- package/dist/mcp-server/tools/definitions/create-report-schedule.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/create-report-schedule.tool.js +28 -55
- package/dist/mcp-server/tools/definitions/create-report-schedule.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/delete-entity.tool.d.ts +25 -78
- package/dist/mcp-server/tools/definitions/delete-entity.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/delete-entity.tool.js +22 -20
- package/dist/mcp-server/tools/definitions/delete-entity.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/delete-report-schedule.tool.d.ts +12 -59
- package/dist/mcp-server/tools/definitions/delete-report-schedule.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/delete-report-schedule.tool.js +20 -37
- package/dist/mcp-server/tools/definitions/delete-report-schedule.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/download-report.tool.d.ts +84 -214
- package/dist/mcp-server/tools/definitions/download-report.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/download-report.tool.js +7 -2
- package/dist/mcp-server/tools/definitions/download-report.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/duplicate-entity.tool.d.ts +105 -0
- package/dist/mcp-server/tools/definitions/duplicate-entity.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/duplicate-entity.tool.js +171 -0
- package/dist/mcp-server/tools/definitions/duplicate-entity.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ad-details.tool.d.ts +12 -32
- package/dist/mcp-server/tools/definitions/get-ad-details.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-ad-details.tool.js +6 -2
- package/dist/mcp-server/tools/definitions/get-ad-details.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-entity.tool.d.ts +24 -244
- package/dist/mcp-server/tools/definitions/get-entity.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-entity.tool.js +41 -67
- package/dist/mcp-server/tools/definitions/get-entity.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-pacing-status.tool.d.ts +2 -0
- package/dist/mcp-server/tools/definitions/get-pacing-status.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-pacing-status.tool.js +20 -0
- package/dist/mcp-server/tools/definitions/get-pacing-status.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-report-breakdowns.tool.d.ts +104 -204
- package/dist/mcp-server/tools/definitions/get-report-breakdowns.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-report-breakdowns.tool.js +9 -0
- package/dist/mcp-server/tools/definitions/get-report-breakdowns.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-report.tool.d.ts +100 -188
- package/dist/mcp-server/tools/definitions/get-report.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-report.tool.js +9 -1
- package/dist/mcp-server/tools/definitions/get-report.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-targeting-options.tool.d.ts +57 -0
- package/dist/mcp-server/tools/definitions/get-targeting-options.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-targeting-options.tool.js +97 -0
- package/dist/mcp-server/tools/definitions/get-targeting-options.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/import-from-google.tool.d.ts +27 -57
- package/dist/mcp-server/tools/definitions/import-from-google.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/import-from-google.tool.js +40 -10
- package/dist/mcp-server/tools/definitions/import-from-google.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/index.js +6 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -1
- package/dist/mcp-server/tools/definitions/list-accounts.tool.d.ts +14 -90
- package/dist/mcp-server/tools/definitions/list-accounts.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-accounts.tool.js +5 -1
- package/dist/mcp-server/tools/definitions/list-accounts.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/list-entities.tool.d.ts +18 -70
- package/dist/mcp-server/tools/definitions/list-entities.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-entities.tool.js +9 -2
- package/dist/mcp-server/tools/definitions/list-entities.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/list-report-schedules.tool.d.ts +5 -16
- package/dist/mcp-server/tools/definitions/list-report-schedules.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/list-report-schedules.tool.js +4 -3
- package/dist/mcp-server/tools/definitions/list-report-schedules.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/manage-ad-extensions.tool.d.ts +24 -56
- package/dist/mcp-server/tools/definitions/manage-ad-extensions.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/manage-ad-extensions.tool.js +45 -6
- package/dist/mcp-server/tools/definitions/manage-ad-extensions.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/manage-criterions.tool.d.ts +36 -66
- package/dist/mcp-server/tools/definitions/manage-criterions.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/manage-criterions.tool.js +49 -8
- package/dist/mcp-server/tools/definitions/manage-criterions.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/search-targeting.tool.d.ts +17 -40
- package/dist/mcp-server/tools/definitions/search-targeting.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/search-targeting.tool.js +12 -19
- package/dist/mcp-server/tools/definitions/search-targeting.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/submit-report.tool.d.ts +35 -112
- package/dist/mcp-server/tools/definitions/submit-report.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/submit-report.tool.js +2 -1
- package/dist/mcp-server/tools/definitions/submit-report.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/update-entity.tool.d.ts +37 -323
- package/dist/mcp-server/tools/definitions/update-entity.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/update-entity.tool.js +72 -85
- package/dist/mcp-server/tools/definitions/update-entity.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/validate-entity.tool.d.ts +45 -116
- package/dist/mcp-server/tools/definitions/validate-entity.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/validate-entity.tool.js +3 -2
- package/dist/mcp-server/tools/definitions/validate-entity.tool.js.map +1 -1
- package/dist/mcp-server/tools/index.d.ts +4 -1
- package/dist/mcp-server/tools/index.d.ts.map +1 -1
- package/dist/mcp-server/tools/index.js +7 -1
- package/dist/mcp-server/tools/index.js.map +1 -1
- package/dist/mcp-server/tools/utils/bulk-capacity.d.ts +9 -0
- package/dist/mcp-server/tools/utils/bulk-capacity.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/bulk-capacity.js +96 -0
- package/dist/mcp-server/tools/utils/bulk-capacity.js.map +1 -0
- package/dist/mcp-server/tools/utils/capture-snapshot.d.ts +5 -2
- package/dist/mcp-server/tools/utils/capture-snapshot.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/capture-snapshot.js +38 -19
- package/dist/mcp-server/tools/utils/capture-snapshot.js.map +1 -1
- package/dist/mcp-server/tools/utils/dry-run.d.ts +12 -3
- package/dist/mcp-server/tools/utils/dry-run.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/dry-run.js +46 -8
- package/dist/mcp-server/tools/utils/dry-run.js.map +1 -1
- package/dist/mcp-server/tools/utils/entity-mapping.d.ts +27 -0
- package/dist/mcp-server/tools/utils/entity-mapping.d.ts.map +1 -1
- package/dist/mcp-server/tools/utils/entity-mapping.js +105 -0
- package/dist/mcp-server/tools/utils/entity-mapping.js.map +1 -1
- package/dist/mcp-server/tools/utils/parent-ids.d.ts +16 -0
- package/dist/mcp-server/tools/utils/parent-ids.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/parent-ids.js +28 -0
- package/dist/mcp-server/tools/utils/parent-ids.js.map +1 -0
- package/dist/mcp-server/tools/utils/targeting-values.d.ts +9 -0
- package/dist/mcp-server/tools/utils/targeting-values.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/targeting-values.js +16 -0
- package/dist/mcp-server/tools/utils/targeting-values.js.map +1 -0
- package/dist/mcp-server/transports/streamable-http-transport.d.ts +22 -20
- package/dist/mcp-server/transports/streamable-http-transport.d.ts.map +1 -1
- package/dist/mcp-server/transports/streamable-http-transport.js +15 -51
- package/dist/mcp-server/transports/streamable-http-transport.js.map +1 -1
- package/dist/services/msads/msads-http-client.d.ts +5 -1
- package/dist/services/msads/msads-http-client.d.ts.map +1 -1
- package/dist/services/msads/msads-http-client.js +49 -2
- package/dist/services/msads/msads-http-client.js.map +1 -1
- package/dist/services/msads/msads-reporting-service.d.ts +3 -9
- package/dist/services/msads/msads-reporting-service.d.ts.map +1 -1
- package/dist/services/msads/msads-reporting-service.js +62 -27
- package/dist/services/msads/msads-reporting-service.js.map +1 -1
- package/dist/services/msads/msads-service.d.ts +53 -5
- package/dist/services/msads/msads-service.d.ts.map +1 -1
- package/dist/services/msads/msads-service.js +235 -35
- package/dist/services/msads/msads-service.js.map +1 -1
- package/dist/services/msads/partial-errors.d.ts +34 -0
- package/dist/services/msads/partial-errors.d.ts.map +1 -0
- package/dist/services/msads/partial-errors.js +149 -0
- package/dist/services/msads/partial-errors.js.map +1 -0
- package/dist/services/msads/rate-limit-keys.d.ts +8 -2
- package/dist/services/msads/rate-limit-keys.d.ts.map +1 -1
- package/dist/services/msads/rate-limit-keys.js +16 -2
- package/dist/services/msads/rate-limit-keys.js.map +1 -1
- package/dist/services/msads/types.d.ts +1 -2
- package/dist/services/msads/types.d.ts.map +1 -1
- package/dist/services/msads/types.js.map +1 -1
- package/dist/services/session-services.d.ts +2 -2
- package/dist/services/session-services.d.ts.map +1 -1
- package/dist/services/session-services.js +10 -10
- package/dist/services/session-services.js.map +1 -1
- package/dist/services/session-wiring.d.ts +7 -0
- package/dist/services/session-wiring.d.ts.map +1 -0
- package/dist/services/session-wiring.js +20 -0
- package/dist/services/session-wiring.js.map +1 -0
- package/dist/testkit/fixtures/index.d.ts.map +1 -1
- package/dist/testkit/fixtures/index.js +3 -3
- package/dist/testkit/fixtures/index.js.map +1 -1
- package/package.json +8 -8
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import type { DispatchedCapability, DryRunResult, NormalizedEntitySnapshot, RequestContext } from "@cesteral/shared";
|
|
1
|
+
import type { DispatchedCapability, DryRunResult, DryRunValidationError, NormalizedEntitySnapshot, RequestContext } from "@cesteral/shared";
|
|
2
2
|
import { type MsAdsServiceLike } from "./capture-snapshot.js";
|
|
3
3
|
export type { MsAdsServiceLike };
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function symbolicValidate(data: Record<string, unknown>): DryRunValidationError[];
|
|
5
|
+
export declare function applyMsAdsPatch(entityType: string, entityId: string, preState: Record<string, unknown>, data: Record<string, unknown>, currency?: string): NormalizedEntitySnapshot | undefined;
|
|
5
6
|
export declare function resolveMsAdsDispatchedCapability(entityType: string, data: Record<string, unknown>): DispatchedCapability;
|
|
6
7
|
export declare function resolveMsAdsCreateCapability(entityType: string): DispatchedCapability;
|
|
8
|
+
export declare function resolveMsAdsDuplicateCapability(entityType: string): DispatchedCapability;
|
|
9
|
+
export interface MsAdsDuplicateDryRunArgs {
|
|
10
|
+
entityType: string;
|
|
11
|
+
accountId: string;
|
|
12
|
+
entityId: string;
|
|
13
|
+
options?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export declare function runMsAdsDuplicateDryRun(input: MsAdsDuplicateDryRunArgs, service: MsAdsServiceLike, context: RequestContext): Promise<DryRunResult>;
|
|
7
16
|
export interface MsAdsCreateDryRunArgs {
|
|
8
17
|
entityType: string;
|
|
9
18
|
data: Record<string, unknown>;
|
|
10
19
|
}
|
|
11
|
-
export declare function runMsAdsCreateDryRun(input: MsAdsCreateDryRunArgs,
|
|
20
|
+
export declare function runMsAdsCreateDryRun(input: MsAdsCreateDryRunArgs, service: MsAdsServiceLike, context: RequestContext): Promise<DryRunResult>;
|
|
12
21
|
export interface MsAdsDryRunArgs {
|
|
13
22
|
entityType: string;
|
|
14
23
|
entityId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dry-run.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/dry-run.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,oBAAoB,EACpB,YAAY,
|
|
1
|
+
{"version":3,"file":"dry-run.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/dry-run.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EACV,oBAAoB,EACpB,YAAY,EACZ,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAG/B,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAqCjC,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,qBAAqB,EAAE,CA6BvF;AAYD,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ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AAsB,oBAAoB,CACxC,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,YAAY,CAAC,CA2CvB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assertGovernedDryRunResult } from "@cesteral/shared";
|
|
2
|
-
import { buildMsAdsSnapshot, ENTITY_KIND_MAP } from "./capture-snapshot.js";
|
|
2
|
+
import { buildMsAdsSnapshot, ENTITY_KIND_MAP, resolveMsAdsCurrency, } from "./capture-snapshot.js";
|
|
3
|
+
import { MSADS_DUPLICATE_COPY_STATUS } from "../../../services/msads/msads-service.js";
|
|
3
4
|
const VALID_STATUSES = [
|
|
4
5
|
"Active",
|
|
5
6
|
"Paused",
|
|
@@ -17,8 +18,8 @@ const PAUSED_STATUSES = new Set([
|
|
|
17
18
|
"Suspended",
|
|
18
19
|
"Expired",
|
|
19
20
|
]);
|
|
20
|
-
const BUDGET_FIELDS = ["Amount", "DailyBudget"
|
|
21
|
-
function symbolicValidate(data) {
|
|
21
|
+
const BUDGET_FIELDS = ["Amount", "DailyBudget"];
|
|
22
|
+
export function symbolicValidate(data) {
|
|
22
23
|
const errors = [];
|
|
23
24
|
if ("Status" in data) {
|
|
24
25
|
const status = data.Status;
|
|
@@ -45,8 +46,8 @@ function symbolicValidate(data) {
|
|
|
45
46
|
}
|
|
46
47
|
return errors;
|
|
47
48
|
}
|
|
48
|
-
export function applyMsAdsPatch(entityType, entityId, preState, data) {
|
|
49
|
-
const snapshot = buildMsAdsSnapshot(entityType, entityId, preState, data);
|
|
49
|
+
export function applyMsAdsPatch(entityType, entityId, preState, data, currency = "USD") {
|
|
50
|
+
const snapshot = buildMsAdsSnapshot(entityType, entityId, preState, data, currency);
|
|
50
51
|
return snapshot ?? undefined;
|
|
51
52
|
}
|
|
52
53
|
export function resolveMsAdsDispatchedCapability(entityType, data) {
|
|
@@ -78,12 +79,48 @@ export function resolveMsAdsCreateCapability(entityType) {
|
|
|
78
79
|
canonicalEntityKind: ENTITY_KIND_MAP[entityType] ?? null,
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
|
-
export
|
|
82
|
+
export function resolveMsAdsDuplicateCapability(entityType) {
|
|
83
|
+
return {
|
|
84
|
+
operation: "duplicate",
|
|
85
|
+
canonicalEntityKind: ENTITY_KIND_MAP[entityType] ?? null,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export async function runMsAdsDuplicateDryRun(input, service, context) {
|
|
89
|
+
const validationErrors = [];
|
|
90
|
+
let expectedPostState;
|
|
91
|
+
let expectedStateSource = "none";
|
|
92
|
+
const inScope = Boolean(ENTITY_KIND_MAP[input.entityType]);
|
|
93
|
+
if (inScope && service.getEntity) {
|
|
94
|
+
const { entities } = await service.getEntity(input.entityType, [input.entityId], { AccountId: Number(input.accountId) }, context);
|
|
95
|
+
const source = (entities[0] ?? {});
|
|
96
|
+
if (Object.keys(source).length > 0) {
|
|
97
|
+
const currency = await resolveMsAdsCurrency(service, context);
|
|
98
|
+
const snapshot = buildMsAdsSnapshot(input.entityType, "", source, {
|
|
99
|
+
...(input.options ?? {}),
|
|
100
|
+
Status: MSADS_DUPLICATE_COPY_STATUS,
|
|
101
|
+
}, currency);
|
|
102
|
+
if (snapshot) {
|
|
103
|
+
expectedPostState = snapshot;
|
|
104
|
+
expectedStateSource = "server_symbolic_apply";
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const result = {
|
|
109
|
+
wouldSucceed: validationErrors.length === 0 && (!inScope || expectedPostState !== undefined),
|
|
110
|
+
validationErrors,
|
|
111
|
+
validationSource: "symbolic",
|
|
112
|
+
expectedStateSource,
|
|
113
|
+
...(expectedPostState ? { expectedPostState } : {}),
|
|
114
|
+
};
|
|
115
|
+
return inScope ? assertGovernedDryRunResult(result, "msads_duplicate_entity") : result;
|
|
116
|
+
}
|
|
117
|
+
export async function runMsAdsCreateDryRun(input, service, context) {
|
|
82
118
|
const validationErrors = symbolicValidate(input.data);
|
|
83
119
|
let expectedPostState;
|
|
84
120
|
let expectedStateSource = "none";
|
|
85
121
|
if (ENTITY_KIND_MAP[input.entityType]) {
|
|
86
|
-
const
|
|
122
|
+
const currency = await resolveMsAdsCurrency(service, context);
|
|
123
|
+
const snapshot = buildMsAdsSnapshot(input.entityType, "", {}, input.data, currency);
|
|
87
124
|
if (snapshot) {
|
|
88
125
|
expectedPostState = snapshot;
|
|
89
126
|
expectedStateSource = "server_symbolic_apply";
|
|
@@ -107,7 +144,8 @@ export async function runMsAdsUpdateDryRun(input, service, context) {
|
|
|
107
144
|
const { entities } = await service.getEntity(input.entityType, [input.entityId], input.readParams, context);
|
|
108
145
|
const current = entities?.[0];
|
|
109
146
|
if (current && typeof current === "object") {
|
|
110
|
-
const
|
|
147
|
+
const currency = await resolveMsAdsCurrency(service, context);
|
|
148
|
+
const snapshot = buildMsAdsSnapshot(input.entityType, input.entityId, current, input.data, currency);
|
|
111
149
|
if (snapshot) {
|
|
112
150
|
expectedPostState = snapshot;
|
|
113
151
|
expectedStateSource = "server_symbolic_apply";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dry-run.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/dry-run.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAQ9D,OAAO,
|
|
1
|
+
{"version":3,"file":"dry-run.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/dry-run.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAQ9D,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,GAErB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAUvF,MAAM,cAAc,GAAG;IACrB,QAAQ;IACR,QAAQ;IACR,cAAc;IACd,uBAAuB;IACvB,WAAW;IAC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AAG,kBAAkB,CACjC,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,QAAQ,EACd,OAAO,EACP,KAAK,CAAC,IAAI,EACV,QAAQ,CACT,CAAC;YACF,IAAI,QAAQ,EAAE,CAAC;gBACb,iBAAiB,GAAG,QAAQ,CAAC;gBAC7B,mBAAmB,GAAG,uBAAuB,CAAC;YAChD,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,0BAA0B,CAC/B;QACE,YAAY,EAAE,gBAAgB,CAAC,MAAM,KAAK,CAAC;QAC3C,gBAAgB;QAChB,gBAAgB,EAAE,UAAU;QAC5B,mBAAmB;QACnB,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD,EACD,qBAAqB,CACtB,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
export type MsAdsEntityType = "campaign" | "adGroup" | "ad" | "keyword" | "budget" | "adExtension" | "audience" | "label";
|
|
2
3
|
export interface MsAdsEntityConfig {
|
|
3
4
|
addOperation: string;
|
|
@@ -13,8 +14,34 @@ export interface MsAdsEntityConfig {
|
|
|
13
14
|
idsField: string;
|
|
14
15
|
batchLimit: number;
|
|
15
16
|
requiredGetByIdsFields?: string[];
|
|
17
|
+
supportsDuplicate?: boolean;
|
|
18
|
+
writeParentIdField?: MsAdsWriteParentIdField;
|
|
19
|
+
deleteParentIdFields?: readonly string[];
|
|
20
|
+
defaultReadFields?: Record<string, unknown>;
|
|
16
21
|
}
|
|
22
|
+
export type MsAdsWriteParentIdField = "AccountId" | "CampaignId" | "AdGroupId";
|
|
23
|
+
export declare const MSADS_ALL_CAMPAIGN_TYPES = "Search, Shopping, DynamicSearchAds, Audience, Hotel, PerformanceMax, App";
|
|
17
24
|
export declare function getEntityConfig(entityType: MsAdsEntityType): MsAdsEntityConfig;
|
|
18
25
|
export declare function getSupportedEntityTypes(): MsAdsEntityType[];
|
|
19
26
|
export declare function getEntityTypeEnum(): [string, ...string[]];
|
|
27
|
+
export declare function getDuplicateSupportedEntityTypes(): MsAdsEntityType[];
|
|
28
|
+
export declare function getDuplicateEntityTypeEnum(): [string, ...string[]];
|
|
29
|
+
export declare function getWriteParent(entityType: MsAdsEntityType): {
|
|
30
|
+
bodyField: MsAdsWriteParentIdField;
|
|
31
|
+
inputKey: "accountId" | "campaignId" | "adGroupId";
|
|
32
|
+
} | undefined;
|
|
33
|
+
export declare function missingWriteParentMessage(entityType: MsAdsEntityType, parentIds: {
|
|
34
|
+
accountId?: string;
|
|
35
|
+
campaignId?: string;
|
|
36
|
+
adGroupId?: string;
|
|
37
|
+
}): string | undefined;
|
|
38
|
+
export declare function missingDeleteParentMessage(entityType: MsAdsEntityType, params: Record<string, unknown> | undefined): string | undefined;
|
|
39
|
+
export type MsAdsEntityContextKey = "accountId" | "campaignId" | "adGroupId" | "adExtensionType";
|
|
40
|
+
export type MsAdsEntityContext = Partial<Record<MsAdsEntityContextKey, string>>;
|
|
41
|
+
export declare function getEntityContextKeys(entityType: MsAdsEntityType): MsAdsEntityContextKey[];
|
|
42
|
+
export declare function pickEntityContext(entityType: MsAdsEntityType, input: MsAdsEntityContext): MsAdsEntityContext;
|
|
43
|
+
export declare function entityContextReadParams(context: MsAdsEntityContext): Record<string, unknown>;
|
|
44
|
+
export declare function refineEntityContext(input: MsAdsEntityContext & {
|
|
45
|
+
entityType: string;
|
|
46
|
+
}, ctx: z.RefinementCtx): void;
|
|
20
47
|
//# sourceMappingURL=entity-mapping.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-mapping.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/entity-mapping.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entity-mapping.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/entity-mapping.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,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
2
|
+
import { z } from "zod";
|
|
3
|
+
export const MSADS_ALL_CAMPAIGN_TYPES = "Search, Shopping, DynamicSearchAds, Audience, Hotel, PerformanceMax, App";
|
|
2
4
|
const ENTITY_CONFIGS = {
|
|
3
5
|
campaign: {
|
|
4
6
|
addOperation: "/Campaigns",
|
|
@@ -12,6 +14,10 @@ const ENTITY_CONFIGS = {
|
|
|
12
14
|
idsField: "CampaignIds",
|
|
13
15
|
batchLimit: 100,
|
|
14
16
|
requiredGetByIdsFields: ["AccountId"],
|
|
17
|
+
supportsDuplicate: true,
|
|
18
|
+
writeParentIdField: "AccountId",
|
|
19
|
+
deleteParentIdFields: ["AccountId"],
|
|
20
|
+
defaultReadFields: { CampaignType: MSADS_ALL_CAMPAIGN_TYPES },
|
|
15
21
|
},
|
|
16
22
|
adGroup: {
|
|
17
23
|
addOperation: "/AdGroups",
|
|
@@ -26,6 +32,8 @@ const ENTITY_CONFIGS = {
|
|
|
26
32
|
idsField: "AdGroupIds",
|
|
27
33
|
batchLimit: 1000,
|
|
28
34
|
requiredGetByIdsFields: ["CampaignId"],
|
|
35
|
+
writeParentIdField: "CampaignId",
|
|
36
|
+
deleteParentIdFields: ["CampaignId"],
|
|
29
37
|
},
|
|
30
38
|
ad: {
|
|
31
39
|
addOperation: "/Ads",
|
|
@@ -40,6 +48,8 @@ const ENTITY_CONFIGS = {
|
|
|
40
48
|
idsField: "AdIds",
|
|
41
49
|
batchLimit: 50,
|
|
42
50
|
requiredGetByIdsFields: ["AdGroupId"],
|
|
51
|
+
writeParentIdField: "AdGroupId",
|
|
52
|
+
deleteParentIdFields: ["AdGroupId"],
|
|
43
53
|
},
|
|
44
54
|
keyword: {
|
|
45
55
|
addOperation: "/Keywords",
|
|
@@ -54,6 +64,8 @@ const ENTITY_CONFIGS = {
|
|
|
54
64
|
idsField: "KeywordIds",
|
|
55
65
|
batchLimit: 1000,
|
|
56
66
|
requiredGetByIdsFields: ["AdGroupId"],
|
|
67
|
+
writeParentIdField: "AdGroupId",
|
|
68
|
+
deleteParentIdFields: ["AdGroupId", "AssetGroupId"],
|
|
57
69
|
},
|
|
58
70
|
budget: {
|
|
59
71
|
addOperation: "/Budgets",
|
|
@@ -77,6 +89,8 @@ const ENTITY_CONFIGS = {
|
|
|
77
89
|
idsField: "AdExtensionIds",
|
|
78
90
|
batchLimit: 100,
|
|
79
91
|
requiredGetByIdsFields: ["AccountId", "AdExtensionType"],
|
|
92
|
+
writeParentIdField: "AccountId",
|
|
93
|
+
deleteParentIdFields: ["AccountId"],
|
|
80
94
|
},
|
|
81
95
|
audience: {
|
|
82
96
|
addOperation: "/Audiences",
|
|
@@ -115,4 +129,95 @@ export function getEntityTypeEnum() {
|
|
|
115
129
|
const types = getSupportedEntityTypes();
|
|
116
130
|
return types;
|
|
117
131
|
}
|
|
132
|
+
export function getDuplicateSupportedEntityTypes() {
|
|
133
|
+
return Object.entries(ENTITY_CONFIGS)
|
|
134
|
+
.filter(([, config]) => config.supportsDuplicate)
|
|
135
|
+
.map(([type]) => type);
|
|
136
|
+
}
|
|
137
|
+
export function getDuplicateEntityTypeEnum() {
|
|
138
|
+
return getDuplicateSupportedEntityTypes();
|
|
139
|
+
}
|
|
140
|
+
const PARENT_INPUT_KEYS = {
|
|
141
|
+
AccountId: "accountId",
|
|
142
|
+
CampaignId: "campaignId",
|
|
143
|
+
AdGroupId: "adGroupId",
|
|
144
|
+
};
|
|
145
|
+
export function getWriteParent(entityType) {
|
|
146
|
+
const field = getEntityConfig(entityType).writeParentIdField;
|
|
147
|
+
return field ? { bodyField: field, inputKey: PARENT_INPUT_KEYS[field] } : undefined;
|
|
148
|
+
}
|
|
149
|
+
export function missingWriteParentMessage(entityType, parentIds) {
|
|
150
|
+
const parent = getWriteParent(entityType);
|
|
151
|
+
if (!parent)
|
|
152
|
+
return undefined;
|
|
153
|
+
const value = parentIds[parent.inputKey];
|
|
154
|
+
if (typeof value === "string" && value.trim().length > 0)
|
|
155
|
+
return undefined;
|
|
156
|
+
return `${parent.inputKey} is required for entityType '${entityType}' — Microsoft Ads needs ${parent.bodyField} in the request body next to the ${getEntityConfig(entityType).pluralName} array`;
|
|
157
|
+
}
|
|
158
|
+
export function missingDeleteParentMessage(entityType, params) {
|
|
159
|
+
const config = getEntityConfig(entityType);
|
|
160
|
+
const fields = config.deleteParentIdFields ?? [];
|
|
161
|
+
if (fields.length === 0)
|
|
162
|
+
return undefined;
|
|
163
|
+
const present = fields.some((field) => {
|
|
164
|
+
const value = params?.[field];
|
|
165
|
+
if (typeof value === "number")
|
|
166
|
+
return Number.isFinite(value);
|
|
167
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
168
|
+
});
|
|
169
|
+
if (present)
|
|
170
|
+
return undefined;
|
|
171
|
+
const names = fields.map((f) => `additionalParams.${f}`).join(" or ");
|
|
172
|
+
return `${names} is required for entityType '${entityType}' — Microsoft Ads' Delete${config.pluralName} request needs ${fields.join(" or ")} next to ${config.idsField}`;
|
|
173
|
+
}
|
|
174
|
+
const CONTEXT_INPUT_KEYS = {
|
|
175
|
+
AccountId: "accountId",
|
|
176
|
+
CampaignId: "campaignId",
|
|
177
|
+
AdGroupId: "adGroupId",
|
|
178
|
+
AdExtensionType: "adExtensionType",
|
|
179
|
+
};
|
|
180
|
+
export function getEntityContextKeys(entityType) {
|
|
181
|
+
return (getEntityConfig(entityType).requiredGetByIdsFields ?? []).map((field) => {
|
|
182
|
+
const key = CONTEXT_INPUT_KEYS[field];
|
|
183
|
+
if (!key)
|
|
184
|
+
throw new Error(`No tool input key for Get*ByIds field ${field}`);
|
|
185
|
+
return key;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
export function pickEntityContext(entityType, input) {
|
|
189
|
+
const picked = {};
|
|
190
|
+
for (const key of getEntityContextKeys(entityType)) {
|
|
191
|
+
const value = input[key];
|
|
192
|
+
if (typeof value === "string")
|
|
193
|
+
picked[key] = value;
|
|
194
|
+
}
|
|
195
|
+
return picked;
|
|
196
|
+
}
|
|
197
|
+
export function entityContextReadParams(context) {
|
|
198
|
+
const params = {};
|
|
199
|
+
if (context.accountId !== undefined)
|
|
200
|
+
params.AccountId = Number(context.accountId);
|
|
201
|
+
if (context.campaignId !== undefined)
|
|
202
|
+
params.CampaignId = Number(context.campaignId);
|
|
203
|
+
if (context.adGroupId !== undefined)
|
|
204
|
+
params.AdGroupId = Number(context.adGroupId);
|
|
205
|
+
if (context.adExtensionType !== undefined)
|
|
206
|
+
params.AdExtensionType = context.adExtensionType;
|
|
207
|
+
return params;
|
|
208
|
+
}
|
|
209
|
+
export function refineEntityContext(input, ctx) {
|
|
210
|
+
if (!(input.entityType in ENTITY_CONFIGS))
|
|
211
|
+
return;
|
|
212
|
+
for (const key of getEntityContextKeys(input.entityType)) {
|
|
213
|
+
const value = input[key];
|
|
214
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
215
|
+
ctx.addIssue({
|
|
216
|
+
code: z.ZodIssueCode.custom,
|
|
217
|
+
path: [key],
|
|
218
|
+
message: `${key} is required when entityType is ${input.entityType}`,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
118
223
|
//# sourceMappingURL=entity-mapping.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity-mapping.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/entity-mapping.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"entity-mapping.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/entity-mapping.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuFxB,MAAM,CAAC,MAAM,wBAAwB,GACnC,0EAA0E,CAAC;AAE7E,MAAM,cAAc,GAA+C;IACjE,QAAQ,EA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CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { DryRunValidationError } from "@cesteral/shared";
|
|
3
|
+
export declare const parentIdInputFields: {
|
|
4
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
5
|
+
campaignId: z.ZodOptional<z.ZodString>;
|
|
6
|
+
adGroupId: z.ZodOptional<z.ZodString>;
|
|
7
|
+
};
|
|
8
|
+
export interface ParentIdInput {
|
|
9
|
+
entityType: string;
|
|
10
|
+
accountId?: string;
|
|
11
|
+
campaignId?: string;
|
|
12
|
+
adGroupId?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function resolveParentId(input: ParentIdInput): string | undefined;
|
|
15
|
+
export declare function validateParentId(input: ParentIdInput): DryRunValidationError[];
|
|
16
|
+
//# sourceMappingURL=parent-ids.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parent-ids.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/parent-ids.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAO9D,eAAO,MAAM,mBAAmB;;;;CAmB/B,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,wBAAgB,eAAe,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAGxE;AAGD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,GAAG,qBAAqB,EAAE,CAK9E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getWriteParent, missingWriteParentMessage, } from "./entity-mapping.js";
|
|
3
|
+
export const parentIdInputFields = {
|
|
4
|
+
accountId: z
|
|
5
|
+
.string()
|
|
6
|
+
.optional()
|
|
7
|
+
.describe("Required for campaign and adExtension: the account that owns them, sent as the request-body AccountId"),
|
|
8
|
+
campaignId: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe("Required for adGroup: the campaign that owns every ad group in this call, sent as the request-body CampaignId"),
|
|
12
|
+
adGroupId: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Required for ad and keyword: the ad group that owns every item in this call, sent as the request-body AdGroupId"),
|
|
16
|
+
};
|
|
17
|
+
export function resolveParentId(input) {
|
|
18
|
+
const parent = getWriteParent(input.entityType);
|
|
19
|
+
return parent ? input[parent.inputKey] : undefined;
|
|
20
|
+
}
|
|
21
|
+
export function validateParentId(input) {
|
|
22
|
+
const message = missingWriteParentMessage(input.entityType, input);
|
|
23
|
+
if (!message)
|
|
24
|
+
return [];
|
|
25
|
+
const parent = getWriteParent(input.entityType);
|
|
26
|
+
return [{ code: "MISSING_PARENT_ID", message, field: parent?.inputKey ?? "parentId" }];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=parent-ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parent-ids.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/parent-ids.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,cAAc,EACd,yBAAyB,GAE1B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,uGAAuG,CACxG;IACH,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,+GAA+G,CAChH;IACH,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,iHAAiH,CAClH;CACJ,CAAC;AAUF,MAAM,UAAU,eAAe,CAAC,KAAoB;IAClD,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,UAA6B,CAAC,CAAC;IACnE,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC;AAGD,MAAM,UAAU,gBAAgB,CAAC,KAAoB;IACnD,MAAM,OAAO,GAAG,yBAAyB,CAAC,KAAK,CAAC,UAA6B,EAAE,KAAK,CAAC,CAAC;IACtF,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,UAA6B,CAAC,CAAC;IACnE,OAAO,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,IAAI,UAAU,EAAE,CAAC,CAAC;AACzF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targeting-values.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/targeting-values.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,gBAAgB,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CASxE,CAAC;AAMF,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAIrE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const MSADS_AGE_RANGES = [
|
|
2
|
+
{ Id: "EighteenToTwentyFour", Name: "18-24" },
|
|
3
|
+
{ Id: "TwentyFiveToThirtyFour", Name: "25-34" },
|
|
4
|
+
{ Id: "ThirtyFiveToFourtyNine", Name: "35-49" },
|
|
5
|
+
{ Id: "ThirtyFiveToFiftyFour", Name: "35-54" },
|
|
6
|
+
{ Id: "FiftyToSixtyFour", Name: "50-64" },
|
|
7
|
+
{ Id: "FiftyFiveAndAbove", Name: "55+" },
|
|
8
|
+
{ Id: "SixtyFiveAndAbove", Name: "65+" },
|
|
9
|
+
{ Id: "Unknown", Name: "Unknown age" },
|
|
10
|
+
];
|
|
11
|
+
export const MSADS_GENDERS = [
|
|
12
|
+
{ Id: "Male", Name: "Male" },
|
|
13
|
+
{ Id: "Female", Name: "Female" },
|
|
14
|
+
{ Id: "Unknown", Name: "Unknown (Audience campaign ad groups only)" },
|
|
15
|
+
];
|
|
16
|
+
//# sourceMappingURL=targeting-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"targeting-values.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/utils/targeting-values.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,gBAAgB,GAAgD;IAC3E,EAAE,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,OAAO,EAAE;IAC7C,EAAE,EAAE,EAAE,wBAAwB,EAAE,IAAI,EAAE,OAAO,EAAE;IAC/C,EAAE,EAAE,EAAE,wBAAwB,EAAE,IAAI,EAAE,OAAO,EAAE;IAC/C,EAAE,EAAE,EAAE,uBAAuB,EAAE,IAAI,EAAE,OAAO,EAAE;IAC9C,EAAE,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,OAAO,EAAE;IACzC,EAAE,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,KAAK,EAAE;IACxC,EAAE,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,KAAK,EAAE;IACxC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE;CACvC,CAAC;AAMF,MAAM,CAAC,MAAM,aAAa,GAAgD;IACxE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;IAC5B,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;IAChC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,4CAA4C,EAAE;CACtE,CAAC"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { Logger } from "pino";
|
|
2
2
|
export declare const createMcpHttpServer: (config: {
|
|
3
|
+
host: string;
|
|
4
|
+
nodeEnv: "development" | "production" | "test";
|
|
5
|
+
mcpStatefulSessionTimeoutMs: number;
|
|
6
|
+
logLevel: "error" | "info" | "debug" | "warning" | "notice";
|
|
7
|
+
mcpLogLevel: "error" | "info" | "debug" | "warning" | "notice";
|
|
8
|
+
otelEnabled: boolean;
|
|
3
9
|
serviceName: string;
|
|
4
10
|
port: number;
|
|
5
11
|
otelServiceName: string;
|
|
@@ -10,22 +16,23 @@ export declare const createMcpHttpServer: (config: {
|
|
|
10
16
|
msadsRateLimitPerMinute: number;
|
|
11
17
|
msadsReportPollIntervalMs: number;
|
|
12
18
|
msadsReportMaxPollAttempts: number;
|
|
13
|
-
host: string;
|
|
14
|
-
nodeEnv: "development" | "production" | "test";
|
|
15
|
-
mcpStatefulSessionTimeoutMs: number;
|
|
16
|
-
logLevel: "debug" | "info" | "notice" | "warning" | "error";
|
|
17
|
-
mcpLogLevel: "debug" | "info" | "notice" | "warning" | "error";
|
|
18
|
-
otelEnabled: boolean;
|
|
19
|
-
msadsAccessToken?: string | undefined;
|
|
20
|
-
msadsDeveloperToken?: string | undefined;
|
|
21
|
-
msadsCustomerId?: string | undefined;
|
|
22
|
-
msadsAccountId?: string | undefined;
|
|
23
19
|
mcpAuthSecretKey?: string | undefined;
|
|
24
20
|
mcpAllowedOrigins?: string | undefined;
|
|
21
|
+
mcpAllowedHosts?: string | undefined;
|
|
25
22
|
otelExporterOtlpTracesEndpoint?: string | undefined;
|
|
26
23
|
otelExporterOtlpMetricsEndpoint?: string | undefined;
|
|
27
24
|
gcsBucketName?: string | undefined;
|
|
25
|
+
msadsAccessToken?: string | undefined;
|
|
26
|
+
msadsDeveloperToken?: string | undefined;
|
|
27
|
+
msadsCustomerId?: string | undefined;
|
|
28
|
+
msadsAccountId?: string | undefined;
|
|
28
29
|
}, logger: Logger) => ReturnType<typeof import("@cesteral/shared").createMcpHttpTransport>, startHttpServer: (config: {
|
|
30
|
+
host: string;
|
|
31
|
+
nodeEnv: "development" | "production" | "test";
|
|
32
|
+
mcpStatefulSessionTimeoutMs: number;
|
|
33
|
+
logLevel: "error" | "info" | "debug" | "warning" | "notice";
|
|
34
|
+
mcpLogLevel: "error" | "info" | "debug" | "warning" | "notice";
|
|
35
|
+
otelEnabled: boolean;
|
|
29
36
|
serviceName: string;
|
|
30
37
|
port: number;
|
|
31
38
|
otelServiceName: string;
|
|
@@ -36,20 +43,15 @@ export declare const createMcpHttpServer: (config: {
|
|
|
36
43
|
msadsRateLimitPerMinute: number;
|
|
37
44
|
msadsReportPollIntervalMs: number;
|
|
38
45
|
msadsReportMaxPollAttempts: number;
|
|
39
|
-
host: string;
|
|
40
|
-
nodeEnv: "development" | "production" | "test";
|
|
41
|
-
mcpStatefulSessionTimeoutMs: number;
|
|
42
|
-
logLevel: "debug" | "info" | "notice" | "warning" | "error";
|
|
43
|
-
mcpLogLevel: "debug" | "info" | "notice" | "warning" | "error";
|
|
44
|
-
otelEnabled: boolean;
|
|
45
|
-
msadsAccessToken?: string | undefined;
|
|
46
|
-
msadsDeveloperToken?: string | undefined;
|
|
47
|
-
msadsCustomerId?: string | undefined;
|
|
48
|
-
msadsAccountId?: string | undefined;
|
|
49
46
|
mcpAuthSecretKey?: string | undefined;
|
|
50
47
|
mcpAllowedOrigins?: string | undefined;
|
|
48
|
+
mcpAllowedHosts?: string | undefined;
|
|
51
49
|
otelExporterOtlpTracesEndpoint?: string | undefined;
|
|
52
50
|
otelExporterOtlpMetricsEndpoint?: string | undefined;
|
|
53
51
|
gcsBucketName?: string | undefined;
|
|
52
|
+
msadsAccessToken?: string | undefined;
|
|
53
|
+
msadsDeveloperToken?: string | undefined;
|
|
54
|
+
msadsCustomerId?: string | undefined;
|
|
55
|
+
msadsAccountId?: string | undefined;
|
|
54
56
|
}, logger: Logger) => Promise<import("@cesteral/shared").McpHttpServer>;
|
|
55
57
|
//# sourceMappingURL=streamable-http-transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamable-http-transport.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/transports/streamable-http-transport.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"streamable-http-transport.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/transports/streamable-http-transport.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAqEnC,eAAO,MAAQ,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;4FAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;uEACS,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createMcpServer } from "../server.js";
|
|
2
|
-
import { createAuthStrategy, buildServerCardExtras, createTransportEntrypoints, } from "@cesteral/shared";
|
|
2
|
+
import { createAuthStrategy, buildServerCardExtras, createTransportEntrypoints, createSessionForAuthWithEnvFallback, } from "@cesteral/shared";
|
|
3
3
|
import { MsAdsBearerAuthStrategy } from "../../auth/msads-auth-strategy.js";
|
|
4
|
-
import {
|
|
4
|
+
import { sessionServiceStore } from "../../services/session-services.js";
|
|
5
|
+
import { buildEnvAuthAdapter, buildSessionServices } from "../../services/session-wiring.js";
|
|
5
6
|
import { rateLimiter } from "../../utils/platform.js";
|
|
7
|
+
import { MSADS_RETRY_CONFIG } from "../../services/msads/msads-http-client.js";
|
|
6
8
|
function buildPlatformConfig(config, logger) {
|
|
7
9
|
return {
|
|
8
10
|
authStrategy: config.mcpAuthMode === "msads-bearer"
|
|
@@ -26,56 +28,18 @@ function buildPlatformConfig(config, logger) {
|
|
|
26
28
|
: "Provide a valid Bearer token in the Authorization header.",
|
|
27
29
|
sessionServiceStore,
|
|
28
30
|
rateLimiter,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (adapter) {
|
|
32
|
-
const cfg = appConfig;
|
|
33
|
-
const services = createSessionServices(adapter, {
|
|
34
|
-
campaignApiBaseUrl: cfg.msadsCampaignApiBaseUrl,
|
|
35
|
-
reportingApiBaseUrl: cfg.msadsReportingApiBaseUrl,
|
|
36
|
-
customerApiBaseUrl: cfg.msadsCustomerApiBaseUrl,
|
|
37
|
-
reportPollIntervalMs: cfg.msadsReportPollIntervalMs,
|
|
38
|
-
reportMaxPollAttempts: cfg.msadsReportMaxPollAttempts,
|
|
39
|
-
}, log, rateLimiter);
|
|
40
|
-
sessionServiceStore.set(sessionId, services, authResult.credentialFingerprint);
|
|
41
|
-
return { services };
|
|
42
|
-
}
|
|
43
|
-
if (appConfig.mcpAuthMode === "none" || appConfig.mcpAuthMode === "jwt") {
|
|
44
|
-
const cfg = appConfig;
|
|
45
|
-
const { msadsAccessToken, msadsDeveloperToken, msadsCustomerId, msadsAccountId } = cfg;
|
|
46
|
-
if (msadsAccessToken && msadsDeveloperToken && msadsCustomerId && msadsAccountId) {
|
|
47
|
-
const { MsAdsAccessTokenAdapter } = await import("../../auth/msads-auth-adapter.js");
|
|
48
|
-
const envAdapter = new MsAdsAccessTokenAdapter(msadsAccessToken, msadsDeveloperToken, msadsCustomerId, msadsAccountId, cfg.msadsCustomerApiBaseUrl);
|
|
49
|
-
await envAdapter.validate();
|
|
50
|
-
const services = createSessionServices(envAdapter, {
|
|
51
|
-
campaignApiBaseUrl: cfg.msadsCampaignApiBaseUrl,
|
|
52
|
-
reportingApiBaseUrl: cfg.msadsReportingApiBaseUrl,
|
|
53
|
-
customerApiBaseUrl: cfg.msadsCustomerApiBaseUrl,
|
|
54
|
-
reportPollIntervalMs: cfg.msadsReportPollIntervalMs,
|
|
55
|
-
reportMaxPollAttempts: cfg.msadsReportMaxPollAttempts,
|
|
56
|
-
}, log, rateLimiter);
|
|
57
|
-
sessionServiceStore.set(sessionId, services, authResult.credentialFingerprint);
|
|
58
|
-
return { services };
|
|
59
|
-
}
|
|
60
|
-
if (appConfig.mcpAuthMode !== "none") {
|
|
61
|
-
return {
|
|
62
|
-
services: null,
|
|
63
|
-
error: {
|
|
64
|
-
message: "Microsoft Ads credentials required. Set MSADS_ACCESS_TOKEN, MSADS_DEVELOPER_TOKEN, MSADS_CUSTOMER_ID, and MSADS_ACCOUNT_ID env vars, or use MCP_AUTH_MODE=msads-bearer.",
|
|
65
|
-
status: 400,
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
return { services: null };
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
services: null,
|
|
73
|
-
error: {
|
|
74
|
-
message: "Microsoft Ads API credentials required for this server.",
|
|
75
|
-
status: 400,
|
|
76
|
-
},
|
|
77
|
-
};
|
|
31
|
+
retryDescriptor: {
|
|
32
|
+
maxRetries: MSADS_RETRY_CONFIG.maxRetries,
|
|
78
33
|
},
|
|
34
|
+
createSessionForAuth: createSessionForAuthWithEnvFallback({
|
|
35
|
+
sessionServiceStore,
|
|
36
|
+
adapterFromAuth: (authResult) => authResult.platformAuthAdapter,
|
|
37
|
+
validateAuthAdapter: false,
|
|
38
|
+
buildServices: buildSessionServices,
|
|
39
|
+
buildEnvAdapter: buildEnvAuthAdapter,
|
|
40
|
+
credentialsRequiredMessage: "Microsoft Ads credentials required. Set MSADS_ACCESS_TOKEN, MSADS_DEVELOPER_TOKEN, MSADS_CUSTOMER_ID, and MSADS_ACCOUNT_ID env vars, or use MCP_AUTH_MODE=msads-bearer.",
|
|
41
|
+
unsupportedModeMessage: "Microsoft Ads API credentials required for this server.",
|
|
42
|
+
}),
|
|
79
43
|
async createMcpServer(log, sessionId, gcsBucket) {
|
|
80
44
|
return createMcpServer(log, sessionId, gcsBucket);
|
|
81
45
|
},
|