@netsendo/mcp-client 1.3.0 → 1.4.1
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 +148 -12
- package/dist/api-client.d.ts +166 -1
- package/dist/api-client.d.ts.map +1 -1
- package/dist/api-client.js +157 -2
- package/dist/api-client.js.map +1 -1
- package/dist/index.js +108 -13
- package/dist/index.js.map +1 -1
- package/dist/tools/helpers.d.ts +28 -0
- package/dist/tools/helpers.d.ts.map +1 -0
- package/dist/tools/helpers.js +53 -0
- package/dist/tools/helpers.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +29 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/list-activity.d.ts +10 -0
- package/dist/tools/list-activity.d.ts.map +1 -0
- package/dist/tools/list-activity.js +58 -0
- package/dist/tools/list-activity.js.map +1 -0
- package/dist/tools/list-export.d.ts +10 -0
- package/dist/tools/list-export.d.ts.map +1 -0
- package/dist/tools/list-export.js +60 -0
- package/dist/tools/list-export.js.map +1 -0
- package/dist/tools/list-hygiene.d.ts +11 -0
- package/dist/tools/list-hygiene.d.ts.map +1 -0
- package/dist/tools/list-hygiene.js +143 -0
- package/dist/tools/list-hygiene.js.map +1 -0
- package/dist/tools/list-import.d.ts +11 -0
- package/dist/tools/list-import.d.ts.map +1 -0
- package/dist/tools/list-import.js +88 -0
- package/dist/tools/list-import.js.map +1 -0
- package/dist/tools/list-members.d.ts +10 -0
- package/dist/tools/list-members.d.ts.map +1 -0
- package/dist/tools/list-members.js +144 -0
- package/dist/tools/list-members.js.map +1 -0
- package/dist/tools/lists.d.ts.map +1 -1
- package/dist/tools/lists.js +79 -0
- package/dist/tools/lists.js.map +1 -1
- package/dist/tools/messaging.d.ts.map +1 -1
- package/dist/tools/messaging.js +11 -7
- package/dist/tools/messaging.js.map +1 -1
- package/dist/tools/notifications.d.ts +11 -0
- package/dist/tools/notifications.d.ts.map +1 -0
- package/dist/tools/notifications.js +43 -0
- package/dist/tools/notifications.js.map +1 -0
- package/dist/tools/subscribers.js +1 -1
- package/dist/tools/subscribers.js.map +1 -1
- package/dist/tools/suppressions.d.ts +11 -0
- package/dist/tools/suppressions.d.ts.map +1 -0
- package/dist/tools/suppressions.js +54 -0
- package/dist/tools/suppressions.js.map +1 -0
- package/dist/types.d.ts +435 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ import { loadConfig, validateConfig } from './config.js';
|
|
|
23
23
|
import { NetSendoApiClient } from './api-client.js';
|
|
24
24
|
import { registerAllTools } from './tools/index.js';
|
|
25
25
|
const SERVER_NAME = 'netsendo-mcp';
|
|
26
|
-
const SERVER_VERSION = '1.
|
|
26
|
+
const SERVER_VERSION = '1.4.1';
|
|
27
27
|
// Parse CLI arguments
|
|
28
28
|
program
|
|
29
29
|
.name('netsendo-mcp')
|
|
@@ -80,7 +80,14 @@ async function main() {
|
|
|
80
80
|
api_url: config.apiUrl,
|
|
81
81
|
capabilities: [
|
|
82
82
|
'Subscriber management',
|
|
83
|
-
'Contact lists',
|
|
83
|
+
'Contact lists (create, update, delete, stats)',
|
|
84
|
+
'List import (CSV, TSV, JSON, plain addresses) with dry-run preview',
|
|
85
|
+
'List export (inline JSON/CSV/NDJSON, cursor-paged) and queued CSV',
|
|
86
|
+
'List hygiene (health report, cleaning, deduplication, deliverability verification)',
|
|
87
|
+
'Bulk membership operations (add, remove, status, move, copy, tag)',
|
|
88
|
+
'Activity feed and engagement analytics',
|
|
89
|
+
'Suppression list (account-wide do-not-mail)',
|
|
90
|
+
'Notifications to the account owner',
|
|
84
91
|
'Tags',
|
|
85
92
|
'Email campaigns',
|
|
86
93
|
'SMS messaging',
|
|
@@ -136,6 +143,41 @@ async function main() {
|
|
|
136
143
|
};
|
|
137
144
|
}
|
|
138
145
|
});
|
|
146
|
+
// Contact list directory — lets an assistant pick the right list without a
|
|
147
|
+
// tool round-trip, and see at a glance which ones look neglected.
|
|
148
|
+
server.resource('netsendo://lists', 'Contact lists with size, channel and growth indicators', async () => {
|
|
149
|
+
try {
|
|
150
|
+
const lists = await api.listContactLists({ per_page: 100 });
|
|
151
|
+
return {
|
|
152
|
+
contents: [{
|
|
153
|
+
uri: 'netsendo://lists',
|
|
154
|
+
mimeType: 'application/json',
|
|
155
|
+
text: JSON.stringify({
|
|
156
|
+
total: lists.meta.total,
|
|
157
|
+
lists: lists.data.map(l => ({
|
|
158
|
+
id: l.id,
|
|
159
|
+
name: l.name,
|
|
160
|
+
description: l.description,
|
|
161
|
+
subscribers: l.subscribers_count,
|
|
162
|
+
double_opt_in: l.double_opt_in,
|
|
163
|
+
default_mailbox: l.default_mailbox?.from_email ?? null,
|
|
164
|
+
created_at: l.created_at,
|
|
165
|
+
})),
|
|
166
|
+
hint: 'Use get_list_stats for a single list, analyze_list_health for data-quality problems, get_list_engagement for performance.',
|
|
167
|
+
}, null, 2),
|
|
168
|
+
}],
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
return {
|
|
173
|
+
contents: [{
|
|
174
|
+
uri: 'netsendo://lists',
|
|
175
|
+
mimeType: 'text/plain',
|
|
176
|
+
text: `Error fetching contact lists: ${error.message}`,
|
|
177
|
+
}],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
139
181
|
// Add prompts for common tasks
|
|
140
182
|
server.prompt('analyze_subscribers', 'Analyze subscriber list for quality and engagement patterns', {
|
|
141
183
|
list_id: z.string().optional().describe('Optional: specific list ID to analyze'),
|
|
@@ -185,24 +227,77 @@ Requirements:
|
|
|
185
227
|
},
|
|
186
228
|
}],
|
|
187
229
|
}));
|
|
188
|
-
server.prompt('cleanup_list', '
|
|
230
|
+
server.prompt('cleanup_list', 'Audit a list for deliverability problems and propose a safe clean-up plan', {
|
|
231
|
+
list_id: z.string().optional().describe('Optional: specific list ID to clean up'),
|
|
232
|
+
}, async ({ list_id }) => ({
|
|
189
233
|
messages: [{
|
|
190
234
|
role: 'user',
|
|
191
235
|
content: {
|
|
192
236
|
type: 'text',
|
|
193
|
-
text: `
|
|
237
|
+
text: `Audit and clean up ${list_id ? `contact list ID ${list_id}` : 'my contact lists'} in NetSendo.
|
|
194
238
|
|
|
195
|
-
|
|
196
|
-
1.
|
|
197
|
-
2.
|
|
198
|
-
3.
|
|
239
|
+
Steps:
|
|
240
|
+
1. ${list_id ? `Run analyze_list_health on list ${list_id}` : 'Use list_contact_lists, then analyze_list_health on the largest lists'} to get the health score, per-category counts and recommendations.
|
|
241
|
+
2. Run verify_list_emails to see how much of the audience is actually deliverable.
|
|
242
|
+
3. Run dedupe_list with dry_run=true to see whether duplicates exist.
|
|
243
|
+
4. For every category worth acting on, run clean_list with dry_run=true so we can see exactly who would be affected.
|
|
244
|
+
|
|
245
|
+
Then present:
|
|
246
|
+
- The health score and the biggest problems, with numbers
|
|
247
|
+
- A concrete plan: which category, which action, how many contacts
|
|
248
|
+
- What I would lose by acting, and what it costs me to do nothing
|
|
249
|
+
|
|
250
|
+
Rules:
|
|
251
|
+
- Never execute a clean-up with dry_run=false until I approve the plan.
|
|
252
|
+
- Never use action "delete" or "suppress" unless I ask for it explicitly — prefer "unsubscribe" or "remove".
|
|
253
|
+
- For never_engaged and dormant contacts, propose tagging them for a win-back campaign before any removal.`,
|
|
254
|
+
},
|
|
255
|
+
}],
|
|
256
|
+
}));
|
|
257
|
+
server.prompt('import_contacts', 'Import contacts onto a list safely, with a preview before anything is written', {
|
|
258
|
+
list_id: z.string().optional().describe('Target contact list ID'),
|
|
259
|
+
}, async ({ list_id }) => ({
|
|
260
|
+
messages: [{
|
|
261
|
+
role: 'user',
|
|
262
|
+
content: {
|
|
263
|
+
type: 'text',
|
|
264
|
+
text: `Help me import contacts ${list_id ? `into contact list ID ${list_id}` : 'into one of my NetSendo lists'}.
|
|
265
|
+
|
|
266
|
+
Steps:
|
|
267
|
+
1. ${list_id ? '' : 'Use list_contact_lists to confirm the target list and its channel (email or sms).\n2. '}Take the data I provide in whatever shape it arrives — pasted CSV, a spreadsheet export, JSON records or a bare list of addresses.
|
|
268
|
+
${list_id ? '2' : '3'}. Run preview_list_import FIRST. Show me:
|
|
269
|
+
- the detected column mapping (so I can catch a wrong column before it lands in the database)
|
|
270
|
+
- how many contacts would be created, updated, reactivated, skipped and rejected
|
|
271
|
+
- the problem rows: invalid syntax, typo domains with suggested corrections, disposable and role addresses, duplicates
|
|
272
|
+
${list_id ? '3' : '4'}. Recommend the import options based on what you found — for example fix_typos when there are misspelled provider domains, or skip_role when the file is full of shared inboxes.
|
|
273
|
+
${list_id ? '4' : '5'}. Only after I approve, run import_subscribers and report the final counts.
|
|
274
|
+
|
|
275
|
+
Also tell me whether the import should trigger the list's welcome sequence (trigger_automations). Default is yes — but for migrating an existing audience it usually should be no.`,
|
|
276
|
+
},
|
|
277
|
+
}],
|
|
278
|
+
}));
|
|
279
|
+
server.prompt('list_report', 'Report on how a list is performing and what to do next', {
|
|
280
|
+
list_id: z.string().describe('Contact list ID to report on'),
|
|
281
|
+
days: z.string().optional().describe('Reporting window in days (default: 30)'),
|
|
282
|
+
}, async ({ list_id, days }) => ({
|
|
283
|
+
messages: [{
|
|
284
|
+
role: 'user',
|
|
285
|
+
content: {
|
|
286
|
+
type: 'text',
|
|
287
|
+
text: `Give me a performance report for NetSendo contact list ID ${list_id} over the last ${days ?? 30} days.
|
|
288
|
+
|
|
289
|
+
Gather:
|
|
290
|
+
1. get_list_stats — audience composition and configuration
|
|
291
|
+
2. get_list_engagement with days=${days ?? 30} — growth, churn, open/click rates, best messages and links, most engaged contacts
|
|
292
|
+
3. get_list_activity — anything unusual in the event stream (spikes in unsubscribes or bounces, failed sends)
|
|
293
|
+
4. analyze_list_health — data-quality problems dragging the numbers down
|
|
199
294
|
|
|
200
|
-
Then
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
295
|
+
Then write a short report:
|
|
296
|
+
- How the list is doing, in plain language, with the numbers that matter
|
|
297
|
+
- What changed and what likely caused it
|
|
298
|
+
- The three most valuable things to do next, in priority order
|
|
204
299
|
|
|
205
|
-
|
|
300
|
+
Be direct about bad news: if the list is shrinking, the engagement is collapsing or the bounce rate threatens the sending reputation, say so plainly.`,
|
|
206
301
|
},
|
|
207
302
|
}],
|
|
208
303
|
}));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAW,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,GAAG,cAAc,CAAC;AACnC,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B,sBAAsB;AACtB,OAAO;KACJ,IAAI,CAAC,cAAc,CAAC;KACpB,WAAW,CAAC,uEAAuE,CAAC;KACpF,OAAO,CAAC,cAAc,CAAC;KACvB,MAAM,CAAC,aAAa,EAAE,mDAAmD,CAAC;KAC1E,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;KAC7C,MAAM,CAAC,SAAS,EAAE,sBAAsB,CAAC;KACzC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAC/B,MAAM,OAAO,GAAY;IACvB,GAAG,EAAE,OAAO,CAAC,GA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,QAAQ,EAAE,CAAC;gBACT,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,6DAA6D,OAAO,kBAAkB,IAAI,IAAI,EAAE;;;;mCAI7E,IAAI,IAAI,EAAE;;;;;;;;;sJASyG;iBAC7I;aACF,CAAC;KACH,CAAC,CACH,CAAC;IAEF,+BAA+B;IAC/B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,oEAAoE;IACpE,OAAO,CAAC,KAAK,CAAC,GAAG,WAAW,KAAK,cAAc,UAAU,CAAC,CAAC;IAC3D,OAAO,CAAC,KAAK,CAAC,iBAAiB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,iBAAiB;AACjB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - Tool Helpers
|
|
3
|
+
*
|
|
4
|
+
* Shared response envelope so every tool reports success and failure the same
|
|
5
|
+
* way, and API validation errors reach the model as actionable text instead of
|
|
6
|
+
* a bare "Request failed with status code 422".
|
|
7
|
+
*/
|
|
8
|
+
type ToolResult = {
|
|
9
|
+
content: Array<{
|
|
10
|
+
type: 'text';
|
|
11
|
+
text: string;
|
|
12
|
+
}>;
|
|
13
|
+
isError?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function ok(data: unknown): ToolResult;
|
|
16
|
+
/**
|
|
17
|
+
* Turn an error into a message the model can act on: field-level validation
|
|
18
|
+
* details are flattened, and the HTTP status is kept so a 409 (confirmation
|
|
19
|
+
* required) is distinguishable from a genuine failure.
|
|
20
|
+
*/
|
|
21
|
+
export declare function fail(error: unknown): ToolResult;
|
|
22
|
+
/**
|
|
23
|
+
* Drop undefined keys so optional MCP arguments never travel to the API as
|
|
24
|
+
* explicit nulls, which Laravel's validators would reject.
|
|
25
|
+
*/
|
|
26
|
+
export declare function compact<T extends Record<string, unknown>>(input: T): Partial<T>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/tools/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,GAAG,UAAU,CAI5C;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CA8B/C;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAI/E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - Tool Helpers
|
|
3
|
+
*
|
|
4
|
+
* Shared response envelope so every tool reports success and failure the same
|
|
5
|
+
* way, and API validation errors reach the model as actionable text instead of
|
|
6
|
+
* a bare "Request failed with status code 422".
|
|
7
|
+
*/
|
|
8
|
+
import { NetSendoApiError } from '../api-client.js';
|
|
9
|
+
export function ok(data) {
|
|
10
|
+
return {
|
|
11
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Turn an error into a message the model can act on: field-level validation
|
|
16
|
+
* details are flattened, and the HTTP status is kept so a 409 (confirmation
|
|
17
|
+
* required) is distinguishable from a genuine failure.
|
|
18
|
+
*/
|
|
19
|
+
export function fail(error) {
|
|
20
|
+
if (error instanceof NetSendoApiError) {
|
|
21
|
+
const details = error.errors
|
|
22
|
+
? Object.entries(error.errors)
|
|
23
|
+
.map(([field, messages]) => ` - ${field}: ${messages.join(', ')}`)
|
|
24
|
+
.join('\n')
|
|
25
|
+
: null;
|
|
26
|
+
const hint = error.statusCode === 409
|
|
27
|
+
? '\nThis operation needs explicit confirmation. Re-run with confirm=true once the user has approved it.'
|
|
28
|
+
: error.statusCode === 403
|
|
29
|
+
? '\nThe API key is missing a permission. Ask the user to enable it in NetSendo → API keys.'
|
|
30
|
+
: '';
|
|
31
|
+
return {
|
|
32
|
+
content: [
|
|
33
|
+
{
|
|
34
|
+
type: 'text',
|
|
35
|
+
text: `Error ${error.statusCode}: ${error.message}${details ? `\n${details}` : ''}${hint}`,
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
isError: true,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
content: [{ type: 'text', text: `Error: ${error.message}` }],
|
|
43
|
+
isError: true,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Drop undefined keys so optional MCP arguments never travel to the API as
|
|
48
|
+
* explicit nulls, which Laravel's validators would reject.
|
|
49
|
+
*/
|
|
50
|
+
export function compact(input) {
|
|
51
|
+
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== undefined));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/tools/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;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,OAAO,EAAE,EAAE,CAAC;QAChF,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAoC,KAAQ;IACjE,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACnD,CAAC;AAClB,CAAC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ import type { NetSendoApiClient } from '../api-client.js';
|
|
|
11
11
|
export declare function registerAllTools(server: McpServer, api: NetSendoApiClient): void;
|
|
12
12
|
export { registerSubscriberTools } from './subscribers.js';
|
|
13
13
|
export { registerListTools } from './lists.js';
|
|
14
|
+
export { registerListImportTools } from './list-import.js';
|
|
15
|
+
export { registerListExportTools } from './list-export.js';
|
|
16
|
+
export { registerListHygieneTools } from './list-hygiene.js';
|
|
17
|
+
export { registerListMemberTools } from './list-members.js';
|
|
18
|
+
export { registerListActivityTools } from './list-activity.js';
|
|
19
|
+
export { registerSuppressionTools } from './suppressions.js';
|
|
20
|
+
export { registerNotificationTools } from './notifications.js';
|
|
14
21
|
export { registerMessagingTools } from './messaging.js';
|
|
15
22
|
export { registerCampaignTools } from './campaigns.js';
|
|
16
23
|
export { registerAbTestTools } from './ab-tests.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAiB1D;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,iBAAiB,QA4FzE;AAED,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { registerSubscriberTools } from './subscribers.js';
|
|
7
7
|
import { registerListTools } from './lists.js';
|
|
8
|
+
import { registerListImportTools } from './list-import.js';
|
|
9
|
+
import { registerListExportTools } from './list-export.js';
|
|
10
|
+
import { registerListHygieneTools } from './list-hygiene.js';
|
|
11
|
+
import { registerListMemberTools } from './list-members.js';
|
|
12
|
+
import { registerListActivityTools } from './list-activity.js';
|
|
13
|
+
import { registerSuppressionTools } from './suppressions.js';
|
|
14
|
+
import { registerNotificationTools } from './notifications.js';
|
|
8
15
|
import { registerMessagingTools } from './messaging.js';
|
|
9
16
|
import { registerCampaignTools } from './campaigns.js';
|
|
10
17
|
import { registerAbTestTools } from './ab-tests.js';
|
|
@@ -16,8 +23,22 @@ import { registerPlaceholderTools } from './placeholders.js';
|
|
|
16
23
|
export function registerAllTools(server, api) {
|
|
17
24
|
// Subscriber management tools
|
|
18
25
|
registerSubscriberTools(server, api);
|
|
19
|
-
// Contact lists and
|
|
26
|
+
// Contact lists, tags and list CRUD
|
|
20
27
|
registerListTools(server, api);
|
|
28
|
+
// List import (CSV / TSV / JSON / plain addresses)
|
|
29
|
+
registerListImportTools(server, api);
|
|
30
|
+
// List export (inline data and queued CSV)
|
|
31
|
+
registerListExportTools(server, api);
|
|
32
|
+
// List hygiene: analyse, clean, deduplicate, verify deliverability
|
|
33
|
+
registerListHygieneTools(server, api);
|
|
34
|
+
// Bulk membership operations
|
|
35
|
+
registerListMemberTools(server, api);
|
|
36
|
+
// Activity feed and engagement analytics
|
|
37
|
+
registerListActivityTools(server, api);
|
|
38
|
+
// Account-wide suppression list
|
|
39
|
+
registerSuppressionTools(server, api);
|
|
40
|
+
// Notifications to the account owner
|
|
41
|
+
registerNotificationTools(server, api);
|
|
21
42
|
// Email and SMS messaging tools (single sends)
|
|
22
43
|
registerMessagingTools(server, api);
|
|
23
44
|
// Campaign management tools (bulk campaigns)
|
|
@@ -68,6 +89,13 @@ export function registerAllTools(server, api) {
|
|
|
68
89
|
}
|
|
69
90
|
export { registerSubscriberTools } from './subscribers.js';
|
|
70
91
|
export { registerListTools } from './lists.js';
|
|
92
|
+
export { registerListImportTools } from './list-import.js';
|
|
93
|
+
export { registerListExportTools } from './list-export.js';
|
|
94
|
+
export { registerListHygieneTools } from './list-hygiene.js';
|
|
95
|
+
export { registerListMemberTools } from './list-members.js';
|
|
96
|
+
export { registerListActivityTools } from './list-activity.js';
|
|
97
|
+
export { registerSuppressionTools } from './suppressions.js';
|
|
98
|
+
export { registerNotificationTools } from './notifications.js';
|
|
71
99
|
export { registerMessagingTools } from './messaging.js';
|
|
72
100
|
export { registerCampaignTools } from './campaigns.js';
|
|
73
101
|
export { registerAbTestTools } from './ab-tests.js';
|
package/dist/tools/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAiB,EAAE,GAAsB;IACxE,8BAA8B;IAC9B,uBAAuB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAErC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE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,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAW,KAAe,CAAC,OAAO,EAAE,EAAE,CAAC;gBAChF,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - Activity & Engagement Tools
|
|
3
|
+
*
|
|
4
|
+
* "What is happening on this list?" — the raw event stream, the aggregate
|
|
5
|
+
* performance picture, and one contact's full history.
|
|
6
|
+
*/
|
|
7
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
|
+
import type { NetSendoApiClient } from '../api-client.js';
|
|
9
|
+
export declare function registerListActivityTools(server: McpServer, api: NetSendoApiClient): void;
|
|
10
|
+
//# sourceMappingURL=list-activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-activity.d.ts","sourceRoot":"","sources":["../../src/tools/list-activity.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAO1D,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,iBAAiB,QA4DlF"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - Activity & Engagement Tools
|
|
3
|
+
*
|
|
4
|
+
* "What is happening on this list?" — the raw event stream, the aggregate
|
|
5
|
+
* performance picture, and one contact's full history.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { ok, fail, compact } from './helpers.js';
|
|
9
|
+
const EVENT_TYPES = [
|
|
10
|
+
'subscribed', 'resubscribed', 'confirmed', 'unsubscribed', 'bounced', 'sent', 'failed', 'opened', 'clicked',
|
|
11
|
+
];
|
|
12
|
+
export function registerListActivityTools(server, api) {
|
|
13
|
+
server.tool('get_list_activity', `Chronological event feed for a list — who joined, confirmed, unsubscribed or bounced, and which messages were sent, opened, clicked or failed.
|
|
14
|
+
|
|
15
|
+
Use this to answer "what happened on this list recently?" or to investigate a sudden change: a spike in unsubscribed or bounced right after a send usually points at a content or deliverability problem.
|
|
16
|
+
|
|
17
|
+
Narrow with "types" when looking for something specific, e.g. types=["unsubscribed","bounced"].`, {
|
|
18
|
+
list_id: z.number().describe('Contact list ID'),
|
|
19
|
+
days: z.number().min(1).max(365).optional().describe('How far back to look (default: 30)'),
|
|
20
|
+
limit: z.number().min(1).max(500).optional().describe('Maximum events returned (default: 50)'),
|
|
21
|
+
types: z.array(z.enum(EVENT_TYPES)).optional().describe('Event types to include (default: all)'),
|
|
22
|
+
}, async ({ list_id, ...params }) => {
|
|
23
|
+
try {
|
|
24
|
+
return ok(await api.getListActivity(list_id, compact(params)));
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
return fail(error);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
server.tool('get_list_engagement', `Performance snapshot for a list: audience by status, growth (added / lost / net / churn with a daily series), delivery metrics (sent, unique openers and clickers, open rate, click rate, click-to-open rate), the best performing messages and links, the most engaged contacts, and how much of the audience has gone quiet.
|
|
31
|
+
|
|
32
|
+
Use this before planning a campaign, when reporting on list health, or to decide whether a re-engagement sequence is warranted.`, {
|
|
33
|
+
list_id: z.number().describe('Contact list ID'),
|
|
34
|
+
days: z.number().min(1).max(365).optional().describe('Reporting window in days (default: 30)'),
|
|
35
|
+
}, async ({ list_id, days }) => {
|
|
36
|
+
try {
|
|
37
|
+
return ok(await api.getListEngagement(list_id, compact({ days })));
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
return fail(error);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
server.tool('get_subscriber_activity', `Full history of one contact: profile and engagement counters, every list they belong to with status and dates, their tags, how many messages are still queued for them, and a timeline of signups, confirmations, unsubscribes, sends, opens and clicks.
|
|
44
|
+
|
|
45
|
+
Use this when investigating a single person — "did they get the message?", "why are they still receiving mail?", "when did they unsubscribe?".`, {
|
|
46
|
+
subscriber_id: z.number().describe('Subscriber ID (find it with list_subscribers or get_subscriber)'),
|
|
47
|
+
days: z.number().min(1).max(1095).optional().describe('How far back the timeline reaches (default: 365)'),
|
|
48
|
+
limit: z.number().min(1).max(200).optional().describe('Maximum timeline entries (default: 50)'),
|
|
49
|
+
}, async ({ subscriber_id, ...params }) => {
|
|
50
|
+
try {
|
|
51
|
+
return ok(await api.getSubscriberActivity(subscriber_id, compact(params)));
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
return fail(error);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=list-activity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-activity.js","sourceRoot":"","sources":["../../src/tools/list-activity.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,GAAG;IAClB,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS;CACnG,CAAC;AAEX,MAAM,UAAU,yBAAyB,CAAC,MAAiB,EAAE,GAAsB;IAEjF,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB;;;;gGAI4F,EAC5F;QACE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;QAC1F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;QAC9F,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;KACjG,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE;QAC/B,IAAI,CAAC;YACH,OAAO,EAAE,CA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AAC,QAAQ,CAAC,wCAAwC,CAAC;KAChG,EACD,KAAK,EAAE,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE;QACrC,IAAI,CAAC;YACH,OAAO,EAAE,CAAC,MAAM,GAAG,CAAC,qBAAqB,CAAC,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - List Export Tools
|
|
3
|
+
*
|
|
4
|
+
* Pull list members out as data the assistant can work with — filtered,
|
|
5
|
+
* field-selected and cursor-paged.
|
|
6
|
+
*/
|
|
7
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
|
+
import type { NetSendoApiClient } from '../api-client.js';
|
|
9
|
+
export declare function registerListExportTools(server: McpServer, api: NetSendoApiClient): void;
|
|
10
|
+
//# sourceMappingURL=list-export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-export.d.ts","sourceRoot":"","sources":["../../src/tools/list-export.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAI1D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,iBAAiB,QAiEhF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - List Export Tools
|
|
3
|
+
*
|
|
4
|
+
* Pull list members out as data the assistant can work with — filtered,
|
|
5
|
+
* field-selected and cursor-paged.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { ok, fail, compact } from './helpers.js';
|
|
9
|
+
export function registerListExportTools(server, api) {
|
|
10
|
+
server.tool('export_list', `Export a list's members. Returns the rows inline, so the data can be analysed, transformed or handed to the user directly.
|
|
11
|
+
|
|
12
|
+
Filtering: status, tags, signup date range, and engagement (engaged=false isolates contacts who never opened or clicked).
|
|
13
|
+
Formats: "json" (records array — best for further processing), "csv" or "ndjson" (returned as a single string in "data").
|
|
14
|
+
|
|
15
|
+
Paging: at most 5000 rows per call. When has_more is true, call again with cursor=next_cursor to continue. Do not raise the limit to avoid paging — page instead.
|
|
16
|
+
|
|
17
|
+
Use get_export_fields first if unsure which columns, including custom fields, are available.`, {
|
|
18
|
+
list_id: z.number().describe('Contact list ID'),
|
|
19
|
+
format: z.enum(['json', 'csv', 'ndjson']).optional().describe('Output format (default: json)'),
|
|
20
|
+
fields: z.array(z.string()).optional().describe('Columns to include, e.g. ["email","first_name","tags","custom_fields"] (default: id, email, phone, first_name, last_name, status, subscribed_at)'),
|
|
21
|
+
status: z.enum(['active', 'inactive', 'unsubscribed', 'bounced', 'all']).optional().describe('Membership status filter (default: active)'),
|
|
22
|
+
tag_ids: z.array(z.number()).optional().describe('Only contacts carrying at least one of these tag IDs'),
|
|
23
|
+
subscribed_after: z.string().optional().describe('ISO date — only members who joined on/after this date'),
|
|
24
|
+
subscribed_before: z.string().optional().describe('ISO date — only members who joined on/before this date'),
|
|
25
|
+
engaged: z.boolean().optional().describe('true = only contacts with an open or click; false = only contacts with neither'),
|
|
26
|
+
limit: z.number().min(1).max(5000).optional().describe('Rows per call (default: 500, max: 5000)'),
|
|
27
|
+
cursor: z.number().optional().describe('Pass next_cursor from the previous call to fetch the next page'),
|
|
28
|
+
delimiter: z.string().optional().describe('CSV delimiter (default: ",")'),
|
|
29
|
+
}, async ({ list_id, ...options }) => {
|
|
30
|
+
try {
|
|
31
|
+
return ok(await api.exportList(list_id, compact(options)));
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
return fail(error);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
server.tool('get_export_fields', 'List the columns export_list can return for a list: standard subscriber fields plus the account\'s custom fields with their names and types.', {
|
|
38
|
+
list_id: z.number().describe('Contact list ID'),
|
|
39
|
+
}, async ({ list_id }) => {
|
|
40
|
+
try {
|
|
41
|
+
return ok(await api.getExportFields(list_id));
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
return fail(error);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
server.tool('queue_list_export', `Queue the full CSV export of a list. The file is generated in the background and NetSendo sends the account owner a download link.
|
|
48
|
+
|
|
49
|
+
Use this for a complete archive the user wants as a file. For data the assistant needs to reason about, use export_list instead — it returns rows immediately.`, {
|
|
50
|
+
list_id: z.number().describe('Contact list ID'),
|
|
51
|
+
}, async ({ list_id }) => {
|
|
52
|
+
try {
|
|
53
|
+
return ok(await api.queueListExport(list_id));
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return fail(error);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=list-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-export.js","sourceRoot":"","sources":["../../src/tools/list-export.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,UAAU,uBAAuB,CAAC,MAAiB,EAAE,GAAsB;IAE/E,MAAM,CAAC,IAAI,CACT,aAAa,EACb;;;;;;;6FAOyF,EACzF;QACE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAC/C,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,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C;YACH,OAAO,EAAE,CAAC,MAAM,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAsB,CAAC,CAAC,CAAC;QAClF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,8IAA8I,EAC9I;QACE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;KAChD,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACpB,IAAI,CAAC;YACH,OAAO,EAAE,CAAC,MAAM,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB;;+JAE2J,EAC3J;QACE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;KAChD,EACD,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACpB,IAAI,CAAC;YACH,OAAO,EAAE,CAAC,MAAM,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NetSendo MCP Server - List Hygiene Tools
|
|
3
|
+
*
|
|
4
|
+
* Diagnose what is hurting a list's deliverability, then fix it. Every
|
|
5
|
+
* mutating tool here defaults to a dry run, and the irreversible actions
|
|
6
|
+
* additionally require confirm=true.
|
|
7
|
+
*/
|
|
8
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
9
|
+
import type { NetSendoApiClient } from '../api-client.js';
|
|
10
|
+
export declare function registerListHygieneTools(server: McpServer, api: NetSendoApiClient): void;
|
|
11
|
+
//# sourceMappingURL=list-hygiene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-hygiene.d.ts","sourceRoot":"","sources":["../../src/tools/list-hygiene.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AA4C1D,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,iBAAiB,QA2HjF"}
|