@omnidim-ai/mcp-server 0.10.1 → 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/src/index.ts CHANGED
@@ -49,7 +49,7 @@ interface McpToolDefinition {
49
49
  * Server configuration
50
50
  */
51
51
  export const SERVER_NAME = "OmniDimension";
52
- export const SERVER_VERSION = "0.10.1";
52
+ export const SERVER_VERSION = "0.11.0";
53
53
  // Base URL for the API. Pinned to production; not env-overridable.
54
54
  export const API_BASE_URL = "https://backend.omnidim.io/api/v1";
55
55
 
@@ -102,7 +102,7 @@ connect and talk, see "Connect the client and talk" below the
102
102
  request details.
103
103
 
104
104
  (Tags: Sessions)`,
105
- inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["agent_id","type"],"properties":{"agent_id":{"type":"number","description":"ID of the agent the session talks to."},"type":{"type":"string","enum":["voice"],"description":"The session type. Only `voice` is supported."},"custom_variables":{"type":"object","additionalProperties":true,"description":"Per-session variables that personalize the conversation.\nSet server-side, so visitors cannot tamper with them.\n"},"metadata":{"type":"object","additionalProperties":true,"description":"Key-value pairs stored on the session for your own\ntracking (e.g. CRM or lead IDs). Not shared with the\nagent; echoed back as `metadata` in the post-call\nwebhook so you can correlate results with your records.\n"}},"description":"The JSON request body."}},"required":["requestBody"]},
105
+ inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["agent_id","type"],"properties":{"agent_id":{"type":"number","description":"ID of the agent the session talks to."},"type":{"type":"string","default":"voice","enum":["voice"],"description":"The session type. Only `voice` is supported."},"custom_variables":{"type":"object","additionalProperties":true,"description":"Per-session variables that personalize the conversation.\nSet server-side, so visitors cannot tamper with them.\n"},"metadata":{"type":"object","additionalProperties":true,"description":"Key-value pairs stored on the session for your own\ntracking (e.g. CRM or lead IDs). Not shared with the\nagent; echoed back as `metadata` in the post-call\nwebhook so you can correlate results with your records.\n"}},"description":"The JSON request body."}},"required":["requestBody"]},
106
106
  method: "post",
107
107
  pathTemplate: "/sessions/create",
108
108
  executionParameters: [],
@@ -321,22 +321,18 @@ phone number must include a country code with a leading plus.
321
321
  }],
322
322
  ["createBulkCall", {
323
323
  name: "createBulkCall",
324
- description: `Create a new bulk-call campaign. Supports immediate, scheduled,
325
- and auto-retry modes.
324
+ description: `Create a new bulk-call campaign. Only name, phone_number_id and a
325
+ contact_list are needed to dial a list now; every other field adds
326
+ one behaviour on top (drafts, rotation, filtering, scheduling,
327
+ retries, dynamic feeding).
326
328
 
327
- There are two kinds of campaign:
328
-
329
- - **Static** (default): you supply the full \`contact_list\` up
330
- front and the campaign dials through it.
331
- - **Dynamic**: set \`is_dynamic\` to \`true\` and the campaign accepts
332
- contacts in real time via the Add contact to dynamic campaign
333
- webhook. \`contact_list\` is optional here, so you can start the
334
- campaign empty and feed it from a CRM, form, or automation. A
335
- dynamic campaign stays alive waiting for contacts instead of
336
- completing when its queue drains.
329
+ The guide below the field reference walks the whole journey: the
330
+ first campaign and its response, each behaviour with a working
331
+ request, every refusal message with its fix, and the endpoints that
332
+ operate a campaign once it runs.
337
333
 
338
334
  (Tags: Bulk calls)`,
339
- inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["name","phone_number_id"],"properties":{"name":{"type":"string","description":"Name of the bulk call campaign."},"phone_number_id":{"type":"string","description":"Your phone number id to use for making calls."},"is_dynamic":{"type":"boolean","default":false,"description":"Set to `true` to create a dynamic campaign that accepts\ncontacts in real time via the Add contact to dynamic\ncampaign webhook. When `true`, `contact_list` is optional\nand may be omitted to start the campaign empty.\n"},"contact_list":{"type":"array","description":"Array of contact objects. Each row needs `phone_number`.\nAny other key you add on the row (e.g. `customer_name`,\n`account_id`, `priority`) is passed to the agent as a\ncontext variable for that specific call, so the agent\ncan reference it during the conversation.\n\nRequired for static campaigns. Optional when `is_dynamic`\nis `true` (you can omit it and add contacts later via the\nwebhook).\n","items":{"type":"object","required":["phone_number"],"properties":{"phone_number":{"type":"string","description":"Phone number in international format (e.g., +15551234567)."}},"additionalProperties":true}},"is_scheduled":{"type":"boolean","default":false,"description":"Whether the campaign should be scheduled for future execution."},"scheduled_datetime":{"type":"string","description":"Scheduled execution time in format `YYYY-MM-DD HH:MM:SS` (required if `is_scheduled` is true)."},"timezone":{"type":"string","default":"UTC","description":"Timezone for scheduled execution."},"concurrent_call_limit":{"type":"number","default":1,"minimum":1,"description":"Maximum number of concurrent calls allowed."},"enabled_reschedule_call":{"type":"boolean","default":false,"description":"Enable automatic call rescheduling. When enabled the system can reschedule unreachable calls."},"retry_config":{"type":"object","description":"Auto-retry configuration object containing retry settings.","properties":{"auto_retry":{"type":"boolean","default":false},"auto_retry_schedule":{"type":"string","enum":["immediately","next_day","scheduled_time"],"description":"When to retry failed calls."},"retry_schedule_days":{"type":"number","default":0,"minimum":0,"description":"Days to wait before a scheduled retry."},"retry_schedule_hours":{"type":"number","default":0,"minimum":0,"description":"Hours to wait before a scheduled retry."},"retry_limit":{"type":"number","default":0,"minimum":0,"maximum":5,"description":"Maximum number of retry attempts (0–5)."}}}},"description":"The JSON request body."}},"required":["requestBody"]},
335
+ inputSchema: {"type":"object","properties":{"requestBody":{"type":"object","required":["name","phone_number_id"],"properties":{"name":{"type":"string","description":"Name of the bulk call campaign."},"phone_number_id":{"type":"string","description":"The number this campaign calls from. With a `rotation`, the\nrotation numbers dial instead and this one is the standby.\n"},"bot_id":{"type":"number","description":"Agent to run the campaign. Defaults to the agent attached\nto `phone_number_id`; required when the number has none.\n"},"save_as_draft":{"type":"boolean","default":false,"description":"Store the campaign without dialing; start it later with the\nstart endpoint. See Drafts in the guide below.\n"},"call_conditions":{"type":"array","description":"Dial only the contacts that match every condition; the rest\nare kept as `Skipped`. See Filtering in the guide below.\n","items":{"type":"object","required":["column","operator","value"],"properties":{"column":{"type":"string","description":"Key on the contact row to test."},"operator":{"type":"string","default":"equals","enum":["equals","not_equals","contains","greater_than","less_than"],"description":"`contains` is case-insensitive. `greater_than` and\n`less_than` compare numerically, and a row whose value\nis not a number fails the condition rather than\nerroring.\n"},"value":{"type":"string"}}}},"rotation":{"type":"object","description":"Rotate the campaign across several of your numbers, so no\nsingle number burns out. See Rotation in the guide below.\n","required":["numbers"],"properties":{"numbers":{"type":"array","minItems":1,"description":"The numbers to rotate across; each must be yours and\nlisted once.\n","items":{"type":"object","required":["phone_number_id"],"properties":{"phone_number_id":{"type":"number","description":"One of your numbers, from List phone numbers."},"sequence":{"type":"number","default":10,"description":"Rotation order. Lowest dials first."}}}},"strategy":{"type":"string","default":"fixed_count","enum":["fixed_count","cpr_threshold","both","none"],"description":"When to move to the next number: every\n`calls_per_number` calls, on low health score, both, or\nnever.\n"},"calls_per_number":{"type":"number","default":50,"description":"Calls before moving on. Used by `fixed_count` and `both`."},"health_threshold":{"type":"number","default":30,"description":"Health score below which a number is rotated away from.\nUsed by `cpr_threshold` and `both`.\n"},"fallback":{"type":"string","default":"pause","enum":["pause","continue_best"],"description":"When every number is unhealthy: `pause` the campaign,\nor `continue_best` with the healthiest one.\n"}}},"is_dynamic":{"type":"boolean","default":false,"description":"A dynamic campaign stays alive accepting contacts via the\nadd-contact webhooks, and `contact_list` becomes optional.\n"},"contact_list":{"type":"array","description":"Who to call. Each row needs `phone_number`; any other key\nreaches the agent as context for that one call.\n","items":{"type":"object","required":["phone_number"],"properties":{"phone_number":{"type":"string","description":"Phone number in international format (e.g., +15551234567)."}},"additionalProperties":true}},"is_scheduled":{"type":"boolean","default":false,"description":"Whether the campaign should be scheduled for future execution."},"scheduled_datetime":{"type":"string","description":"Scheduled execution time in format `YYYY-MM-DD HH:MM:SS` (required if `is_scheduled` is true)."},"timezone":{"type":"string","default":"UTC","description":"Timezone for scheduled execution."},"concurrent_call_limit":{"type":"number","default":1,"minimum":1,"description":"Maximum number of concurrent calls allowed."},"enabled_reschedule_call":{"type":"boolean","default":false,"description":"Enable automatic call rescheduling. When enabled the system can reschedule unreachable calls."},"retry_config":{"type":"object","description":"Auto-retry configuration object containing retry settings.","properties":{"auto_retry":{"type":"boolean","default":false},"auto_retry_schedule":{"type":"string","enum":["immediately","next_day","scheduled_time"],"description":"When to retry failed calls."},"retry_schedule_days":{"type":"number","default":0,"minimum":0,"description":"Days to wait before a scheduled retry."},"retry_schedule_hours":{"type":"number","default":0,"minimum":0,"description":"Hours to wait before a scheduled retry."},"retry_limit":{"type":"number","default":1,"minimum":1,"maximum":10,"description":"Retry attempts, 1 to 10. To disable retries omit it and\nleave `auto_retry` false; never send `0`.\n"}}}},"description":"The JSON request body."}},"required":["requestBody"]},
340
336
  method: "post",
341
337
  pathTemplate: "/calls/bulk_call/create",
342
338
  executionParameters: [],
@@ -404,6 +400,208 @@ operating hours.
404
400
  tags: ["Bulk calls"],
405
401
  deprecated: false
406
402
  }],
403
+ ["listBulkCallLines", {
404
+ name: "listBulkCallLines",
405
+ description: `Per-contact results for a campaign: what happened on each call, the
406
+ variables you sent with that contact, and a pointer to the recording.
407
+
408
+ ## Paging
409
+
410
+ There is one rule. Call it with no \`cursor\`, then keep passing back the
411
+ \`next_cursor\` you were handed until it comes back \`null\`.
412
+
413
+ \`\`\`
414
+ cursor = None
415
+ while True:
416
+ page = GET /lines?pagesize=150&cursor={cursor}
417
+ handle(page["records"])
418
+ cursor = page["next_cursor"]
419
+ if not cursor: break
420
+ \`\`\`
421
+
422
+ Each call returns a page of rows, oldest first: \`pagesize\` goes up to
423
+ 150 and defaults to 30. Cursors are opaque, so pass back the string you
424
+ were given and never build one. No contact is skipped or returned
425
+ twice, even while the campaign is still dialing.
426
+
427
+ ## Transcripts are not in the row
428
+
429
+ Each row carries \`call.recording_id\`, not the conversation. Transcripts
430
+ reach 212 KB, so carrying them here would make one page tens of
431
+ megabytes. Fetch the one you want from
432
+ \`GET /calls/logs/{recording_id}\`.
433
+
434
+ (Tags: Bulk calls)`,
435
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."},"cursor":{"type":"string","description":"The `next_cursor` from your previous response. Omit it on the first\nrequest. Opaque: pass it back unchanged.\n"},"pagesize":{"type":"integer","minimum":1,"default":30,"maximum":150,"description":"Rows per page. Above 150 the request is refused."},"call_status":{"type":"string","enum":["Pending","In Progress","completed","voicemail_detected","no-answer","busy","Failed","Skipped","retry_scheduled","cancelled"],"description":"Return only contacts in this state."},"interaction_status":{"type":"string","description":"Return only contacts with this interaction outcome."},"search":{"type":"string","description":"An exact phone number, matched against the contact's number and the\nnumber that called it. Not a substring search.\n"},"include_total":{"type":"boolean","default":false,"description":"Add `total_records` to the response. It costs a count over the whole\nfiltered campaign, so it is off unless you ask. Ask for it once to\nfill a header, not on every page of a walk.\n"}},"required":["bulk_call_id"]},
436
+ method: "get",
437
+ pathTemplate: "/calls/bulk_call/{bulk_call_id}/lines",
438
+ executionParameters: [{"name":"bulk_call_id","in":"path"},{"name":"cursor","in":"query"},{"name":"pagesize","in":"query"},{"name":"call_status","in":"query"},{"name":"interaction_status","in":"query"},{"name":"search","in":"query"},{"name":"include_total","in":"query"}],
439
+ requestBodyContentType: undefined,
440
+ securityRequirements: [{"BearerAuth":[]}],
441
+ tags: ["Bulk calls"],
442
+ deprecated: false
443
+ }],
444
+ ["listBulkCallNumbers", {
445
+ name: "listBulkCallNumbers",
446
+ description: `The campaign's number pool, and which number is dialing right now.
447
+
448
+ \`calls_this_cycle\` is what \`fixed_count\` rotation compares against, so
449
+ it is the field to watch for the next rotation. \`calls_dispatched\` is
450
+ the number's lifetime total across every cycle.
451
+
452
+ (Tags: Bulk calls)`,
453
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."}},"required":["bulk_call_id"]},
454
+ method: "get",
455
+ pathTemplate: "/calls/bulk_call/{bulk_call_id}/numbers",
456
+ executionParameters: [{"name":"bulk_call_id","in":"path"}],
457
+ requestBodyContentType: undefined,
458
+ securityRequirements: [{"BearerAuth":[]}],
459
+ tags: ["Bulk calls"],
460
+ deprecated: false
461
+ }],
462
+ ["addBulkCallNumber", {
463
+ name: "addBulkCallNumber",
464
+ description: `Add one of your numbers to the campaign's rotation pool. Works while the
465
+ campaign is running, which is how you bring in a fresh number when the
466
+ pool is running out of healthy ones.
467
+
468
+ The number must belong to you and must not already be in the pool. A
469
+ number with no agent attached gets this campaign's agent attached
470
+ automatically; a number attached to a **different** agent is refused.
471
+
472
+ (Tags: Bulk calls)`,
473
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."},"requestBody":{"type":"object","required":["phone_number_id"],"properties":{"phone_number_id":{"type":"number","description":"One of your numbers, from List phone numbers."}},"description":"The JSON request body."}},"required":["bulk_call_id","requestBody"]},
474
+ method: "post",
475
+ pathTemplate: "/calls/bulk_call/{bulk_call_id}/numbers",
476
+ executionParameters: [{"name":"bulk_call_id","in":"path"}],
477
+ requestBodyContentType: "application/json",
478
+ securityRequirements: [{"BearerAuth":[]}],
479
+ tags: ["Bulk calls"],
480
+ deprecated: false
481
+ }],
482
+ ["setBulkCallNumberActive", {
483
+ name: "setBulkCallNumberActive",
484
+ description: `Stop or resume dialing from one number in the pool.
485
+
486
+ Pausing is what you want when a number starts going bad mid-campaign:
487
+ dialing moves to the next number in sequence and the paused number keeps
488
+ its history and counters. The last active number of a running campaign
489
+ cannot be paused, since the campaign would have nothing to dial from.
490
+
491
+ Send the state you want rather than a toggle, so retrying the same
492
+ request is harmless.
493
+
494
+ \`assignment_id\` is the number's id **within this campaign's pool**, from
495
+ List rotation pool. It is not the \`phone_number_id\`.
496
+
497
+ (Tags: Bulk calls)`,
498
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."},"assignment_id":{"type":"number","description":"The `assignment_id` from List rotation pool."},"requestBody":{"type":"object","required":["is_active"],"properties":{"is_active":{"type":"boolean","description":"`false` pauses the number, `true` resumes it."}},"description":"The JSON request body."}},"required":["bulk_call_id","assignment_id","requestBody"]},
499
+ method: "put",
500
+ pathTemplate: "/calls/bulk_call/{bulk_call_id}/numbers/{assignment_id}",
501
+ executionParameters: [{"name":"bulk_call_id","in":"path"},{"name":"assignment_id","in":"path"}],
502
+ requestBodyContentType: "application/json",
503
+ securityRequirements: [{"BearerAuth":[]}],
504
+ tags: ["Bulk calls"],
505
+ deprecated: false
506
+ }],
507
+ ["addBulkCallContacts", {
508
+ name: "addBulkCallContacts",
509
+ description: `Add up to 1000 contacts to a campaign in one request.
510
+
511
+ This is the batch form of Add contact to dynamic campaign. Prefer it
512
+ whenever you have more than a handful: one request of 500 contacts is
513
+ far cheaper than 500 requests, on your side and ours.
514
+
515
+ Repeated numbers are kept, not merged. If the same number appears twice
516
+ with different variables, it is called twice, because two rows for one
517
+ number usually means two real reasons to call.
518
+
519
+ Rows that fail validation are reported in \`rejected\` and the rest are
520
+ still added, so a single bad number does not lose the batch. If the
521
+ campaign has \`call_conditions\`, rows that do not match are added with
522
+ status \`Skipped\`.
523
+
524
+ (Tags: Bulk calls)`,
525
+ inputSchema: {"type":"object","properties":{"campaign_id":{"type":"number","description":"Id of the bulk call campaign."},"requestBody":{"type":"object","required":["contacts"],"properties":{"contacts":{"type":"array","maxItems":1000,"description":"Each row needs `to_number`. Note this differs from the\n`contact_list` on Create bulk call, which uses\n`phone_number` and takes loose keys: here the variables go\nin an explicit `custom_variables` object.\n","items":{"type":"object","required":["to_number"],"properties":{"to_number":{"type":"string","description":"Number to call, in international format."},"custom_variables":{"type":"object","description":"Passed to the agent as context for this call, so it\ncan use them in the conversation.\n","additionalProperties":true},"metadata":{"type":"object","description":"Stored with the contact and returned on its row in\nBulk call results. Not shown to the agent.\n","additionalProperties":true}}}}},"description":"The JSON request body."}},"required":["campaign_id","requestBody"]},
526
+ method: "post",
527
+ pathTemplate: "/calls/bulk_call/{campaign_id}/add_contacts",
528
+ executionParameters: [{"name":"campaign_id","in":"path"}],
529
+ requestBodyContentType: "application/json",
530
+ securityRequirements: [{"BearerAuth":[]}],
531
+ tags: ["Bulk calls"],
532
+ deprecated: false
533
+ }],
534
+ ["startBulkCall", {
535
+ name: "startBulkCall",
536
+ description: `Start a campaign that was created with \`save_as_draft: true\`.
537
+
538
+ Drafts let you build a campaign over several requests: create it, add
539
+ contacts in batches, set the number pool, set concurrency, then start
540
+ when everything is in place. A campaign that is already running,
541
+ scheduled, or finished cannot be started.
542
+
543
+ (Tags: Bulk calls)`,
544
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."}},"required":["bulk_call_id"]},
545
+ method: "post",
546
+ pathTemplate: "/calls/bulk_call/{bulk_call_id}/start",
547
+ executionParameters: [{"name":"bulk_call_id","in":"path"}],
548
+ requestBodyContentType: undefined,
549
+ securityRequirements: [{"BearerAuth":[]}],
550
+ tags: ["Bulk calls"],
551
+ deprecated: false
552
+ }],
553
+ ["setBulkCallConcurrency", {
554
+ name: "setBulkCallConcurrency",
555
+ description: `Change how many calls the campaign places at once, including while it is
556
+ running. Raise it to finish sooner, lower it if your team cannot keep up
557
+ with transfers or your numbers are being answered less.
558
+
559
+ The ceiling is your account's concurrency limit.
560
+
561
+ (Tags: Bulk calls)`,
562
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."},"requestBody":{"type":"object","required":["concurrent_call_limit"],"properties":{"concurrent_call_limit":{"type":"number","minimum":1,"description":"Calls to place at once."}},"description":"The JSON request body."}},"required":["bulk_call_id","requestBody"]},
563
+ method: "put",
564
+ pathTemplate: "/calls/bulk_call/{bulk_call_id}/concurrency",
565
+ executionParameters: [{"name":"bulk_call_id","in":"path"}],
566
+ requestBodyContentType: "application/json",
567
+ securityRequirements: [{"BearerAuth":[]}],
568
+ tags: ["Bulk calls"],
569
+ deprecated: false
570
+ }],
571
+ ["retryBulkCall", {
572
+ name: "retryBulkCall",
573
+ description: `Re-queue contacts that did not connect, without creating a new campaign.
574
+
575
+ Use it after a campaign finishes with more no-answers than you expected,
576
+ or when the reason was on your side (a bad window, a number that was
577
+ having a bad day). Retried contacts keep their original variables.
578
+
579
+ (Tags: Bulk calls)`,
580
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."},"requestBody":{"type":"object","properties":{"retry_strategy":{"type":"string","default":"all","description":"Which contacts to re-queue. `all` takes everything that did\nnot connect.\n"},"max_retries":{"type":"number","description":"Skip contacts already retried this many times."},"failure_reasons":{"type":"array","description":"Re-queue only contacts that failed for these reasons, for\nexample `no-answer` and `busy`.\n","items":{"type":"string"}}},"description":"The JSON request body."}},"required":["bulk_call_id"]},
581
+ method: "post",
582
+ pathTemplate: "/calls/bulk_call/{bulk_call_id}/manual_retry",
583
+ executionParameters: [{"name":"bulk_call_id","in":"path"}],
584
+ requestBodyContentType: "application/json",
585
+ securityRequirements: [{"BearerAuth":[]}],
586
+ tags: ["Bulk calls"],
587
+ deprecated: false
588
+ }],
589
+ ["setBulkCallDailyTimeControl", {
590
+ name: "setBulkCallDailyTimeControl",
591
+ description: `Restrict a campaign to a daily calling window, in the campaign's
592
+ timezone. Outside the window the campaign holds rather than finishing,
593
+ and resumes the next day.
594
+
595
+ (Tags: Bulk calls)`,
596
+ inputSchema: {"type":"object","properties":{"bulk_call_id":{"type":"number","description":"Id of the bulk call campaign."},"requestBody":{"type":"object","required":["enable_daily_hard_stop","enable_daily_auto_start"],"properties":{"enable_daily_hard_stop":{"type":"boolean","description":"Stop dialing at `daily_stop_time` each day."},"daily_stop_time":{"type":"number","description":"Hour of day to stop, 0 to 23. Fractions are allowed, so\n`17.5` is 17:30. Required when the hard stop is on.\n"},"daily_stop_timezone":{"type":"string","description":"Timezone for the stop time."},"enable_daily_auto_start":{"type":"boolean","description":"Resume dialing at `daily_start_time` each day."},"daily_start_time":{"type":"number","description":"Hour of day to resume, 0 to 23. Required when auto start\nis on.\n"},"daily_start_timezone":{"type":"string","description":"Timezone for the start time."}},"description":"The JSON request body."}},"required":["bulk_call_id","requestBody"]},
597
+ method: "put",
598
+ pathTemplate: "/calls/bulk_call/{bulk_call_id}/daily-time-control",
599
+ executionParameters: [{"name":"bulk_call_id","in":"path"}],
600
+ requestBodyContentType: "application/json",
601
+ securityRequirements: [{"BearerAuth":[]}],
602
+ tags: ["Bulk calls"],
603
+ deprecated: false
604
+ }],
407
605
  ["getBulkCallLiveStatus", {
408
606
  name: "getBulkCallLiveStatus",
409
607
  description: `Real-time status of a running bulk-call campaign.
package/src/procedures.ts CHANGED
@@ -266,6 +266,76 @@ specific old -> new changes. Pick the comparison with \`against\`:
266
266
  freely. Restore and delete mutate the live agent - confirm intent first.
267
267
  `;
268
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
+
269
339
  const RESOURCES: ResourceDef[] = [
270
340
  {
271
341
  uri: "omnidim://guide/routing",
@@ -295,6 +365,13 @@ const RESOURCES: ResourceDef[] = [
295
365
  mimeType: "text/markdown",
296
366
  text: AGENT_CONFIG_GUIDE,
297
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
+ },
298
375
  {
299
376
  uri: "omnidim://guide/agent-versioning",
300
377
  name: "Agent version history",
@@ -391,6 +468,60 @@ Throughout: phone numbers are E.164 with a leading \`+\`. See the \`omnidim://gu
391
468
  See the \`omnidim://guide/routing\` resource for the full gotcha list.`;
392
469
  },
393
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
+ },
394
525
  {
395
526
  name: "restore_agent_version",
396
527
  description: "Safely roll an agent back to an earlier saved version: find the right snapshot, preview exactly what restoring changes, then restore.",
@@ -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",
@@ -59,12 +68,14 @@ const DESTRUCTIVE_TOOLS = new Set([
59
68
  "deleteAgent", "deleteAgentVersion", "restoreAgentVersion",
60
69
  "deleteKnowledgeBaseFile", "detachKnowledgeBaseFiles", "detachPhoneNumber",
61
70
  "cancelBulkCall", "dispatchCall", "createBulkCall", "addBulkCallContact",
71
+ "addBulkCallContacts", "startBulkCall", "retryBulkCall",
62
72
  "purchasePhoneNumber", "releasePhoneNumber",
63
73
  ]);
64
74
 
65
75
  // Tools that reach the external phone network (a carrier, not just our API).
66
76
  const OPEN_WORLD_TOOLS = new Set([
67
77
  "dispatchCall", "createBulkCall", "addBulkCallContact",
78
+ "addBulkCallContacts", "startBulkCall", "retryBulkCall",
68
79
  "purchasePhoneNumber", "releasePhoneNumber",
69
80
  ]);
70
81