@omnidim-ai/mcp-server 0.9.2 → 0.11.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/build/index.d.ts +1 -1
- package/build/index.js +267 -170
- package/build/index.js.map +1 -1
- package/build/procedures.js +138 -1
- package/build/procedures.js.map +1 -1
- package/build/tool-annotations.js +22 -13
- package/build/tool-annotations.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +267 -170
- package/src/procedures.ts +139 -1
- package/src/tool-annotations.ts +22 -13
package/src/procedures.ts
CHANGED
|
@@ -40,6 +40,10 @@ give it a **phone number** and optionally a **knowledge base**, then place
|
|
|
40
40
|
\`audit_calls\` prompt, then \`listCallLogs\` + \`getCallLog\`.
|
|
41
41
|
- "List / inspect what exists" -> \`listAgents\`, \`listPhoneNumbers\`,
|
|
42
42
|
\`listVoices\`, \`listKnowledgeBaseFiles\`.
|
|
43
|
+
- "Get me a number / buy a number" -> \`searchPhoneNumbers\` { region } then
|
|
44
|
+
\`purchasePhoneNumber\`. This spends the account's balance, so confirm the
|
|
45
|
+
exact number and price with the user before buying. \`releasePhoneNumber\`
|
|
46
|
+
gives one up and cannot be undone.
|
|
43
47
|
- "Place one call now" -> \`dispatchCall\`. "Call many contacts" -> the bulk
|
|
44
48
|
call tools.
|
|
45
49
|
|
|
@@ -262,6 +266,76 @@ specific old -> new changes. Pick the comparison with \`against\`:
|
|
|
262
266
|
freely. Restore and delete mutate the live agent - confirm intent first.
|
|
263
267
|
`;
|
|
264
268
|
|
|
269
|
+
const BULK_CAMPAIGNS_GUIDE = `# Running outbound campaigns
|
|
270
|
+
|
|
271
|
+
## Normal or dynamic
|
|
272
|
+
- One-time list: a normal campaign. Create it (as a draft), add contacts, start it.
|
|
273
|
+
- Continuous leads (form fills, CRM events): a dynamic campaign
|
|
274
|
+
(\`is_dynamic: true\`, no contact list) fed by \`addBulkCallContact\` as each
|
|
275
|
+
lead arrives. The faster a fresh lead is called, the higher the conversion.
|
|
276
|
+
|
|
277
|
+
## The two contact shapes (do not mix them)
|
|
278
|
+
- \`createBulkCall\`'s \`contact_list\` rows are FLAT:
|
|
279
|
+
\`{ "phone_number": "+1...", "any_other_key": "reaches the agent as context" }\`.
|
|
280
|
+
- \`addBulkCallContact\` / \`addBulkCallContacts\` instead take
|
|
281
|
+
\`{ to_number, custom_variables: {...}, metadata: {...} }\`. \`metadata\` is
|
|
282
|
+
bookkeeping the agent never sees.
|
|
283
|
+
- Sending \`custom_variables\` inside a \`contact_list\` row does not error; it
|
|
284
|
+
becomes one nested variable and garbles the agent's context.
|
|
285
|
+
|
|
286
|
+
## Build as a draft, then start
|
|
287
|
+
- \`createBulkCall\` { requestBody: { name, phone_number_id, save_as_draft: true, ... } }.
|
|
288
|
+
Keep the returned \`id\`. Without \`save_as_draft\` the campaign dials the
|
|
289
|
+
moment it is created.
|
|
290
|
+
- \`addBulkCallContacts\` accepts up to 1000 contacts per request. Invalid rows
|
|
291
|
+
come back in \`rejected\` with their index and reason; valid rows are still
|
|
292
|
+
added, so one bad number never costs the batch.
|
|
293
|
+
- \`startBulkCall\` launches a draft.
|
|
294
|
+
- Adding contacts is NOT dynamic-only: any campaign that is not cancelled or
|
|
295
|
+
failed accepts them, and a completed campaign wakes up and dials again.
|
|
296
|
+
|
|
297
|
+
## Size concurrency with arithmetic, not vibes
|
|
298
|
+
- Calls per hour per channel = 3600 / average call seconds (~40/hour at 90s).
|
|
299
|
+
- Channels needed = target calls per hour / per-channel rate.
|
|
300
|
+
- Example: 100,000 calls in an 8-hour day is 12,500/hour, ~315 channels.
|
|
301
|
+
The failure mode: concurrency 5 against 10,000 leads is ~200 calls/hour,
|
|
302
|
+
a 50-hour "today" campaign.
|
|
303
|
+
- \`setBulkCallConcurrency\` changes it mid-run; the org's ceiling caps it.
|
|
304
|
+
|
|
305
|
+
## Numbers and rotation
|
|
306
|
+
- One number dialing a whole campaign collects spam reports and stops being
|
|
307
|
+
answered. Rotate: \`rotation: { numbers: [{ phone_number_id, sequence }],
|
|
308
|
+
strategy: "fixed_count", calls_per_number: 50 }\` at create.
|
|
309
|
+
- \`phone_number_id\` stays required and becomes the standby; list it in
|
|
310
|
+
\`rotation.numbers\` too if it should take a share of the calls.
|
|
311
|
+
- A rotation number attached to a DIFFERENT agent is refused by name. Attach
|
|
312
|
+
it to this campaign's agent first, or leave it out.
|
|
313
|
+
- \`listBulkCallNumbers\` shows which number is dialing now;
|
|
314
|
+
\`setBulkCallNumberActive\` pauses one without losing its history (the last
|
|
315
|
+
active number of a running campaign cannot be paused).
|
|
316
|
+
- Check a new number's reputation before a campaign and watch pickup rates.
|
|
317
|
+
|
|
318
|
+
## Calling hours and the timezone trap
|
|
319
|
+
- \`setBulkCallDailyTimeControl\` sets a hard stop and an auto start; the API
|
|
320
|
+
requires both blocks together.
|
|
321
|
+
- Those times follow the AGENT's timezone, not the operator's. A wrong
|
|
322
|
+
timezone dials people at 11 PM, which is a compliance problem. Set the
|
|
323
|
+
agent's timezone to the customers' region before launching.
|
|
324
|
+
|
|
325
|
+
## Watching a campaign and reading results
|
|
326
|
+
- \`getBulkCallLiveStatus\` for progress counts while it runs.
|
|
327
|
+
- \`listBulkCallLines\` for per-contact outcomes: \`pagesize\` up to 150, follow
|
|
328
|
+
\`next_cursor\` until it comes back null, never build a cursor yourself.
|
|
329
|
+
\`include_total\` once for a header, not on every page.
|
|
330
|
+
- Rows carry \`recording_id\`, not the transcript; \`getCallLog\` serves it.
|
|
331
|
+
- \`retryBulkCall\` re-queues contacts that did not connect; it refuses a
|
|
332
|
+
campaign that is still running.
|
|
333
|
+
|
|
334
|
+
## Contact rules
|
|
335
|
+
- Numbers are E.164 with the country code. Run one campaign per country code.
|
|
336
|
+
- Dashboard CSV uploads need the phone column named exactly \`phone_number\`.
|
|
337
|
+
`;
|
|
338
|
+
|
|
265
339
|
const RESOURCES: ResourceDef[] = [
|
|
266
340
|
{
|
|
267
341
|
uri: "omnidim://guide/routing",
|
|
@@ -291,6 +365,13 @@ const RESOURCES: ResourceDef[] = [
|
|
|
291
365
|
mimeType: "text/markdown",
|
|
292
366
|
text: AGENT_CONFIG_GUIDE,
|
|
293
367
|
},
|
|
368
|
+
{
|
|
369
|
+
uri: "omnidim://guide/bulk-campaigns",
|
|
370
|
+
name: "Running outbound campaigns",
|
|
371
|
+
description: "The campaign lifecycle end to end: draft, batch contacts (two contact shapes, do not mix), rotation, concurrency arithmetic, the agent-timezone trap, cursor-paged results.",
|
|
372
|
+
mimeType: "text/markdown",
|
|
373
|
+
text: BULK_CAMPAIGNS_GUIDE,
|
|
374
|
+
},
|
|
294
375
|
{
|
|
295
376
|
uri: "omnidim://guide/agent-versioning",
|
|
296
377
|
name: "Agent version history",
|
|
@@ -340,7 +421,10 @@ Follow these steps in order. Each write tool wraps its payload in \`requestBody\
|
|
|
340
421
|
Capture the returned \`id\` as agent_id. (\`status\` is always "Completed"; it is not a build signal.)
|
|
341
422
|
3. Give it a number: \`listPhoneNumbers\` -> pick a number \`id\`. Attach it with
|
|
342
423
|
\`attachPhoneNumber\` { requestBody: { phone_number_id, agent_id } }. If no
|
|
343
|
-
number exists,
|
|
424
|
+
number exists, either buy one (\`searchPhoneNumbers\` { region } then
|
|
425
|
+
\`purchasePhoneNumber\`, which charges the account, so confirm with the user
|
|
426
|
+
first and never pick for them) or import one you already own
|
|
427
|
+
(importTwilioNumber / importExotelNumber / importSipTrunk).
|
|
344
428
|
4. Optional knowledge base: \`uploadKnowledgeBaseFile\` then \`attachKnowledgeBaseFiles\` { requestBody: { file_ids, agent_id } }.
|
|
345
429
|
${testLine}
|
|
346
430
|
|
|
@@ -384,6 +468,60 @@ Throughout: phone numbers are E.164 with a leading \`+\`. See the \`omnidim://gu
|
|
|
384
468
|
See the \`omnidim://guide/routing\` resource for the full gotcha list.`;
|
|
385
469
|
},
|
|
386
470
|
},
|
|
471
|
+
{
|
|
472
|
+
name: "build_outbound_campaign",
|
|
473
|
+
description: "Set up and launch a bulk-call campaign safely: draft it, batch the contacts in, size concurrency from the numbers, check calling hours, then start and watch it.",
|
|
474
|
+
arguments: [
|
|
475
|
+
{ name: "goal", description: "Who to call and why, in plain language (e.g. 'call 8,000 renewal leads today between 9 and 6 Eastern').", required: true },
|
|
476
|
+
{ name: "agent_id", description: "Optional agent to run the calls (the listAgents id). If omitted, the agent attached to the chosen number runs them.", required: false },
|
|
477
|
+
{ name: "phone_number_id", description: "Optional number id to dial from (from listPhoneNumbers). If omitted, pick with the user from their numbers.", required: false },
|
|
478
|
+
],
|
|
479
|
+
build: (a) => {
|
|
480
|
+
const goal = a.goal || "(describe who to call and why)";
|
|
481
|
+
const numberLine = a.phone_number_id
|
|
482
|
+
? `Use phone_number_id "${a.phone_number_id}".`
|
|
483
|
+
: `Call \`listPhoneNumbers\` and pick the dialing number WITH the user; never pick silently.`;
|
|
484
|
+
const agentLine = a.agent_id
|
|
485
|
+
? `Pass bot_id ${a.agent_id} so this agent runs the calls even if the number has a different or no agent attached.`
|
|
486
|
+
: `If the number has an agent attached it runs the calls; otherwise pass a \`bot_id\`.`;
|
|
487
|
+
return `Set up and launch an OmniDimension bulk-call campaign for this goal:
|
|
488
|
+
|
|
489
|
+
"${goal}"
|
|
490
|
+
|
|
491
|
+
Follow these steps in order. Each write tool wraps its payload in \`requestBody\`.
|
|
492
|
+
A campaign dials real people and spends real money: confirm the plan with the
|
|
493
|
+
user before \`startBulkCall\`, and never start one they have not approved.
|
|
494
|
+
|
|
495
|
+
1. Decide the shape: a one-time list is a normal campaign; continuously arriving
|
|
496
|
+
leads mean a dynamic campaign (\`is_dynamic: true\`) fed by
|
|
497
|
+
\`addBulkCallContact\` instead of steps 3 and 5.
|
|
498
|
+
2. Number and agent: ${numberLine} ${agentLine}
|
|
499
|
+
3. Create it as a draft with \`createBulkCall\`
|
|
500
|
+
{ requestBody: { name, phone_number_id, save_as_draft: true, concurrent_call_limit: <sized below> } }.
|
|
501
|
+
Add \`call_conditions\` to dial only matching contacts, and \`rotation\` when
|
|
502
|
+
dialing from several numbers (see the bulk-campaigns resource for the shape).
|
|
503
|
+
Keep the returned \`id\`.
|
|
504
|
+
4. Size concurrency from the goal's numbers, not a guess: per channel,
|
|
505
|
+
3600 / average call seconds gives calls per hour (~40 at 90s); divide the
|
|
506
|
+
target hourly rate by that. Show the arithmetic to the user.
|
|
507
|
+
5. Add contacts with \`addBulkCallContacts\` in batches of up to 1000:
|
|
508
|
+
{ requestBody: { contacts: [{ to_number: "+1...", custom_variables: {...} }] } }.
|
|
509
|
+
This shape differs from create's contact_list on purpose; do not mix them.
|
|
510
|
+
Report anything that comes back in \`rejected\` with its row index.
|
|
511
|
+
6. Calling hours: if the goal names a time window, set it with
|
|
512
|
+
\`setBulkCallDailyTimeControl\` (both the stop and start blocks are required)
|
|
513
|
+
and FIRST verify the agent's timezone matches the customers' region; those
|
|
514
|
+
times follow the agent's timezone, and a mismatch dials people at night.
|
|
515
|
+
7. Show the user the plan (campaign id, contact count, concurrency, window,
|
|
516
|
+
rotation) and get their explicit go-ahead. Then \`startBulkCall\`.
|
|
517
|
+
8. Watch it: \`getBulkCallLiveStatus\` for progress. When it finishes, read
|
|
518
|
+
per-contact outcomes with \`listBulkCallLines\` (follow \`next_cursor\` until
|
|
519
|
+
null) and offer \`retryBulkCall\` for contacts that did not connect.
|
|
520
|
+
|
|
521
|
+
See the \`omnidim://guide/bulk-campaigns\` resource for the full rules and
|
|
522
|
+
failure modes.`;
|
|
523
|
+
},
|
|
524
|
+
},
|
|
387
525
|
{
|
|
388
526
|
name: "restore_agent_version",
|
|
389
527
|
description: "Safely roll an agent back to an earlier saved version: find the right snapshot, preview exactly what restoring changes, then restore.",
|
package/src/tool-annotations.ts
CHANGED
|
@@ -27,6 +27,15 @@ const TOOL_TITLES: Record<string, string> = {
|
|
|
27
27
|
bulkCallActions: "Control bulk campaign",
|
|
28
28
|
cancelBulkCall: "Cancel bulk campaign",
|
|
29
29
|
getBulkCallLiveStatus: "Get campaign live status",
|
|
30
|
+
startBulkCall: "Start draft campaign",
|
|
31
|
+
addBulkCallContacts: "Add contacts to campaign",
|
|
32
|
+
retryBulkCall: "Retry unconnected contacts",
|
|
33
|
+
setBulkCallConcurrency: "Set campaign concurrency",
|
|
34
|
+
setBulkCallDailyTimeControl: "Set campaign calling hours",
|
|
35
|
+
listBulkCallLines: "List campaign call results",
|
|
36
|
+
listBulkCallNumbers: "List campaign number pool",
|
|
37
|
+
addBulkCallNumber: "Add number to campaign pool",
|
|
38
|
+
setBulkCallNumberActive: "Pause or resume pool number",
|
|
30
39
|
listKnowledgeBaseFiles: "List knowledge base files",
|
|
31
40
|
canUploadFile: "Check file upload eligibility",
|
|
32
41
|
uploadKnowledgeBaseFile: "Upload knowledge base file",
|
|
@@ -45,30 +54,30 @@ const TOOL_TITLES: Record<string, string> = {
|
|
|
45
54
|
listTTSProviders: "List text-to-speech providers",
|
|
46
55
|
listAllProviders: "List all providers",
|
|
47
56
|
getVoice: "Get voice",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
setUserExpiry: "Set user expiry",
|
|
52
|
-
setChildConcurrency: "Set child concurrency limit",
|
|
53
|
-
calculateCreditOperation: "Preview credit operation",
|
|
54
|
-
transferCreditsToChild: "Transfer credits to child",
|
|
55
|
-
revertCreditsFromChild: "Revert credits from child",
|
|
56
|
-
getResellerCreditLogs: "Get reseller credit logs",
|
|
57
|
+
searchPhoneNumbers: "Search available phone numbers",
|
|
58
|
+
purchasePhoneNumber: "Buy phone number",
|
|
59
|
+
releasePhoneNumber: "Release phone number",
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
// POST tools that only validate or preview, with no state change.
|
|
60
|
-
const READ_ONLY_TOOLS = new Set(["canUploadFile"
|
|
63
|
+
const READ_ONLY_TOOLS = new Set(["canUploadFile"]);
|
|
61
64
|
|
|
62
65
|
// Irreversible removals, overwrites of live config, plus tools that place
|
|
63
66
|
// real outbound calls.
|
|
64
67
|
const DESTRUCTIVE_TOOLS = new Set([
|
|
65
68
|
"deleteAgent", "deleteAgentVersion", "restoreAgentVersion",
|
|
66
69
|
"deleteKnowledgeBaseFile", "detachKnowledgeBaseFiles", "detachPhoneNumber",
|
|
67
|
-
"cancelBulkCall", "
|
|
70
|
+
"cancelBulkCall", "dispatchCall", "createBulkCall", "addBulkCallContact",
|
|
71
|
+
"addBulkCallContacts", "startBulkCall", "retryBulkCall",
|
|
72
|
+
"purchasePhoneNumber", "releasePhoneNumber",
|
|
68
73
|
]);
|
|
69
74
|
|
|
70
|
-
// Tools that reach the external phone network.
|
|
71
|
-
const OPEN_WORLD_TOOLS = new Set([
|
|
75
|
+
// Tools that reach the external phone network (a carrier, not just our API).
|
|
76
|
+
const OPEN_WORLD_TOOLS = new Set([
|
|
77
|
+
"dispatchCall", "createBulkCall", "addBulkCallContact",
|
|
78
|
+
"addBulkCallContacts", "startBulkCall", "retryBulkCall",
|
|
79
|
+
"purchasePhoneNumber", "releasePhoneNumber",
|
|
80
|
+
]);
|
|
72
81
|
|
|
73
82
|
export interface ToolAnnotations {
|
|
74
83
|
title?: string;
|