@advertising-chat/mcp 0.17.3 → 0.18.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 +24 -36
- package/bin/cli.js +1 -1
- package/bin/client.d.ts +5 -2
- package/bin/client.js.map +1 -1
- package/bin/index.d.ts +3 -4
- package/bin/index.js +3 -4
- package/bin/index.js.map +1 -1
- package/bin/routeInventory.d.ts +8 -19
- package/bin/routeInventory.js +2 -61
- package/bin/routeInventory.js.map +1 -1
- package/bin/serve.js +9 -9
- package/bin/serve.js.map +1 -1
- package/bin/server.d.ts +2 -2
- package/bin/server.js +8 -9
- package/bin/server.js.map +1 -1
- package/bin/tool.d.ts +8 -11
- package/bin/tool.js +0 -1
- package/bin/tool.js.map +1 -1
- package/bin/tools/account.js +2 -2
- package/bin/tools/account.js.map +1 -1
- package/bin/tools/decisions.d.ts +8 -1
- package/bin/tools/decisions.js +78 -57
- package/bin/tools/decisions.js.map +1 -1
- package/bin/tools/docs.js +4 -4
- package/bin/tools/docs.js.map +1 -1
- package/bin/tools/index.d.ts +1 -6
- package/bin/tools/index.js +0 -15
- package/bin/tools/index.js.map +1 -1
- package/bin/tools/moments.js +27 -25
- package/bin/tools/moments.js.map +1 -1
- package/bin/tools/network.js +8 -8
- package/bin/tools/network.js.map +1 -1
- package/bin/tools/results.d.ts +0 -1
- package/bin/tools/results.js +7 -23
- package/bin/tools/results.js.map +1 -1
- package/bin/tools/shared.d.ts +5 -7
- package/bin/tools/shared.js +9 -34
- package/bin/tools/shared.js.map +1 -1
- package/bin/version.d.ts +1 -1
- package/bin/version.js +1 -1
- package/package.json +36 -9
- package/bin/tools/attributes.d.ts +0 -10
- package/bin/tools/attributes.js +0 -200
- package/bin/tools/attributes.js.map +0 -1
- package/bin/tools/offers.d.ts +0 -11
- package/bin/tools/offers.js +0 -239
- package/bin/tools/offers.js.map +0 -1
- package/bin/tools/rules.d.ts +0 -9
- package/bin/tools/rules.js +0 -318
- package/bin/tools/rules.js.map +0 -1
- package/bin/tools/settings.d.ts +0 -3
- package/bin/tools/settings.js +0 -54
- package/bin/tools/settings.js.map +0 -1
- package/bin/tools/translation.d.ts +0 -6
- package/bin/tools/translation.js +0 -139
- package/bin/tools/translation.js.map +0 -1
package/bin/tools/moments.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moments.js","sourceRoot":"","sources":["../../src/tools/moments.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"moments.js","sourceRoot":"","sources":["../../src/tools/moments.ts"],"names":[],"mappings":";;;AA2DA,8BASC;AApED;;;;GAIG;AACH,6BAAwB;AACxB,kCAAqC;AACrC,qCAiBkB;AAElB,iFAAiF;AACjF,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,eAAe,CAAU,CAAC;AAE3D,MAAM,IAAI,GAAG,OAAC;KACX,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,QAAQ,CACP,6GAA6G,CAC9G,CAAC;AAEJ,MAAM,WAAW,GAAG,OAAC;KAClB,MAAM,EAAE;KACR,GAAG,CAAC,IAAI,CAAC;KACT,QAAQ,CACP,mGAAmG,CACpG,CAAC;AAEJ,MAAM,MAAM,GAAG,OAAC;KACb,IAAI,CAAC,cAAc,CAAC;KACpB,QAAQ,CACP,sEAAsE,CACvE,CAAC;AAEJ,+DAA+D;AAC/D,MAAM,YAAY,GAA2B;IAC3C,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,aAAa;IAC1B,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,qCAAqC;AACrC,SAAgB,SAAS,CAAC,CAAM;IAC9B,OAAO;QACL,EAAE,EAAE,IAAA,YAAG,EAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAA,YAAG,EAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,IAAI,EAAE,IAAA,YAAG,EAA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AI;QACxB,OAAO,MAAM,CAAC,KAAK,CACjB,GAAG,WAAE,WAAW,IAAA,YAAG,EAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAC9B,IAAA,kBAAS,EAAC,IAAI,EAAE,CAAC,aAAa,CAAC,CAAC,CACjC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,YAAY,GAAG,IAAA,iBAAU,EAAC;IACrC,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,oBAAoB;IAC3B,WAAW,EACT,kQAAkQ;IACpQ,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,QAAQ;IACnB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,EAAE,EAAE,EAAE,IAAA,WAAE,EAAC,WAAW,CAAC,EAAE;IAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAC1B,UAAU,IAAA,cAAK,EAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC,6DAA6D;IACzG,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE;QACpC,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,WAAE,WAAW,IAAA,YAAG,EAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG;IACzB,mBAAW;IACX,iBAAS;IACT,oBAAY;IACZ,oBAAY;IACZ,oBAAY;CACb,CAAC"}
|
package/bin/tools/network.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.networkTools = exports.setNetworkAds = exports.getNetworkStatus = exports.NETWORK_STATUS_MEANINGS = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Ads from the network, per agent: one switch that turns the network's
|
|
6
|
-
* ads on or off at chosen
|
|
6
|
+
* ads on or off at chosen placements of the agent
|
|
7
7
|
* (`/system/offer-manager/application/:id/network`). Any workspace may use
|
|
8
8
|
* it; the server owns the agent's network rule and enrollment.
|
|
9
9
|
*/
|
|
@@ -14,7 +14,7 @@ const shared_1 = require("./shared");
|
|
|
14
14
|
exports.NETWORK_STATUS_MEANINGS = {
|
|
15
15
|
none: 'Not enrolled: ads from the network are off for this agent.',
|
|
16
16
|
pending: 'Enrolled and waiting for approval; no network ads appear yet.',
|
|
17
|
-
approved: 'Approved: network ads can appear at the chosen
|
|
17
|
+
approved: 'Approved: network ads can appear at the chosen placements.',
|
|
18
18
|
rejected: 'The network declined this agent; no network ads appear. Our team can say why.',
|
|
19
19
|
};
|
|
20
20
|
const momentRef = (m) => ({
|
|
@@ -25,7 +25,7 @@ const momentRef = (m) => ({
|
|
|
25
25
|
exports.getNetworkStatus = (0, tool_1.defineTool)({
|
|
26
26
|
name: 'get_network_status',
|
|
27
27
|
title: 'Ads from the network for an agent',
|
|
28
|
-
description: 'Whether ads from the network are on for one agent: `on`, the enrollment `status` (none, pending, approved, rejected) with its meaning, the
|
|
28
|
+
description: 'Whether ads from the network are on for one agent: `on`, the enrollment `status` (none, pending, approved, rejected) with its meaning, the placements where network ads may appear (`moments`), and the agent’s other placements (`otherMoments`). Any workspace can host network ads. Change it with set_network_ads. Results: get_results with section network. Maps to GET /system/offer-manager/application/{id}/network.',
|
|
29
29
|
kind: 'read',
|
|
30
30
|
roleFloor: 'viewer',
|
|
31
31
|
input: { application: shared_1.application },
|
|
@@ -56,13 +56,13 @@ function momentNames(ids, before) {
|
|
|
56
56
|
];
|
|
57
57
|
return ids.map(id => {
|
|
58
58
|
const m = known.find(k => k.id === id);
|
|
59
|
-
return m?.name ? (0, shared_1.quoted)(m.name, '') : 'a
|
|
59
|
+
return m?.name ? (0, shared_1.quoted)(m.name, '') : 'a placement';
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
exports.setNetworkAds = (0, tool_1.defineTool)({
|
|
63
63
|
name: 'set_network_ads',
|
|
64
64
|
title: 'Turn ads from the network on or off',
|
|
65
|
-
description: 'Turn ads from the network on or off for one agent. On needs at least one of the agent’s
|
|
65
|
+
description: 'Turn ads from the network on or off for one agent. On needs at least one of the agent’s placements: network ads may appear there when one fits the conversation. `moments` (placement ids) replaces the list. Off removes them from every moment. Read the current state with get_network_status first. Refused (409) for an agent the network declined. Maps to PUT /system/offer-manager/application/{id}/network.',
|
|
66
66
|
kind: 'write',
|
|
67
67
|
roleFloor: 'editor',
|
|
68
68
|
reader: 'get_network_status',
|
|
@@ -72,7 +72,7 @@ exports.setNetworkAds = (0, tool_1.defineTool)({
|
|
|
72
72
|
moments: zod_1.z
|
|
73
73
|
.array(zod_1.z.string().regex(/^[0-9a-fA-F]{24}$/))
|
|
74
74
|
.optional()
|
|
75
|
-
.describe('
|
|
75
|
+
.describe('Placement (moment) ids of this agent where network ads may appear; required, at least one, when turning on.'),
|
|
76
76
|
},
|
|
77
77
|
approval: (args, before) => {
|
|
78
78
|
const agent = (0, shared_1.named)('agent', before?.agent?.name);
|
|
@@ -80,9 +80,9 @@ exports.setNetworkAds = (0, tool_1.defineTool)({
|
|
|
80
80
|
return `Turn off ads from the network for ${agent}. They stop appearing at once.`;
|
|
81
81
|
const ids = args.moments ?? [];
|
|
82
82
|
const names = momentNames(ids, before);
|
|
83
|
-
const at = names.length && names.every(n => n !== 'a
|
|
83
|
+
const at = names.length && names.every(n => n !== 'a placement')
|
|
84
84
|
? `at ${(0, shared_1.listWords)(names)}`
|
|
85
|
-
: `at ${ids.length === 1 ? 'one
|
|
85
|
+
: `at ${ids.length === 1 ? 'one placement' : `${ids.length} placements`}`;
|
|
86
86
|
const approved = before?.status === 'pending'
|
|
87
87
|
? ' They appear once the agent is approved for the network.'
|
|
88
88
|
: '';
|
package/bin/tools/network.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"","sources":["../../src/tools/network.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,6BAAwB;AACxB,kCAAqC;AACrC,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GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACvC,MAAM,EAAE,GACN,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC;YACnD,CAAC,CAAC,MAAM,IAAA,kBAAS,EAAC,KAAK,CAAC,EAAE;YAC1B,CAAC,CAAC,MAAM,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,aAAa,EAAE,CAAC;QAC9E,MAAM,QAAQ,GACZ,MAAM,EAAE,MAAM,KAAK,SAAS;YAC1B,CAAC,CAAC,0DAA0D;YAC5D,CAAC,CAAC,EAAE,CAAC;QACT,OAAO,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,6BAA6B,KAAK,IAAI,EAAE,IAAI,QAAQ,EAAE,CAAC;IAClG,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI;QACxB,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,WAAE,gBAAgB,IAAA,YAAG,EAAC,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE;YACtE,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE;SAC5B,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAEU,QAAA,YAAY,GAAG,CAAC,wBAAgB,EAAE,qBAAa,CAAC,CAAC"}
|
package/bin/tools/results.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/** The `groupBy` values each section accepts. */
|
|
2
2
|
export declare const RESULTS_GROUP_BY: {
|
|
3
|
-
readonly offers: readonly ["day", "offer", "moment", "channel", "agent"];
|
|
4
3
|
readonly network: readonly ["day", "moment", "channel", "agent"];
|
|
5
4
|
readonly campaigns: readonly ["day", "campaign"];
|
|
6
5
|
};
|
package/bin/tools/results.js
CHANGED
|
@@ -3,28 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resultsTools = exports.getResults = exports.RESULTS_GROUP_BY = void 0;
|
|
4
4
|
exports.resultsViews = resultsViews;
|
|
5
5
|
/**
|
|
6
|
-
* Results: daily counts for the
|
|
7
|
-
*
|
|
8
|
-
* read them; a section the workspace does not use comes back as zeros.
|
|
6
|
+
* Results: daily counts for the ads from the network the workspace's agents
|
|
7
|
+
* host, and for its campaigns (`GET /system/results`). Every workspace can
|
|
8
|
+
* read them; a section the workspace does not use comes back as zeros. The
|
|
9
|
+
* server's `offers` section (house offers) is not offered here.
|
|
9
10
|
*/
|
|
10
11
|
const zod_1 = require("zod");
|
|
11
12
|
const tool_1 = require("../tool");
|
|
12
13
|
const shared_1 = require("./shared");
|
|
13
14
|
/** The `groupBy` values each section accepts. */
|
|
14
15
|
exports.RESULTS_GROUP_BY = {
|
|
15
|
-
offers: ['day', 'offer', 'moment', 'channel', 'agent'],
|
|
16
16
|
network: ['day', 'moment', 'channel', 'agent'],
|
|
17
17
|
campaigns: ['day', 'campaign'],
|
|
18
18
|
};
|
|
19
19
|
const SECTIONS = Object.keys(exports.RESULTS_GROUP_BY);
|
|
20
|
-
const GROUP_BYS = [
|
|
21
|
-
'day',
|
|
22
|
-
'offer',
|
|
23
|
-
'moment',
|
|
24
|
-
'channel',
|
|
25
|
-
'agent',
|
|
26
|
-
'campaign',
|
|
27
|
-
];
|
|
20
|
+
const GROUP_BYS = ['day', 'moment', 'channel', 'agent', 'campaign'];
|
|
28
21
|
const oneOrMore = (t) => zod_1.z.union([t, zod_1.z.array(t).min(1).max(GROUP_BYS.length)]);
|
|
29
22
|
const list = (v) => v === undefined ? undefined : Array.isArray(v) ? v : [v];
|
|
30
23
|
/**
|
|
@@ -55,7 +48,7 @@ const day = (what) => zod_1.z
|
|
|
55
48
|
exports.getResults = (0, tool_1.defineTool)({
|
|
56
49
|
name: 'get_results',
|
|
57
50
|
title: 'Get results',
|
|
58
|
-
description: 'Daily counts for the workspace, over a range of days in its time zone, with totals and rows. Sections and their metrics: `
|
|
51
|
+
description: 'Daily counts for the workspace, over a range of days in its time zone, with totals and rows. Sections and their metrics: `network` (as a publisher, the ads from the network your agents host: requests offered to the network, shown, clicked), `campaigns` (as an advertiser, the workspace’s campaigns wherever they serve: shown, clicks, conversions; conversationsStarted and cost are null until they are computed). `groupBy` splits the rows: by `day` (every day of the range, oldest first, the default), or by moment (placement), channel, or agent (network); campaign (campaigns). Grouped rows are sorted highest first and carry a display name (`label`). A null value is not computed. `application` limits it to one agent, and `campaign` the campaigns section to one campaign. To answer a question that needs several views (say the network by placement and by agent, and the campaigns), ask for them in one call: `section` and `groupBy` each take a list, and you get `{ results: [...] }`, one entry (section, groupBy, totals, rows) per section with each split it accepts; one section and one split return that view alone. Maps to GET /system/results.',
|
|
59
52
|
kind: 'read',
|
|
60
53
|
roleFloor: 'viewer',
|
|
61
54
|
input: {
|
|
@@ -68,11 +61,6 @@ exports.getResults = (0, tool_1.defineTool)({
|
|
|
68
61
|
application: shared_1.application
|
|
69
62
|
.optional()
|
|
70
63
|
.describe('Only this agent’s requests (list_applications).'),
|
|
71
|
-
offer: zod_1.z
|
|
72
|
-
.string()
|
|
73
|
-
.min(1)
|
|
74
|
-
.optional()
|
|
75
|
-
.describe('Only this offer (an id from list_offers); applies to the offers section, not with application.'),
|
|
76
64
|
campaign: zod_1.z
|
|
77
65
|
.string()
|
|
78
66
|
.min(1)
|
|
@@ -81,10 +69,7 @@ exports.getResults = (0, tool_1.defineTool)({
|
|
|
81
69
|
},
|
|
82
70
|
async run({ client }, args) {
|
|
83
71
|
const views = resultsViews(args.section, args.groupBy);
|
|
84
|
-
const filters = [
|
|
85
|
-
['offer', 'offers'],
|
|
86
|
-
['campaign', 'campaigns'],
|
|
87
|
-
];
|
|
72
|
+
const filters = [['campaign', 'campaigns']];
|
|
88
73
|
for (const [key, section] of filters) {
|
|
89
74
|
if (args[key] === undefined)
|
|
90
75
|
continue;
|
|
@@ -96,7 +81,6 @@ exports.getResults = (0, tool_1.defineTool)({
|
|
|
96
81
|
// Each filter goes only to its own section's views.
|
|
97
82
|
const query = (v) => client.get('/results', (0, shared_1.defined)({
|
|
98
83
|
...args,
|
|
99
|
-
offer: v.section === 'offers' ? args.offer : undefined,
|
|
100
84
|
campaign: v.section === 'campaigns' ? args.campaign : undefined,
|
|
101
85
|
...v,
|
|
102
86
|
}));
|
package/bin/tools/results.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"results.js","sourceRoot":"","sources":["../../src/tools/results.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../../src/tools/results.ts"],"names":[],"mappings":";;;AA8BA,oCAsBC;AApDD;;;;;GAKG;AACH,6BAAwB;AACxB,kCAAqC;AACrC,qCAAgF;AAEhF,iDAAiD;AACpC,QAAA,gBAAgB,GAAG;IAC9B,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;IAC9C,SAAS,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC;CACtB,CAAC;AAGX,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,wBAAgB,CAAc,CAAC;AAC5D,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAE7E,MAAM,SAAS,GAAG,CAAyB,CAAI,EAAE,EAAE,CACjD,OAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC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
2
|
+
* Shapes and helpers shared by the tool modules.
|
|
3
|
+
*/
|
|
1
4
|
import { z } from 'zod';
|
|
5
|
+
/** A record id: 24 hex characters. */
|
|
6
|
+
export declare const ObjectId: z.ZodString;
|
|
2
7
|
export type Doc = Record<string, any>;
|
|
3
8
|
/** The Offer Manager API, behind the gateway's `/system` surface. */
|
|
4
9
|
export declare const OM = "/offer-manager";
|
|
5
|
-
export declare const RULES_REFERENCE = "https://docs.advertising.chat/reference/rules/";
|
|
6
10
|
/** Error from a tool's own checks, before anything is sent. */
|
|
7
11
|
export declare class ToolInputError extends Error {
|
|
8
12
|
constructor(message: string);
|
|
@@ -15,10 +19,6 @@ export declare const application: z.ZodString;
|
|
|
15
19
|
* the agent a change is attributed to is always the resource's own.
|
|
16
20
|
*/
|
|
17
21
|
export declare const applicationOfUpdate: z.ZodString;
|
|
18
|
-
export declare const offerLimit: z.ZodObject<{
|
|
19
|
-
times: z.ZodNumber;
|
|
20
|
-
interval: z.ZodNumber;
|
|
21
|
-
}, z.core.$strict>;
|
|
22
22
|
export declare const listShape: {
|
|
23
23
|
skip: z.ZodOptional<z.ZodNumber>;
|
|
24
24
|
limit: z.ZodOptional<z.ZodNumber>;
|
|
@@ -46,5 +46,3 @@ export declare function listWords(items: string[]): string;
|
|
|
46
46
|
export declare function plural(n: number, one: string, many?: string): string;
|
|
47
47
|
/** The words for the fields an update gives, in the order of `words`. */
|
|
48
48
|
export declare function changedWords(args: Doc, words: Record<string, string>): string[];
|
|
49
|
-
/** `{ times: 2, interval: 604800000 }` as `at most twice per week`. */
|
|
50
|
-
export declare function frequencyWords(f: unknown): string | undefined;
|
package/bin/tools/shared.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enc = exports.str = exports.listShape = exports.
|
|
3
|
+
exports.enc = exports.str = exports.listShape = exports.applicationOfUpdate = exports.application = exports.id = exports.ToolInputError = exports.OM = exports.ObjectId = void 0;
|
|
4
4
|
exports.rows = rows;
|
|
5
5
|
exports.refId = refId;
|
|
6
6
|
exports.ref = ref;
|
|
@@ -12,15 +12,17 @@ exports.quoted = quoted;
|
|
|
12
12
|
exports.listWords = listWords;
|
|
13
13
|
exports.plural = plural;
|
|
14
14
|
exports.changedWords = changedWords;
|
|
15
|
-
exports.frequencyWords = frequencyWords;
|
|
16
15
|
/**
|
|
17
16
|
* Shapes and helpers shared by the tool modules.
|
|
18
17
|
*/
|
|
19
|
-
const offer_rules_1 = require("@advertising-chat/offer-rules");
|
|
20
18
|
const zod_1 = require("zod");
|
|
19
|
+
/** A record id: 24 hex characters. */
|
|
20
|
+
exports.ObjectId = zod_1.z
|
|
21
|
+
.string()
|
|
22
|
+
.regex(/^[0-9a-fA-F]{24}$/, 'Expected a 24-character hex id')
|
|
23
|
+
.describe('A 24-character hex id');
|
|
21
24
|
/** The Offer Manager API, behind the gateway's `/system` surface. */
|
|
22
25
|
exports.OM = '/offer-manager';
|
|
23
|
-
exports.RULES_REFERENCE = 'https://docs.advertising.chat/reference/rules/';
|
|
24
26
|
/** Error from a tool's own checks, before anything is sent. */
|
|
25
27
|
class ToolInputError extends Error {
|
|
26
28
|
constructor(message) {
|
|
@@ -29,16 +31,15 @@ class ToolInputError extends Error {
|
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
exports.ToolInputError = ToolInputError;
|
|
32
|
-
const id = (what) =>
|
|
34
|
+
const id = (what) => exports.ObjectId.describe(`The ${what} id (24 hex characters).`);
|
|
33
35
|
exports.id = id;
|
|
34
|
-
exports.application =
|
|
36
|
+
exports.application = exports.ObjectId.describe('The agent (application) id, from list_applications.');
|
|
35
37
|
/**
|
|
36
38
|
* The agent of an update. Agent-scoped resources keep their agent for
|
|
37
39
|
* life; the server rejects an update whose `application` differs (422), so
|
|
38
40
|
* the agent a change is attributed to is always the resource's own.
|
|
39
41
|
*/
|
|
40
|
-
exports.applicationOfUpdate =
|
|
41
|
-
exports.offerLimit = offer_rules_1.Frequency.describe('At most `times` of the brand’s offers (1 to 20) to one customer in any rolling `interval` of milliseconds (60000 to 7776000000, 90 days). E.g. { times: 3, interval: 86400000 } is three offers a day.');
|
|
42
|
+
exports.applicationOfUpdate = exports.ObjectId.describe('The agent (application) the record belongs to. It cannot change: the server rejects a different agent.');
|
|
42
43
|
exports.listShape = {
|
|
43
44
|
skip: zod_1.z
|
|
44
45
|
.number()
|
|
@@ -142,30 +143,4 @@ function changedWords(args, words) {
|
|
|
142
143
|
out.push(word);
|
|
143
144
|
return out;
|
|
144
145
|
}
|
|
145
|
-
const MINUTE = 60_000;
|
|
146
|
-
const HOUR = 60 * MINUTE;
|
|
147
|
-
const DAY = 24 * HOUR;
|
|
148
|
-
/** `{ times: 2, interval: 604800000 }` as `at most twice per week`. */
|
|
149
|
-
function frequencyWords(f) {
|
|
150
|
-
if (!f || typeof f !== 'object')
|
|
151
|
-
return undefined;
|
|
152
|
-
const { times, interval } = f;
|
|
153
|
-
if (typeof times !== 'number' || typeof interval !== 'number')
|
|
154
|
-
return undefined;
|
|
155
|
-
const count = times === 1 ? 'once' : times === 2 ? 'twice' : `${times} times`;
|
|
156
|
-
const units = [
|
|
157
|
-
[30 * DAY, 'month'],
|
|
158
|
-
[7 * DAY, 'week'],
|
|
159
|
-
[DAY, 'day'],
|
|
160
|
-
[HOUR, 'hour'],
|
|
161
|
-
[MINUTE, 'minute'],
|
|
162
|
-
];
|
|
163
|
-
for (const [ms, unit] of units) {
|
|
164
|
-
if (interval % ms === 0) {
|
|
165
|
-
const n = interval / ms;
|
|
166
|
-
return `at most ${count} per ${n === 1 ? unit : `${n} ${unit}s`}`;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return `at most ${count} per ${Math.round(interval / MINUTE)} minutes`;
|
|
170
|
-
}
|
|
171
146
|
//# sourceMappingURL=shared.js.map
|
package/bin/tools/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/tools/shared.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/tools/shared.ts"],"names":[],"mappings":";;;AAyDA,oBAIC;AAMD,sBAOC;AAGD,kBAKC;AAGD,0BAIC;AAGD,8BAUC;AAGD,wBAIC;AAQD,sBAIC;AAGD,wBAIC;AAGD,8BAIC;AAED,wBAEC;AAGD,oCAQC;AAtJD;;GAEG;AACH,6BAAwB;AAExB,sCAAsC;AACzB,QAAA,QAAQ,GAAG,OAAC;KACtB,MAAM,EAAE;KACR,KAAK,CAAC,mBAAmB,EAAE,gCAAgC,CAAC;KAC5D,QAAQ,CAAC,uBAAuB,CAAC,CAAC;AAIrC,qEAAqE;AACxD,QAAA,EAAE,GAAG,gBAAgB,CAAC;AAEnC,+DAA+D;AAC/D,MAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC;AAEM,MAAM,EAAE,GAAG,CAAC,IAAY,EAAE,EAAE,CACjC,gBAAQ,CAAC,QAAQ,CAAC,OAAO,IAAI,0BAA0B,CAAC,CAAC;AAD9C,QAAA,EAAE,MAC4C;AAE9C,QAAA,WAAW,GAAG,gBAAQ,CAAC,QAAQ,CAC1C,qDAAqD,CACtD,CAAC;AAEF;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,gBAAQ,CAAC,QAAQ,CAClD,wGAAwG,CACzG,CAAC;AAEW,QAAA,SAAS,GAAG;IACvB,IAAI,EAAE,OAAC;SACJ,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,uCAAuC,CAAC;IACpD,KAAK,EAAE,OAAC;SACL,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC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E,CAAC;AACxC,CAAC;AAED,yEAAyE;AACzE,SAAgB,YAAY,CAC1B,IAAS,EACT,KAA6B;IAE7B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAC7C,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/bin/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The package version, reported to MCP hosts. Kept in step with package.json (tested). */
|
|
2
|
-
export declare const VERSION = "0.
|
|
2
|
+
export declare const VERSION = "0.18.0";
|
package/bin/version.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VERSION = void 0;
|
|
4
4
|
/** The package version, reported to MCP hosts. Kept in step with package.json (tested). */
|
|
5
|
-
exports.VERSION = '0.
|
|
5
|
+
exports.VERSION = '0.18.0';
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@advertising-chat/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "MCP server for Advertising.chat:
|
|
3
|
+
"version": "0.18.0",
|
|
4
|
+
"description": "MCP server for Advertising.chat: serve in-chat ads from the network with an API key, or manage agents, placements, campaigns, and results with your own login",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Advertising.chat",
|
|
7
7
|
"homepage": "https://docs.advertising.chat/",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/advertising-chat/
|
|
11
|
-
"directory": "
|
|
10
|
+
"url": "git+https://github.com/advertising-chat/platform.git",
|
|
11
|
+
"directory": "tools/mcp"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [
|
|
14
14
|
"mcp",
|
|
15
15
|
"model-context-protocol",
|
|
16
16
|
"advertising",
|
|
17
|
-
"
|
|
17
|
+
"ad-network",
|
|
18
18
|
"ads",
|
|
19
19
|
"llm"
|
|
20
20
|
],
|
|
@@ -31,17 +31,44 @@
|
|
|
31
31
|
"build": "tsc -p .",
|
|
32
32
|
"clean": "rm -rf ./bin",
|
|
33
33
|
"prepack": "npm run clean && npm run build",
|
|
34
|
-
"test": "mocha"
|
|
34
|
+
"test": "ADCHAT_DOCS_DIR=${ADCHAT_DOCS_DIR:-$PWD/../../apps/docs/docs} mocha",
|
|
35
|
+
"lint": "eslint .",
|
|
36
|
+
"lint-fix": "eslint . --fix",
|
|
37
|
+
"prettier": "prettier --list-different \"{src,test,scripts}/**/*.ts\" \"*.{json,mjs}\"",
|
|
38
|
+
"prettier-fix": "prettier --write \"{src,test,scripts}/**/*.ts\" \"*.{json,mjs}\"",
|
|
39
|
+
"check": "npm run build && npm run lint && npm run prettier && npm test"
|
|
35
40
|
},
|
|
36
41
|
"engines": {
|
|
37
42
|
"node": ">=18"
|
|
38
43
|
},
|
|
39
44
|
"dependencies": {
|
|
40
|
-
"@advertising-chat/
|
|
41
|
-
"@advertising-chat/sdk": "^0.17.3",
|
|
45
|
+
"@advertising-chat/sdk": "^0.18.0",
|
|
42
46
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
43
|
-
"ajv": "^8.
|
|
47
|
+
"ajv": "^8.20.0",
|
|
44
48
|
"ajv-formats": "^3.0.1",
|
|
45
49
|
"zod": "^4.6.7"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@eslint/eslintrc": "^3.3.7",
|
|
53
|
+
"@eslint/js": "^9.39.5",
|
|
54
|
+
"@types/chai": "^4.3.20",
|
|
55
|
+
"@types/mocha": "^10.0.10",
|
|
56
|
+
"@types/node": "^24.19.2",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^8.72.1",
|
|
58
|
+
"@typescript-eslint/parser": "^8.72.1",
|
|
59
|
+
"chai": "^4.5.0",
|
|
60
|
+
"eslint": "^9.39.5",
|
|
61
|
+
"eslint-config-prettier": "^10.1.8",
|
|
62
|
+
"globals": "^17.13.0",
|
|
63
|
+
"mocha": "^11.8.0",
|
|
64
|
+
"prettier": "^3.9.10",
|
|
65
|
+
"source-map-support": "^0.5.21",
|
|
66
|
+
"ts-node": "^10.9.2",
|
|
67
|
+
"typescript": "^5.9.3"
|
|
68
|
+
},
|
|
69
|
+
"adchat": {
|
|
70
|
+
"affectedBy": [
|
|
71
|
+
"apps/docs"
|
|
72
|
+
]
|
|
46
73
|
}
|
|
47
74
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Doc } from './shared';
|
|
2
|
-
/** A catalog entry as the list shows it. */
|
|
3
|
-
export declare function attributeRow(e: Doc): Doc;
|
|
4
|
-
export declare const listAttributes: import("../tool").AnyTool;
|
|
5
|
-
export declare const getAttribute: import("../tool").AnyTool;
|
|
6
|
-
export declare const addAttribute: import("../tool").AnyTool;
|
|
7
|
-
export declare const documentAttribute: import("../tool").AnyTool;
|
|
8
|
-
export declare const updateAttribute: import("../tool").AnyTool;
|
|
9
|
-
export declare const deleteAttribute: import("../tool").AnyTool;
|
|
10
|
-
export declare const attributeTools: import("../tool").AnyTool[];
|