@velaro/mcp-server 2.0.147 → 2.0.148

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/mcp-server",
3
- "version": "2.0.147",
3
+ "version": "2.0.148",
4
4
  "description": "Velaro MCP server — connect Claude and other AI agents directly to your Velaro account: KB, workflows, bots, conversations, contacts, routing, and more.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,42 @@
1
+ // MCP parity for `velaro campaigns audience --campaign <id> --min-opens N --clicked --unsubscribed --bounced` (cli/lib/commands/campaigns.js).
2
+ // Who opened a campaign at least N times, clicked, unsubscribed, bounced or was held back. Filters combine (any match).
3
+ // The site comes from the credential only; no tool takes a siteId.
4
+ // Backend: BroadcastCampaignController (GET BroadcastCampaigns/{id}/Audience).
5
+
6
+ const posInt = (v, n) => {
7
+ const x = Number(v);
8
+ if (!Number.isInteger(x) || x < 1) throw new Error(n + ' must be a whole number of 1 or more');
9
+ return x;
10
+ };
11
+
12
+ export const tools = [
13
+ {
14
+ name: 'campaign_audience',
15
+ description: 'Who opened a campaign at least N times, clicked, unsubscribed, bounced or was held back. Choose any filters (any match counts); none returns everyone. Returns email, name, status, open and click counts, first open and last click times. Use it for "who opened campaign 42 more than three times" or "who unsubscribed".',
16
+ inputSchema: {
17
+ type: 'object',
18
+ properties: {
19
+ campaignId: { type: 'number', description: 'Broadcast campaign id' },
20
+ minOpens: { type: 'number', description: 'Only people who opened at least this many times' },
21
+ clicked: { type: 'boolean', description: 'Include people who clicked a link' },
22
+ unsubscribed: { type: 'boolean', description: 'Include people who unsubscribed' },
23
+ bounced: { type: 'boolean', description: 'Include people the email could not be delivered to' },
24
+ suppressed: { type: 'boolean', description: 'Include people held back or skipped' },
25
+ page: { type: 'number', description: 'Page number, starting at 1' },
26
+ pageSize: { type: 'number', description: 'Rows per page, max 500' },
27
+ },
28
+ required: ['campaignId'],
29
+ },
30
+ },
31
+ ];
32
+
33
+ export const handlers = {
34
+ campaign_audience: async (a, ctx) => {
35
+ const qs = [];
36
+ if (a.minOpens !== undefined && a.minOpens !== '') qs.push('minOpens=' + posInt(a.minOpens, 'minOpens'));
37
+ for (const k of ['clicked', 'unsubscribed', 'bounced', 'suppressed']) if (a[k] === true) qs.push(k + '=true');
38
+ if (a.page !== undefined) qs.push('page=' + posInt(a.page, 'page'));
39
+ if (a.pageSize !== undefined) qs.push('pageSize=' + Math.min(500, posInt(a.pageSize, 'pageSize')));
40
+ return ctx.api('GET', '/BroadcastCampaigns/' + posInt(a.campaignId, 'campaignId') + '/Audience' + (qs.length ? '?' + qs.join('&') : ''));
41
+ },
42
+ };