@abhinavyadav/bolna-mcp 1.0.3 → 1.0.5
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/dist/client.js +11 -1
- package/dist/tools/agents.js +221 -39
- package/dist/tools/batches.js +61 -36
- package/dist/tools/calls.js +24 -18
- package/dist/tools/dispositions.js +98 -77
- package/dist/tools/executions.js +19 -10
- package/dist/tools/inbound.js +11 -5
- package/dist/tools/knowledgebases.js +27 -15
- package/dist/tools/phone_numbers.js +23 -11
- package/dist/tools/providers.js +15 -6
- package/dist/tools/sip_trunks.js +75 -51
- package/dist/tools/sub_accounts.js +37 -19
- package/dist/tools/user.js +12 -6
- package/dist/tools/violations.js +15 -9
- package/dist/tools/voice.js +6 -3
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -45,7 +45,17 @@ function handleAxiosError(error, context) {
|
|
|
45
45
|
const axiosError = error;
|
|
46
46
|
const status = axiosError.response?.status ?? "unknown";
|
|
47
47
|
const data = axiosError.response?.data;
|
|
48
|
-
|
|
48
|
+
let message = "Unknown error";
|
|
49
|
+
if (data) {
|
|
50
|
+
const rawMessage = data.message !== undefined ? data.message : data.detail;
|
|
51
|
+
if (rawMessage !== undefined) {
|
|
52
|
+
message = typeof rawMessage === "object" ? JSON.stringify(rawMessage) : String(rawMessage);
|
|
53
|
+
} else {
|
|
54
|
+
message = axiosError.message || "Unknown error";
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
message = axiosError.message || "Unknown error";
|
|
58
|
+
}
|
|
49
59
|
throw new _types.McpError(_types.ErrorCode.InternalError, `${context} failed (HTTP ${status}): ${message}`);
|
|
50
60
|
}
|
|
51
61
|
throw new _types.McpError(_types.ErrorCode.InternalError, `${context} failed: ${String(error)}`);
|
package/dist/tools/agents.js
CHANGED
|
@@ -11,19 +11,99 @@ Object.defineProperty(exports, "registerAgentTools", {
|
|
|
11
11
|
const _zod = require("zod");
|
|
12
12
|
const _client = require("../client.js");
|
|
13
13
|
function registerAgentTools(server) {
|
|
14
|
-
server.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
server.registerTool("bolna_create_agent", {
|
|
15
|
+
description: "Create a new Bolna voice AI agent with full configuration and system prompt",
|
|
16
|
+
inputSchema: {
|
|
17
|
+
agent_name: _zod.z.string().describe("Unique name for the agent"),
|
|
18
|
+
agent_welcome_message: _zod.z.string().optional().describe("First message the agent speaks when a call connects"),
|
|
19
|
+
agent_type: _zod.z.string().optional().default("other").describe('Agent type, e.g. "other"'),
|
|
20
|
+
webhook_url: _zod.z.string().url().nullable().optional().describe("Webhook URL to receive call events"),
|
|
21
|
+
hangup_after_silence: _zod.z.number().optional().default(10).describe("Seconds of silence before hanging up"),
|
|
22
|
+
incremental_delay: _zod.z.number().optional().default(400).describe("Delay in ms between incremental responses"),
|
|
23
|
+
number_of_words_for_interruption: _zod.z.number().optional().default(2).describe("Number of words the caller must speak to interrupt the agent"),
|
|
24
|
+
call_terminate: _zod.z.number().optional().describe("Maximum call duration in seconds"),
|
|
25
|
+
ambient_noise_track: _zod.z.string().optional().describe('Ambient noise track, e.g. "coffee-shop"'),
|
|
26
|
+
system_prompt: _zod.z.string().describe("LLM system prompt that governs agent behaviour"),
|
|
27
|
+
// Voice configuration
|
|
28
|
+
voice_id: _zod.z.string().optional().describe('Voice ID from bolna_list_voices, e.g. "vYENaCJHl4vFKNDYPr8y" (Riya Rao Indian Female)'),
|
|
29
|
+
voice_name: _zod.z.string().optional().describe('Voice name, e.g. "Riya Rao - Professional Voice"'),
|
|
30
|
+
voice_provider: _zod.z.enum([
|
|
31
|
+
"elevenlabs",
|
|
32
|
+
"polly",
|
|
33
|
+
"azuretts",
|
|
34
|
+
"sarvam",
|
|
35
|
+
"cartesia",
|
|
36
|
+
"rime",
|
|
37
|
+
"styletts"
|
|
38
|
+
]).optional().default("elevenlabs").describe("TTS provider for the voice"),
|
|
39
|
+
voice_model: _zod.z.string().optional().default("eleven_turbo_v2_5").describe('TTS model, e.g. "eleven_turbo_v2_5", "eleven_turbo_v2", "bulbul:v3"'),
|
|
40
|
+
// LLM configuration
|
|
41
|
+
llm_model: _zod.z.string().optional().default("gpt-4o-mini").describe('LLM model, e.g. "gpt-4o-mini", "gpt-4o", "claude-3-5-haiku"'),
|
|
42
|
+
// Transcriber configuration
|
|
43
|
+
language: _zod.z.string().optional().default("hi").describe('Transcription language code, e.g. "en", "hi", "ta", "te"'),
|
|
44
|
+
telephony_provider: _zod.z.string().optional().default("plivo").describe('Telephony provider, e.g. "plivo" (default), "exotel"'),
|
|
45
|
+
gender: _zod.z.enum([
|
|
46
|
+
"male",
|
|
47
|
+
"female"
|
|
48
|
+
]).optional().describe('Gender of the agent: "female" or "male". If not set, it is auto-detected.')
|
|
49
|
+
}
|
|
25
50
|
}, async (args)=>{
|
|
26
51
|
try {
|
|
52
|
+
const telephonyProvider = args.telephony_provider ?? "plivo";
|
|
53
|
+
const textToAnalyze = (args.agent_name + " " + (args.agent_welcome_message ?? "") + " " + args.system_prompt).toLowerCase();
|
|
54
|
+
const detectedGender = args.gender ?? (textToAnalyze.match(/(बोल रहा हूँ|रहा हूँ|shreyas|rahul|rohan|amit|gregory|kevin|male|narrator)/) ? "male" : "female");
|
|
55
|
+
const defaultVoiceProvider = args.voice_provider ?? "elevenlabs";
|
|
56
|
+
const defaultVoiceModel = args.voice_model ?? "eleven_turbo_v2_5";
|
|
57
|
+
const defaultVoiceName = args.voice_name ?? (detectedGender === "male" ? "Amit Gupta - Energetic Customer Care Voice" : "Ziina - Confident & Clear");
|
|
58
|
+
const defaultVoiceId = args.voice_id ?? (detectedGender === "male" ? "WuePGPKIAIKI8COZpzce" : "FaqthkZu1EWxXxUFbAfb");
|
|
59
|
+
const toolsConfig = {
|
|
60
|
+
llm_agent: {
|
|
61
|
+
agent_type: "simple_llm_agent",
|
|
62
|
+
agent_flow_type: "streaming",
|
|
63
|
+
llm_config: {
|
|
64
|
+
provider: "openai",
|
|
65
|
+
model: args.llm_model ?? "gpt-4o-mini"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
synthesizer: {
|
|
69
|
+
stream: true,
|
|
70
|
+
caching: true,
|
|
71
|
+
provider: defaultVoiceProvider,
|
|
72
|
+
provider_config: {
|
|
73
|
+
voice: defaultVoiceName,
|
|
74
|
+
voice_id: defaultVoiceId,
|
|
75
|
+
model: defaultVoiceModel
|
|
76
|
+
},
|
|
77
|
+
buffer_size: 150,
|
|
78
|
+
audio_format: "wav"
|
|
79
|
+
},
|
|
80
|
+
transcriber: {
|
|
81
|
+
provider: "deepgram",
|
|
82
|
+
model: "nova-3",
|
|
83
|
+
language: args.language ?? "hi",
|
|
84
|
+
encoding: "linear16",
|
|
85
|
+
sampling_rate: 16000,
|
|
86
|
+
stream: true,
|
|
87
|
+
endpointing: 100
|
|
88
|
+
},
|
|
89
|
+
input: {
|
|
90
|
+
provider: telephonyProvider,
|
|
91
|
+
format: "wav"
|
|
92
|
+
},
|
|
93
|
+
output: {
|
|
94
|
+
provider: telephonyProvider,
|
|
95
|
+
format: "wav"
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
if (telephonyProvider === "exotel") {
|
|
99
|
+
toolsConfig.synthesizer.buffer_size = 260;
|
|
100
|
+
toolsConfig.synthesizer.audio_format = "wav";
|
|
101
|
+
toolsConfig.transcriber.encoding = "linear16";
|
|
102
|
+
toolsConfig.transcriber.sampling_rate = 16000;
|
|
103
|
+
toolsConfig.transcriber.stream = true;
|
|
104
|
+
toolsConfig.input.format = "wav";
|
|
105
|
+
toolsConfig.output.format = "wav";
|
|
106
|
+
}
|
|
27
107
|
const body = {
|
|
28
108
|
agent_config: {
|
|
29
109
|
agent_name: args.agent_name,
|
|
@@ -37,6 +117,17 @@ function registerAgentTools(server) {
|
|
|
37
117
|
tasks: [
|
|
38
118
|
{
|
|
39
119
|
task_type: "conversation",
|
|
120
|
+
tools_config: toolsConfig,
|
|
121
|
+
toolchain: {
|
|
122
|
+
execution: "parallel",
|
|
123
|
+
pipelines: [
|
|
124
|
+
[
|
|
125
|
+
"transcriber",
|
|
126
|
+
"llm",
|
|
127
|
+
"synthesizer"
|
|
128
|
+
]
|
|
129
|
+
]
|
|
130
|
+
},
|
|
40
131
|
task_config: {
|
|
41
132
|
hangup_after_silence: args.hangup_after_silence ?? 10,
|
|
42
133
|
incremental_delay: args.incremental_delay ?? 400,
|
|
@@ -70,8 +161,11 @@ function registerAgentTools(server) {
|
|
|
70
161
|
(0, _client.handleAxiosError)(error, "bolna_create_agent");
|
|
71
162
|
}
|
|
72
163
|
});
|
|
73
|
-
server.
|
|
74
|
-
|
|
164
|
+
server.registerTool("bolna_get_agent", {
|
|
165
|
+
description: "Retrieve the full configuration of a specific Bolna agent by its ID",
|
|
166
|
+
inputSchema: {
|
|
167
|
+
agent_id: _zod.z.string().describe("The unique ID of the agent to retrieve")
|
|
168
|
+
}
|
|
75
169
|
}, async (args)=>{
|
|
76
170
|
try {
|
|
77
171
|
const response = await _client.bolnaClient.get(`/v2/agent/${args.agent_id}`);
|
|
@@ -87,9 +181,12 @@ function registerAgentTools(server) {
|
|
|
87
181
|
(0, _client.handleAxiosError)(error, "bolna_get_agent");
|
|
88
182
|
}
|
|
89
183
|
});
|
|
90
|
-
server.
|
|
91
|
-
|
|
92
|
-
|
|
184
|
+
server.registerTool("bolna_list_agents", {
|
|
185
|
+
description: "List all Bolna agents in your account with optional pagination",
|
|
186
|
+
inputSchema: {
|
|
187
|
+
page_number: _zod.z.number().int().positive().optional().default(1).describe("Page number (1-indexed)"),
|
|
188
|
+
page_size: _zod.z.number().int().positive().optional().default(10).describe("Number of agents per page")
|
|
189
|
+
}
|
|
93
190
|
}, async (args)=>{
|
|
94
191
|
try {
|
|
95
192
|
const response = await _client.bolnaClient.get("/v2/agent/all", {
|
|
@@ -110,18 +207,26 @@ function registerAgentTools(server) {
|
|
|
110
207
|
(0, _client.handleAxiosError)(error, "bolna_list_agents");
|
|
111
208
|
}
|
|
112
209
|
});
|
|
113
|
-
server.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
210
|
+
server.registerTool("bolna_update_agent", {
|
|
211
|
+
description: "Update an existing Bolna agent's configuration and/or system prompt",
|
|
212
|
+
inputSchema: {
|
|
213
|
+
agent_id: _zod.z.string().describe("The unique ID of the agent to update"),
|
|
214
|
+
agent_name: _zod.z.string().optional().describe("New name for the agent"),
|
|
215
|
+
agent_welcome_message: _zod.z.string().optional().describe("New welcome message"),
|
|
216
|
+
agent_type: _zod.z.string().optional().describe("Agent type"),
|
|
217
|
+
webhook_url: _zod.z.string().url().nullable().optional().describe("New webhook URL"),
|
|
218
|
+
hangup_after_silence: _zod.z.number().optional().describe("Seconds of silence before hanging up"),
|
|
219
|
+
incremental_delay: _zod.z.number().optional().describe("Delay in ms between incremental responses"),
|
|
220
|
+
number_of_words_for_interruption: _zod.z.number().optional().describe("Words to interrupt"),
|
|
221
|
+
call_terminate: _zod.z.number().optional().describe("Max call duration in seconds"),
|
|
222
|
+
ambient_noise_track: _zod.z.string().optional().describe("Ambient noise track"),
|
|
223
|
+
system_prompt: _zod.z.string().optional().describe("New LLM system prompt"),
|
|
224
|
+
telephony_provider: _zod.z.string().optional().describe('Telephony provider, e.g. "plivo" (default), "exotel"'),
|
|
225
|
+
gender: _zod.z.enum([
|
|
226
|
+
"male",
|
|
227
|
+
"female"
|
|
228
|
+
]).optional().describe('Gender of the agent: "female" or "male". If not set, it is auto-detected.')
|
|
229
|
+
}
|
|
125
230
|
}, async (args)=>{
|
|
126
231
|
try {
|
|
127
232
|
const { agent_id, system_prompt, ...rest } = args;
|
|
@@ -136,10 +241,78 @@ function registerAgentTools(server) {
|
|
|
136
241
|
if (rest.agent_welcome_message !== undefined) agentConfig.agent_welcome_message = rest.agent_welcome_message;
|
|
137
242
|
if (rest.agent_type !== undefined) agentConfig.agent_type = rest.agent_type;
|
|
138
243
|
if (rest.webhook_url !== undefined) agentConfig.webhook_url = rest.webhook_url;
|
|
139
|
-
if (Object.keys(taskConfig).length > 0) {
|
|
244
|
+
if (Object.keys(taskConfig).length > 0 || rest.telephony_provider !== undefined || rest.gender !== undefined) {
|
|
245
|
+
const telephonyProvider = rest.telephony_provider ?? "plivo";
|
|
246
|
+
const textToAnalyze = ((rest.agent_name ?? "") + " " + (rest.agent_welcome_message ?? "") + " " + (system_prompt ?? "")).toLowerCase();
|
|
247
|
+
const detectedGender = rest.gender ?? (textToAnalyze.match(/(बोल रहा हूँ|रहा हूँ|shreyas|rahul|rohan|amit|gregory|kevin|male|narrator)/) ? "male" : "female");
|
|
248
|
+
const defaultVoiceProvider = rest.voice_provider ?? "elevenlabs";
|
|
249
|
+
const defaultVoiceModel = rest.voice_model ?? "eleven_turbo_v2_5";
|
|
250
|
+
const defaultVoiceName = rest.voice_name ?? (detectedGender === "male" ? "Amit Gupta - Energetic Customer Care Voice" : "Ziina - Confident & Clear");
|
|
251
|
+
const defaultVoiceId = rest.voice_id ?? (detectedGender === "male" ? "WuePGPKIAIKI8COZpzce" : "FaqthkZu1EWxXxUFbAfb");
|
|
252
|
+
const toolsConfig = {
|
|
253
|
+
llm_agent: {
|
|
254
|
+
agent_type: "simple_llm_agent",
|
|
255
|
+
agent_flow_type: "streaming",
|
|
256
|
+
llm_config: {
|
|
257
|
+
provider: "openai",
|
|
258
|
+
model: "gpt-4o-mini"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
synthesizer: {
|
|
262
|
+
stream: true,
|
|
263
|
+
caching: true,
|
|
264
|
+
provider: defaultVoiceProvider,
|
|
265
|
+
provider_config: {
|
|
266
|
+
voice: defaultVoiceName,
|
|
267
|
+
...defaultVoiceId && {
|
|
268
|
+
voice_id: defaultVoiceId
|
|
269
|
+
},
|
|
270
|
+
model: defaultVoiceModel
|
|
271
|
+
},
|
|
272
|
+
buffer_size: 150,
|
|
273
|
+
audio_format: "wav"
|
|
274
|
+
},
|
|
275
|
+
transcriber: {
|
|
276
|
+
provider: "deepgram",
|
|
277
|
+
model: "nova-3",
|
|
278
|
+
language: "hi",
|
|
279
|
+
encoding: "linear16",
|
|
280
|
+
sampling_rate: 16000,
|
|
281
|
+
stream: true,
|
|
282
|
+
endpointing: 100
|
|
283
|
+
},
|
|
284
|
+
input: {
|
|
285
|
+
provider: telephonyProvider,
|
|
286
|
+
format: "wav"
|
|
287
|
+
},
|
|
288
|
+
output: {
|
|
289
|
+
provider: telephonyProvider,
|
|
290
|
+
format: "wav"
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
if (telephonyProvider === "exotel") {
|
|
294
|
+
toolsConfig.synthesizer.buffer_size = 260;
|
|
295
|
+
toolsConfig.synthesizer.audio_format = "wav";
|
|
296
|
+
toolsConfig.transcriber.encoding = "linear16";
|
|
297
|
+
toolsConfig.transcriber.sampling_rate = 16000;
|
|
298
|
+
toolsConfig.transcriber.stream = true;
|
|
299
|
+
toolsConfig.input.format = "wav";
|
|
300
|
+
toolsConfig.output.format = "wav";
|
|
301
|
+
}
|
|
140
302
|
agentConfig.tasks = [
|
|
141
303
|
{
|
|
142
304
|
task_type: "conversation",
|
|
305
|
+
tools_config: toolsConfig,
|
|
306
|
+
toolchain: {
|
|
307
|
+
execution: "parallel",
|
|
308
|
+
pipelines: [
|
|
309
|
+
[
|
|
310
|
+
"transcriber",
|
|
311
|
+
"llm",
|
|
312
|
+
"synthesizer"
|
|
313
|
+
]
|
|
314
|
+
]
|
|
315
|
+
},
|
|
143
316
|
task_config: taskConfig
|
|
144
317
|
}
|
|
145
318
|
];
|
|
@@ -166,8 +339,11 @@ function registerAgentTools(server) {
|
|
|
166
339
|
(0, _client.handleAxiosError)(error, "bolna_update_agent");
|
|
167
340
|
}
|
|
168
341
|
});
|
|
169
|
-
server.
|
|
170
|
-
|
|
342
|
+
server.registerTool("bolna_delete_agent", {
|
|
343
|
+
description: "Permanently delete a Bolna agent by its ID",
|
|
344
|
+
inputSchema: {
|
|
345
|
+
agent_id: _zod.z.string().describe("The unique ID of the agent to delete")
|
|
346
|
+
}
|
|
171
347
|
}, async (args)=>{
|
|
172
348
|
try {
|
|
173
349
|
const response = await _client.bolnaClient.delete(`/v2/agent/${args.agent_id}`);
|
|
@@ -183,12 +359,15 @@ function registerAgentTools(server) {
|
|
|
183
359
|
(0, _client.handleAxiosError)(error, "bolna_delete_agent");
|
|
184
360
|
}
|
|
185
361
|
});
|
|
186
|
-
server.
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
362
|
+
server.registerTool("bolna_patch_agent", {
|
|
363
|
+
description: "Partially update specific fields of a Bolna agent (name, welcome message, webhook URL, etc.)",
|
|
364
|
+
inputSchema: {
|
|
365
|
+
agent_id: _zod.z.string().describe("The unique ID of the agent to patch"),
|
|
366
|
+
agent_name: _zod.z.string().optional().describe("New agent name"),
|
|
367
|
+
agent_welcome_message: _zod.z.string().optional().describe("New welcome message"),
|
|
368
|
+
webhook_url: _zod.z.string().url().nullable().optional().describe("New webhook URL or null to remove"),
|
|
369
|
+
system_prompt: _zod.z.string().optional().describe("New system prompt")
|
|
370
|
+
}
|
|
192
371
|
}, async (args)=>{
|
|
193
372
|
try {
|
|
194
373
|
const { agent_id, ...fields } = args;
|
|
@@ -205,8 +384,11 @@ function registerAgentTools(server) {
|
|
|
205
384
|
(0, _client.handleAxiosError)(error, "bolna_patch_agent");
|
|
206
385
|
}
|
|
207
386
|
});
|
|
208
|
-
server.
|
|
209
|
-
|
|
387
|
+
server.registerTool("bolna_stop_agent_queued_calls", {
|
|
388
|
+
description: "Stop all queued (pending) calls for a specific Bolna agent, preventing them from executing",
|
|
389
|
+
inputSchema: {
|
|
390
|
+
agent_id: _zod.z.string().describe("The unique ID of the agent whose queued calls to cancel")
|
|
391
|
+
}
|
|
210
392
|
}, async (args)=>{
|
|
211
393
|
try {
|
|
212
394
|
const response = await _client.bolnaClient.post(`/v2/agent/${args.agent_id}/stop`);
|
package/dist/tools/batches.js
CHANGED
|
@@ -17,23 +17,26 @@ function _interop_require_default(obj) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
function registerBatchTools(server) {
|
|
20
|
-
server.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
server.registerTool("bolna_create_batch", {
|
|
21
|
+
description: "Create a batch call campaign by uploading a CSV of phone numbers for a Bolna agent",
|
|
22
|
+
inputSchema: {
|
|
23
|
+
agent_id: _zod.z.string().describe("UUID of the Bolna agent to use for batch calls"),
|
|
24
|
+
csv_content: _zod.z.string().describe('Raw CSV string with a "phone_number" column (plus optional variable columns). Example: "phone_number,name\\n+919876543210,Rahul"'),
|
|
25
|
+
csv_filename: _zod.z.string().optional().default("contacts.csv").describe("Filename to use for the uploaded CSV"),
|
|
26
|
+
from_phone_numbers: _zod.z.array(_zod.z.string()).optional().describe("List of caller IDs in E.164 format to rotate through"),
|
|
27
|
+
webhook_url: _zod.z.string().url().optional().describe("Webhook URL for batch status updates"),
|
|
28
|
+
retry_config: _zod.z.object({
|
|
29
|
+
enabled: _zod.z.boolean().optional(),
|
|
30
|
+
max_retries: _zod.z.number().int().min(1).max(3).optional(),
|
|
31
|
+
retry_on_statuses: _zod.z.array(_zod.z.enum([
|
|
32
|
+
"no-answer",
|
|
33
|
+
"busy",
|
|
34
|
+
"failed",
|
|
35
|
+
"error"
|
|
36
|
+
])).optional(),
|
|
37
|
+
retry_intervals_minutes: _zod.z.array(_zod.z.number()).optional()
|
|
38
|
+
}).optional().describe("Retry configuration for failed calls in the batch")
|
|
39
|
+
}
|
|
37
40
|
}, async (args)=>{
|
|
38
41
|
try {
|
|
39
42
|
const form = new _formdata.default();
|
|
@@ -70,13 +73,20 @@ function registerBatchTools(server) {
|
|
|
70
73
|
(0, _client.handleAxiosError)(error, "bolna_create_batch");
|
|
71
74
|
}
|
|
72
75
|
});
|
|
73
|
-
server.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
server.registerTool("bolna_schedule_batch", {
|
|
77
|
+
description: "Schedule a previously created batch to run at a specific date and time",
|
|
78
|
+
inputSchema: {
|
|
79
|
+
batch_id: _zod.z.string().describe("The batch ID to schedule"),
|
|
80
|
+
run_at: _zod.z.string().describe('ISO 8601 datetime when the batch should start, e.g. "2024-06-04T22:40:00.000Z"')
|
|
81
|
+
}
|
|
76
82
|
}, async (args)=>{
|
|
77
83
|
try {
|
|
78
|
-
const
|
|
79
|
-
|
|
84
|
+
const form = new _formdata.default();
|
|
85
|
+
form.append("scheduled_at", args.run_at);
|
|
86
|
+
const response = await _client.bolnaClient.post(`/batches/${args.batch_id}/schedule`, form, {
|
|
87
|
+
headers: {
|
|
88
|
+
...form.getHeaders()
|
|
89
|
+
}
|
|
80
90
|
});
|
|
81
91
|
return {
|
|
82
92
|
content: [
|
|
@@ -90,8 +100,11 @@ function registerBatchTools(server) {
|
|
|
90
100
|
(0, _client.handleAxiosError)(error, "bolna_schedule_batch");
|
|
91
101
|
}
|
|
92
102
|
});
|
|
93
|
-
server.
|
|
94
|
-
|
|
103
|
+
server.registerTool("bolna_stop_batch", {
|
|
104
|
+
description: "Stop a running batch campaign and cancel all pending calls in it",
|
|
105
|
+
inputSchema: {
|
|
106
|
+
batch_id: _zod.z.string().describe("The batch ID to stop")
|
|
107
|
+
}
|
|
95
108
|
}, async (args)=>{
|
|
96
109
|
try {
|
|
97
110
|
const response = await _client.bolnaClient.post(`/batches/${args.batch_id}/stop`);
|
|
@@ -107,8 +120,11 @@ function registerBatchTools(server) {
|
|
|
107
120
|
(0, _client.handleAxiosError)(error, "bolna_stop_batch");
|
|
108
121
|
}
|
|
109
122
|
});
|
|
110
|
-
server.
|
|
111
|
-
|
|
123
|
+
server.registerTool("bolna_get_batch", {
|
|
124
|
+
description: "Get detailed status and call counts for a specific batch campaign",
|
|
125
|
+
inputSchema: {
|
|
126
|
+
batch_id: _zod.z.string().describe("The batch ID to retrieve")
|
|
127
|
+
}
|
|
112
128
|
}, async (args)=>{
|
|
113
129
|
try {
|
|
114
130
|
const response = await _client.bolnaClient.get(`/batches/${args.batch_id}`);
|
|
@@ -124,10 +140,13 @@ function registerBatchTools(server) {
|
|
|
124
140
|
(0, _client.handleAxiosError)(error, "bolna_get_batch");
|
|
125
141
|
}
|
|
126
142
|
});
|
|
127
|
-
server.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
143
|
+
server.registerTool("bolna_list_batches", {
|
|
144
|
+
description: "List all batch campaigns for a given Bolna agent",
|
|
145
|
+
inputSchema: {
|
|
146
|
+
agent_id: _zod.z.string().describe("The agent ID whose batches to list"),
|
|
147
|
+
page_number: _zod.z.number().int().positive().optional().default(1).describe("Page number (1-indexed)"),
|
|
148
|
+
page_size: _zod.z.number().int().positive().optional().default(10).describe("Number of batches per page")
|
|
149
|
+
}
|
|
131
150
|
}, async (args)=>{
|
|
132
151
|
try {
|
|
133
152
|
const response = await _client.bolnaClient.get(`/agent/${args.agent_id}/batches`, {
|
|
@@ -148,10 +167,13 @@ function registerBatchTools(server) {
|
|
|
148
167
|
(0, _client.handleAxiosError)(error, "bolna_list_batches");
|
|
149
168
|
}
|
|
150
169
|
});
|
|
151
|
-
server.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
170
|
+
server.registerTool("bolna_get_batch_executions", {
|
|
171
|
+
description: "List all individual call executions within a batch campaign",
|
|
172
|
+
inputSchema: {
|
|
173
|
+
batch_id: _zod.z.string().describe("The batch ID to retrieve executions for"),
|
|
174
|
+
page_number: _zod.z.number().int().positive().optional().default(1).describe("Page number (1-indexed)"),
|
|
175
|
+
page_size: _zod.z.number().int().positive().optional().default(10).describe("Number of executions per page")
|
|
176
|
+
}
|
|
155
177
|
}, async (args)=>{
|
|
156
178
|
try {
|
|
157
179
|
const response = await _client.bolnaClient.get(`/batches/${args.batch_id}/executions`, {
|
|
@@ -172,8 +194,11 @@ function registerBatchTools(server) {
|
|
|
172
194
|
(0, _client.handleAxiosError)(error, "bolna_get_batch_executions");
|
|
173
195
|
}
|
|
174
196
|
});
|
|
175
|
-
server.
|
|
176
|
-
|
|
197
|
+
server.registerTool("bolna_delete_batch", {
|
|
198
|
+
description: "Permanently delete a batch campaign by its ID",
|
|
199
|
+
inputSchema: {
|
|
200
|
+
batch_id: _zod.z.string().describe("The batch ID to delete")
|
|
201
|
+
}
|
|
177
202
|
}, async (args)=>{
|
|
178
203
|
try {
|
|
179
204
|
const response = await _client.bolnaClient.delete(`/batches/${args.batch_id}`);
|
package/dist/tools/calls.js
CHANGED
|
@@ -11,22 +11,25 @@ Object.defineProperty(exports, "registerCallTools", {
|
|
|
11
11
|
const _zod = require("zod");
|
|
12
12
|
const _client = require("../client.js");
|
|
13
13
|
function registerCallTools(server) {
|
|
14
|
-
server.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
server.registerTool("bolna_make_call", {
|
|
15
|
+
description: "Initiate an outbound voice call using a Bolna agent to a specified phone number",
|
|
16
|
+
inputSchema: {
|
|
17
|
+
agent_id: _zod.z.string().uuid().describe("UUID of the Bolna agent to use for the call"),
|
|
18
|
+
recipient_phone_number: _zod.z.string().describe('Recipient phone number in E.164 format, e.g. "+919876543210"'),
|
|
19
|
+
from_phone_number: _zod.z.string().optional().describe("Caller ID in E.164 format (optional)"),
|
|
20
|
+
scheduled_at: _zod.z.string().optional().describe('ISO 8601 datetime to schedule the call, e.g. "2025-08-21T10:35:00"'),
|
|
21
|
+
user_data: _zod.z.record(_zod.z.unknown()).optional().describe("Key-value pairs for dynamic prompt variable substitution in the agent"),
|
|
22
|
+
bypass_call_guardrails: _zod.z.boolean().optional().default(false).describe("Skip call guardrails if true"),
|
|
23
|
+
retry_enabled: _zod.z.boolean().optional().describe("Enable automatic call retries"),
|
|
24
|
+
retry_max_retries: _zod.z.number().int().min(1).max(3).optional().describe("Number of retry attempts (1–3)"),
|
|
25
|
+
retry_on_statuses: _zod.z.array(_zod.z.enum([
|
|
26
|
+
"no-answer",
|
|
27
|
+
"busy",
|
|
28
|
+
"failed",
|
|
29
|
+
"error"
|
|
30
|
+
])).optional().describe("Call statuses that should trigger a retry"),
|
|
31
|
+
retry_intervals_minutes: _zod.z.array(_zod.z.number()).optional().describe("Minutes to wait before each retry attempt, e.g. [30, 60, 120]")
|
|
32
|
+
}
|
|
30
33
|
}, async (args)=>{
|
|
31
34
|
try {
|
|
32
35
|
const body = {
|
|
@@ -67,8 +70,11 @@ function registerCallTools(server) {
|
|
|
67
70
|
(0, _client.handleAxiosError)(error, "bolna_make_call");
|
|
68
71
|
}
|
|
69
72
|
});
|
|
70
|
-
server.
|
|
71
|
-
|
|
73
|
+
server.registerTool("bolna_stop_call", {
|
|
74
|
+
description: "Immediately terminate an active call by its execution ID",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
execution_id: _zod.z.string().describe("The execution ID of the active call to stop")
|
|
77
|
+
}
|
|
72
78
|
}, async (args)=>{
|
|
73
79
|
try {
|
|
74
80
|
const response = await _client.bolnaClient.post(`/call/stop/${args.execution_id}`);
|