@abhinavyadav/bolna-mcp 1.0.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/LICENSE +21 -0
- package/README.md +293 -0
- package/dist/client.js +52 -0
- package/dist/index.js +56 -0
- package/dist/tools/agents.js +225 -0
- package/dist/tools/batches.js +192 -0
- package/dist/tools/calls.js +87 -0
- package/dist/tools/dispositions.js +234 -0
- package/dist/tools/executions.js +72 -0
- package/dist/tools/inbound.js +56 -0
- package/dist/tools/knowledgebases.js +129 -0
- package/dist/tools/phone_numbers.js +95 -0
- package/dist/tools/providers.js +67 -0
- package/dist/tools/sip_trunks.js +191 -0
- package/dist/tools/sub_accounts.js +132 -0
- package/dist/tools/user.js +55 -0
- package/dist/tools/violations.js +79 -0
- package/dist/tools/voice.js +37 -0
- package/package.json +58 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "registerKnowledgebaseTools", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return registerKnowledgebaseTools;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _zod = require("zod");
|
|
12
|
+
const _formdata = /*#__PURE__*/ _interop_require_default(require("form-data"));
|
|
13
|
+
const _client = require("../client.js");
|
|
14
|
+
function _interop_require_default(obj) {
|
|
15
|
+
return obj && obj.__esModule ? obj : {
|
|
16
|
+
default: obj
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function registerKnowledgebaseTools(server) {
|
|
20
|
+
server.tool("bolna_create_knowledgebase", "Create a knowledgebase by uploading a PDF (as base64) or ingesting a web URL", {
|
|
21
|
+
source_type: _zod.z.enum([
|
|
22
|
+
"file",
|
|
23
|
+
"url"
|
|
24
|
+
]).describe('"file" to upload a PDF, "url" to ingest a web page'),
|
|
25
|
+
// For file uploads
|
|
26
|
+
file_base64: _zod.z.string().optional().describe("Base64-encoded PDF content (required when source_type is 'file')"),
|
|
27
|
+
filename: _zod.z.string().optional().default("document.pdf").describe("Filename for the uploaded PDF (e.g. 'hospital_faqs.pdf')"),
|
|
28
|
+
// For URL ingestion
|
|
29
|
+
url: _zod.z.string().url().optional().describe("Web URL to ingest (required when source_type is 'url')")
|
|
30
|
+
}, async (args)=>{
|
|
31
|
+
try {
|
|
32
|
+
if (args.source_type === "file") {
|
|
33
|
+
if (!args.file_base64) {
|
|
34
|
+
throw new Error("file_base64 is required when source_type is 'file'");
|
|
35
|
+
}
|
|
36
|
+
const form = new _formdata.default();
|
|
37
|
+
const fileBuffer = Buffer.from(args.file_base64, "base64");
|
|
38
|
+
form.append("file", fileBuffer, {
|
|
39
|
+
filename: args.filename ?? "document.pdf",
|
|
40
|
+
contentType: "application/pdf"
|
|
41
|
+
});
|
|
42
|
+
const response = await _client.bolnaClient.post("/knowledgebase", form, {
|
|
43
|
+
headers: {
|
|
44
|
+
...form.getHeaders()
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
content: [
|
|
49
|
+
{
|
|
50
|
+
type: "text",
|
|
51
|
+
text: JSON.stringify(response.data, null, 2)
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
} else {
|
|
56
|
+
// URL ingestion
|
|
57
|
+
if (!args.url) {
|
|
58
|
+
throw new Error("url is required when source_type is 'url'");
|
|
59
|
+
}
|
|
60
|
+
const form = new _formdata.default();
|
|
61
|
+
form.append("url", args.url);
|
|
62
|
+
const response = await _client.bolnaClient.post("/knowledgebase", form, {
|
|
63
|
+
headers: {
|
|
64
|
+
...form.getHeaders()
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
content: [
|
|
69
|
+
{
|
|
70
|
+
type: "text",
|
|
71
|
+
text: JSON.stringify(response.data, null, 2)
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
} catch (error) {
|
|
77
|
+
(0, _client.handleAxiosError)(error, "bolna_create_knowledgebase");
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
server.tool("bolna_list_knowledgebases", "List all knowledgebases in your Bolna account with their status and metadata", {}, async ()=>{
|
|
81
|
+
try {
|
|
82
|
+
const response = await _client.bolnaClient.get("/knowledgebase");
|
|
83
|
+
return {
|
|
84
|
+
content: [
|
|
85
|
+
{
|
|
86
|
+
type: "text",
|
|
87
|
+
text: JSON.stringify(response.data, null, 2)
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
};
|
|
91
|
+
} catch (error) {
|
|
92
|
+
(0, _client.handleAxiosError)(error, "bolna_list_knowledgebases");
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
server.tool("bolna_get_knowledgebase", "Retrieve details of a specific knowledgebase including its ID, filename, status, and creation time", {
|
|
96
|
+
knowledgebase_id: _zod.z.string().describe("The ID of the knowledgebase to retrieve")
|
|
97
|
+
}, async (args)=>{
|
|
98
|
+
try {
|
|
99
|
+
const response = await _client.bolnaClient.get(`/knowledgebase/${args.knowledgebase_id}`);
|
|
100
|
+
return {
|
|
101
|
+
content: [
|
|
102
|
+
{
|
|
103
|
+
type: "text",
|
|
104
|
+
text: JSON.stringify(response.data, null, 2)
|
|
105
|
+
}
|
|
106
|
+
]
|
|
107
|
+
};
|
|
108
|
+
} catch (error) {
|
|
109
|
+
(0, _client.handleAxiosError)(error, "bolna_get_knowledgebase");
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
server.tool("bolna_delete_knowledgebase", "Permanently delete a knowledgebase by its ID", {
|
|
113
|
+
knowledgebase_id: _zod.z.string().describe("The ID of the knowledgebase to delete")
|
|
114
|
+
}, async (args)=>{
|
|
115
|
+
try {
|
|
116
|
+
const response = await _client.bolnaClient.delete(`/knowledgebase/${args.knowledgebase_id}`);
|
|
117
|
+
return {
|
|
118
|
+
content: [
|
|
119
|
+
{
|
|
120
|
+
type: "text",
|
|
121
|
+
text: JSON.stringify(response.data, null, 2) || `Knowledgebase ${args.knowledgebase_id} deleted successfully.`
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
};
|
|
125
|
+
} catch (error) {
|
|
126
|
+
(0, _client.handleAxiosError)(error, "bolna_delete_knowledgebase");
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "registerPhoneNumberTools", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return registerPhoneNumberTools;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _zod = require("zod");
|
|
12
|
+
const _client = require("../client.js");
|
|
13
|
+
function registerPhoneNumberTools(server) {
|
|
14
|
+
server.tool("bolna_search_phone_numbers", "Search for available phone numbers to purchase, filtered by country, area code, or pattern", {
|
|
15
|
+
country_code: _zod.z.string().describe('ISO 3166-1 alpha-2 country code, e.g. "US" for United States, "IN" for India'),
|
|
16
|
+
area_code: _zod.z.string().optional().describe("Area/region code to filter available numbers (optional)"),
|
|
17
|
+
pattern: _zod.z.string().optional().describe("Digit pattern to match in the phone number, e.g. '555' (optional)"),
|
|
18
|
+
limit: _zod.z.number().int().positive().optional().default(5).describe("Maximum number of results to return (default 5)")
|
|
19
|
+
}, async (args)=>{
|
|
20
|
+
try {
|
|
21
|
+
const params = {
|
|
22
|
+
country_code: args.country_code,
|
|
23
|
+
limit: args.limit ?? 5
|
|
24
|
+
};
|
|
25
|
+
if (args.area_code !== undefined) params.area_code = args.area_code;
|
|
26
|
+
if (args.pattern !== undefined) params.pattern = args.pattern;
|
|
27
|
+
const response = await _client.bolnaClient.get("/phone_numbers/search", {
|
|
28
|
+
params
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: "text",
|
|
34
|
+
text: JSON.stringify(response.data, null, 2)
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
} catch (error) {
|
|
39
|
+
(0, _client.handleAxiosError)(error, "bolna_search_phone_numbers");
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
server.tool("bolna_buy_phone_number", "Purchase a specific phone number for use with Bolna agents", {
|
|
43
|
+
phone_number: _zod.z.string().describe("The phone number to purchase in E.164 format"),
|
|
44
|
+
telephony_provider: _zod.z.string().describe('Telephony provider to use, e.g. "twilio", "plivo", "vonage"')
|
|
45
|
+
}, async (args)=>{
|
|
46
|
+
try {
|
|
47
|
+
const response = await _client.bolnaClient.post("/phone_numbers/buy", {
|
|
48
|
+
phone_number: args.phone_number,
|
|
49
|
+
telephony_provider: args.telephony_provider
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: "text",
|
|
55
|
+
text: JSON.stringify(response.data, null, 2)
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
} catch (error) {
|
|
60
|
+
(0, _client.handleAxiosError)(error, "bolna_buy_phone_number");
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
server.tool("bolna_list_phone_numbers", "List all phone numbers purchased and associated with your Bolna account", {}, async ()=>{
|
|
64
|
+
try {
|
|
65
|
+
const response = await _client.bolnaClient.get("/phone_numbers");
|
|
66
|
+
return {
|
|
67
|
+
content: [
|
|
68
|
+
{
|
|
69
|
+
type: "text",
|
|
70
|
+
text: JSON.stringify(response.data, null, 2)
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
} catch (error) {
|
|
75
|
+
(0, _client.handleAxiosError)(error, "bolna_list_phone_numbers");
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
server.tool("bolna_delete_phone_number", "Delete a purchased phone number to stop billing and permanently remove it from your account", {
|
|
79
|
+
phone_number: _zod.z.string().describe("The phone number to delete (as stored in Bolna, E.164 format)")
|
|
80
|
+
}, async (args)=>{
|
|
81
|
+
try {
|
|
82
|
+
const response = await _client.bolnaClient.delete(`/phone_numbers/${encodeURIComponent(args.phone_number)}`);
|
|
83
|
+
return {
|
|
84
|
+
content: [
|
|
85
|
+
{
|
|
86
|
+
type: "text",
|
|
87
|
+
text: JSON.stringify(response.data, null, 2) || `Phone number ${args.phone_number} deleted successfully.`
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
};
|
|
91
|
+
} catch (error) {
|
|
92
|
+
(0, _client.handleAxiosError)(error, "bolna_delete_phone_number");
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "registerProviderTools", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return registerProviderTools;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _zod = require("zod");
|
|
12
|
+
const _client = require("../client.js");
|
|
13
|
+
function registerProviderTools(server) {
|
|
14
|
+
server.tool("bolna_add_provider", "Securely add a new provider (e.g. LLM, TTS, STT, telephony) API key to your Bolna account", {
|
|
15
|
+
provider_name: _zod.z.string().describe('Provider key name as recognised by Bolna, e.g. "OPENAI_API_KEY", "ELEVENLABS_API_KEY", "DEEPGRAM_API_KEY"'),
|
|
16
|
+
provider_value: _zod.z.string().describe("The secret API key or credential value for the provider")
|
|
17
|
+
}, async (args)=>{
|
|
18
|
+
try {
|
|
19
|
+
const response = await _client.bolnaClient.post("/providers", {
|
|
20
|
+
provider_name: args.provider_name,
|
|
21
|
+
provider_value: args.provider_value
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
content: [
|
|
25
|
+
{
|
|
26
|
+
type: "text",
|
|
27
|
+
text: JSON.stringify(response.data, null, 2)
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
} catch (error) {
|
|
32
|
+
(0, _client.handleAxiosError)(error, "bolna_add_provider");
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
server.tool("bolna_list_providers", "List all providers (API integrations) configured in your Bolna account", {}, async ()=>{
|
|
36
|
+
try {
|
|
37
|
+
const response = await _client.bolnaClient.get("/providers");
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: "text",
|
|
42
|
+
text: JSON.stringify(response.data, null, 2)
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
} catch (error) {
|
|
47
|
+
(0, _client.handleAxiosError)(error, "bolna_list_providers");
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
server.tool("bolna_remove_provider", "Remove a previously added provider API key from your Bolna account", {
|
|
51
|
+
provider_key_name: _zod.z.string().describe('The provider key name to remove, e.g. "OPENAI_API_KEY"')
|
|
52
|
+
}, async (args)=>{
|
|
53
|
+
try {
|
|
54
|
+
const response = await _client.bolnaClient.delete(`/providers/${args.provider_key_name}`);
|
|
55
|
+
return {
|
|
56
|
+
content: [
|
|
57
|
+
{
|
|
58
|
+
type: "text",
|
|
59
|
+
text: JSON.stringify(response.data, null, 2) || `Provider ${args.provider_key_name} removed successfully.`
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
};
|
|
63
|
+
} catch (error) {
|
|
64
|
+
(0, _client.handleAxiosError)(error, "bolna_remove_provider");
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "registerSipTrunkTools", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return registerSipTrunkTools;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _zod = require("zod");
|
|
12
|
+
const _client = require("../client.js");
|
|
13
|
+
function registerSipTrunkTools(server) {
|
|
14
|
+
server.tool("bolna_create_sip_trunk", "Create a new SIP trunk (BYOT) on Bolna for inbound/outbound calling via your own telephony provider", {
|
|
15
|
+
name: _zod.z.string().describe("Human-readable label for the trunk (must be unique per account)"),
|
|
16
|
+
provider: _zod.z.string().describe('SIP provider, e.g. "twilio", "plivo", "zadarma", "telnyx", "vonage", "custom"'),
|
|
17
|
+
auth_type: _zod.z.enum([
|
|
18
|
+
"userpass",
|
|
19
|
+
"ip-based"
|
|
20
|
+
]).describe("Authentication method for the trunk"),
|
|
21
|
+
gateways: _zod.z.array(_zod.z.object({
|
|
22
|
+
gateway_address: _zod.z.string().describe("Hostname or IP of the SIP gateway"),
|
|
23
|
+
port: _zod.z.number().int().optional().default(5060),
|
|
24
|
+
priority: _zod.z.number().int().optional().default(1)
|
|
25
|
+
})).min(1).describe("At least one gateway is required"),
|
|
26
|
+
description: _zod.z.string().optional().describe("Optional description for internal reference"),
|
|
27
|
+
auth_username: _zod.z.string().optional().describe("SIP username (required when auth_type is 'userpass')"),
|
|
28
|
+
auth_password: _zod.z.string().optional().describe("SIP password (required when auth_type is 'userpass')"),
|
|
29
|
+
ip_identifiers: _zod.z.array(_zod.z.object({
|
|
30
|
+
ip_address: _zod.z.string()
|
|
31
|
+
})).optional().describe("IP ranges for ip-based auth, e.g. [{ip_address: '15.207.90.192/31'}]"),
|
|
32
|
+
inbound_enabled: _zod.z.boolean().optional().default(false).describe("Enable inbound calls on this trunk"),
|
|
33
|
+
outbound_leading_plus_enabled: _zod.z.boolean().optional().default(true).describe("Prepend + to outbound dialed numbers"),
|
|
34
|
+
allow: _zod.z.string().optional().default("ulaw,alaw").describe("Allowed codecs"),
|
|
35
|
+
disallow: _zod.z.string().optional().default("all").describe("Disallowed codecs"),
|
|
36
|
+
transport: _zod.z.enum([
|
|
37
|
+
"transport-udp",
|
|
38
|
+
"transport-tcp",
|
|
39
|
+
"transport-tls"
|
|
40
|
+
]).optional().default("transport-udp")
|
|
41
|
+
}, async (args)=>{
|
|
42
|
+
try {
|
|
43
|
+
const response = await _client.bolnaClient.post("/sip-trunks/trunks", args);
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
type: "text",
|
|
48
|
+
text: JSON.stringify(response.data, null, 2)
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
} catch (error) {
|
|
53
|
+
(0, _client.handleAxiosError)(error, "bolna_create_sip_trunk");
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
server.tool("bolna_list_sip_trunks", "List all SIP trunks configured in your Bolna account", {
|
|
57
|
+
active_only: _zod.z.boolean().optional().describe("Filter to only active trunks")
|
|
58
|
+
}, async (args)=>{
|
|
59
|
+
try {
|
|
60
|
+
const response = await _client.bolnaClient.get("/sip-trunks/trunks", {
|
|
61
|
+
params: args.active_only !== undefined ? {
|
|
62
|
+
active: args.active_only
|
|
63
|
+
} : {}
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: "text",
|
|
69
|
+
text: JSON.stringify(response.data, null, 2)
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
};
|
|
73
|
+
} catch (error) {
|
|
74
|
+
(0, _client.handleAxiosError)(error, "bolna_list_sip_trunks");
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
server.tool("bolna_get_sip_trunk", "Get full details of a single SIP trunk including gateways, IP identifiers, and phone numbers", {
|
|
78
|
+
trunk_id: _zod.z.string().describe("The SIP trunk ID to retrieve")
|
|
79
|
+
}, async (args)=>{
|
|
80
|
+
try {
|
|
81
|
+
const response = await _client.bolnaClient.get(`/sip-trunks/trunks/${args.trunk_id}`);
|
|
82
|
+
return {
|
|
83
|
+
content: [
|
|
84
|
+
{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: JSON.stringify(response.data, null, 2)
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
};
|
|
90
|
+
} catch (error) {
|
|
91
|
+
(0, _client.handleAxiosError)(error, "bolna_get_sip_trunk");
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
server.tool("bolna_update_sip_trunk", "Partially update an existing SIP trunk (only included fields are changed)", {
|
|
95
|
+
trunk_id: _zod.z.string().describe("The SIP trunk ID to update"),
|
|
96
|
+
name: _zod.z.string().optional(),
|
|
97
|
+
description: _zod.z.string().optional(),
|
|
98
|
+
inbound_enabled: _zod.z.boolean().optional(),
|
|
99
|
+
outbound_leading_plus_enabled: _zod.z.boolean().optional(),
|
|
100
|
+
auth_username: _zod.z.string().optional(),
|
|
101
|
+
auth_password: _zod.z.string().optional()
|
|
102
|
+
}, async (args)=>{
|
|
103
|
+
try {
|
|
104
|
+
const { trunk_id, ...patch } = args;
|
|
105
|
+
const response = await _client.bolnaClient.patch(`/sip-trunks/trunks/${trunk_id}`, patch);
|
|
106
|
+
return {
|
|
107
|
+
content: [
|
|
108
|
+
{
|
|
109
|
+
type: "text",
|
|
110
|
+
text: JSON.stringify(response.data, null, 2)
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
};
|
|
114
|
+
} catch (error) {
|
|
115
|
+
(0, _client.handleAxiosError)(error, "bolna_update_sip_trunk");
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
server.tool("bolna_delete_sip_trunk", "Permanently delete a SIP trunk and all its associated gateways and phone numbers", {
|
|
119
|
+
trunk_id: _zod.z.string().describe("The SIP trunk ID to delete")
|
|
120
|
+
}, async (args)=>{
|
|
121
|
+
try {
|
|
122
|
+
const response = await _client.bolnaClient.delete(`/sip-trunks/trunks/${args.trunk_id}`);
|
|
123
|
+
return {
|
|
124
|
+
content: [
|
|
125
|
+
{
|
|
126
|
+
type: "text",
|
|
127
|
+
text: JSON.stringify(response.data, null, 2) || `SIP trunk ${args.trunk_id} deleted successfully.`
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
} catch (error) {
|
|
132
|
+
(0, _client.handleAxiosError)(error, "bolna_delete_sip_trunk");
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
server.tool("bolna_add_sip_trunk_number", "Add a DID phone number to a SIP trunk for inbound/outbound calling", {
|
|
136
|
+
trunk_id: _zod.z.string().describe("The SIP trunk ID to add the number to"),
|
|
137
|
+
phone_number: _zod.z.string().describe("The DID phone number to register on the trunk, e.g. '919876543210'"),
|
|
138
|
+
name: _zod.z.string().optional().describe("Optional label for the phone number"),
|
|
139
|
+
e164_check_enabled: _zod.z.boolean().optional().default(false).describe("Enforce E.164 format validation")
|
|
140
|
+
}, async (args)=>{
|
|
141
|
+
try {
|
|
142
|
+
const { trunk_id, ...body } = args;
|
|
143
|
+
const response = await _client.bolnaClient.post(`/sip-trunks/trunks/${trunk_id}/numbers`, body);
|
|
144
|
+
return {
|
|
145
|
+
content: [
|
|
146
|
+
{
|
|
147
|
+
type: "text",
|
|
148
|
+
text: JSON.stringify(response.data, null, 2)
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
};
|
|
152
|
+
} catch (error) {
|
|
153
|
+
(0, _client.handleAxiosError)(error, "bolna_add_sip_trunk_number");
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
server.tool("bolna_list_sip_trunk_numbers", "List all phone numbers associated with a SIP trunk", {
|
|
157
|
+
trunk_id: _zod.z.string().describe("The SIP trunk ID whose numbers to list")
|
|
158
|
+
}, async (args)=>{
|
|
159
|
+
try {
|
|
160
|
+
const response = await _client.bolnaClient.get(`/sip-trunks/trunks/${args.trunk_id}/numbers`);
|
|
161
|
+
return {
|
|
162
|
+
content: [
|
|
163
|
+
{
|
|
164
|
+
type: "text",
|
|
165
|
+
text: JSON.stringify(response.data, null, 2)
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
};
|
|
169
|
+
} catch (error) {
|
|
170
|
+
(0, _client.handleAxiosError)(error, "bolna_list_sip_trunk_numbers");
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
server.tool("bolna_remove_sip_trunk_number", "Remove a phone number from a SIP trunk (also removes any agent mapping)", {
|
|
174
|
+
trunk_id: _zod.z.string().describe("The SIP trunk ID"),
|
|
175
|
+
phone_number_id: _zod.z.string().describe("The phone number record ID to remove")
|
|
176
|
+
}, async (args)=>{
|
|
177
|
+
try {
|
|
178
|
+
const response = await _client.bolnaClient.delete(`/sip-trunks/trunks/${args.trunk_id}/numbers/${args.phone_number_id}`);
|
|
179
|
+
return {
|
|
180
|
+
content: [
|
|
181
|
+
{
|
|
182
|
+
type: "text",
|
|
183
|
+
text: JSON.stringify(response.data, null, 2) || `Phone number ${args.phone_number_id} removed from trunk ${args.trunk_id}.`
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
};
|
|
187
|
+
} catch (error) {
|
|
188
|
+
(0, _client.handleAxiosError)(error, "bolna_remove_sip_trunk_number");
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "registerSubAccountTools", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return registerSubAccountTools;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _zod = require("zod");
|
|
12
|
+
const _client = require("../client.js");
|
|
13
|
+
function registerSubAccountTools(server) {
|
|
14
|
+
server.tool("bolna_create_sub_account", "Create a new sub-account for enterprise multi-tenant management (enterprise feature)", {
|
|
15
|
+
name: _zod.z.string().describe("Unique name for the sub-account, e.g. 'alpha-007'"),
|
|
16
|
+
allow_concurrent_calls: _zod.z.number().int().positive().describe("Maximum number of concurrent calls allowed for this sub-account"),
|
|
17
|
+
multi_tenant: _zod.z.boolean().optional().default(false).describe("Store sub-account data in a separate database"),
|
|
18
|
+
db_host: _zod.z.string().optional().describe("Database host (for multi-tenant)"),
|
|
19
|
+
db_name: _zod.z.string().optional().describe("Database name (for multi-tenant)"),
|
|
20
|
+
db_port: _zod.z.string().optional().describe("Database port (for multi-tenant)"),
|
|
21
|
+
db_user: _zod.z.string().optional().describe("Database user (for multi-tenant)"),
|
|
22
|
+
db_password: _zod.z.string().optional().describe("Database password (for multi-tenant)")
|
|
23
|
+
}, async (args)=>{
|
|
24
|
+
try {
|
|
25
|
+
const body = {
|
|
26
|
+
name: args.name,
|
|
27
|
+
allow_concurrent_calls: args.allow_concurrent_calls,
|
|
28
|
+
multi_tenant: args.multi_tenant ?? false
|
|
29
|
+
};
|
|
30
|
+
if (args.db_host) body.db_host = args.db_host;
|
|
31
|
+
if (args.db_name) body.db_name = args.db_name;
|
|
32
|
+
if (args.db_port) body.db_port = args.db_port;
|
|
33
|
+
if (args.db_user) body.db_user = args.db_user;
|
|
34
|
+
if (args.db_password) body.db_password = args.db_password;
|
|
35
|
+
const response = await _client.bolnaClient.post("/sub-accounts/create", body);
|
|
36
|
+
return {
|
|
37
|
+
content: [
|
|
38
|
+
{
|
|
39
|
+
type: "text",
|
|
40
|
+
text: JSON.stringify(response.data, null, 2)
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
};
|
|
44
|
+
} catch (error) {
|
|
45
|
+
(0, _client.handleAxiosError)(error, "bolna_create_sub_account");
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
server.tool("bolna_list_sub_accounts", "List all sub-accounts linked to your main Bolna organization account", {}, async ()=>{
|
|
49
|
+
try {
|
|
50
|
+
const response = await _client.bolnaClient.get("/sub-accounts/all");
|
|
51
|
+
return {
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: "text",
|
|
55
|
+
text: JSON.stringify(response.data, null, 2)
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
} catch (error) {
|
|
60
|
+
(0, _client.handleAxiosError)(error, "bolna_list_sub_accounts");
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
server.tool("bolna_get_sub_account_usage", "Track usage, consumption, and billing details for a specific sub-account", {
|
|
64
|
+
sub_account_id: _zod.z.string().describe("UUID of the sub-account to retrieve usage for")
|
|
65
|
+
}, async (args)=>{
|
|
66
|
+
try {
|
|
67
|
+
const response = await _client.bolnaClient.get(`/sub-accounts/${args.sub_account_id}/usage`);
|
|
68
|
+
return {
|
|
69
|
+
content: [
|
|
70
|
+
{
|
|
71
|
+
type: "text",
|
|
72
|
+
text: JSON.stringify(response.data, null, 2)
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
};
|
|
76
|
+
} catch (error) {
|
|
77
|
+
(0, _client.handleAxiosError)(error, "bolna_get_sub_account_usage");
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
server.tool("bolna_get_all_sub_accounts_usage", "Retrieve usage, consumption, and billing details for ALL sub-accounts under your organization", {}, async ()=>{
|
|
81
|
+
try {
|
|
82
|
+
const response = await _client.bolnaClient.get("/sub-accounts/usage");
|
|
83
|
+
return {
|
|
84
|
+
content: [
|
|
85
|
+
{
|
|
86
|
+
type: "text",
|
|
87
|
+
text: JSON.stringify(response.data, null, 2)
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
};
|
|
91
|
+
} catch (error) {
|
|
92
|
+
(0, _client.handleAxiosError)(error, "bolna_get_all_sub_accounts_usage");
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
server.tool("bolna_patch_sub_account", "Partially update a sub-account's name or concurrent call limit", {
|
|
96
|
+
sub_account_id: _zod.z.string().describe("UUID of the sub-account to update"),
|
|
97
|
+
name: _zod.z.string().optional().describe("New name for the sub-account"),
|
|
98
|
+
allow_concurrent_calls: _zod.z.number().int().positive().optional().describe("New concurrent call limit")
|
|
99
|
+
}, async (args)=>{
|
|
100
|
+
try {
|
|
101
|
+
const { sub_account_id, ...patch } = args;
|
|
102
|
+
const response = await _client.bolnaClient.patch(`/sub-accounts/${sub_account_id}`, patch);
|
|
103
|
+
return {
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: "text",
|
|
107
|
+
text: JSON.stringify(response.data, null, 2)
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
};
|
|
111
|
+
} catch (error) {
|
|
112
|
+
(0, _client.handleAxiosError)(error, "bolna_patch_sub_account");
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
server.tool("bolna_delete_sub_account", "Permanently delete a sub-account and all its associated agents, batches, and executions", {
|
|
116
|
+
sub_account_id: _zod.z.string().describe("UUID of the sub-account to delete")
|
|
117
|
+
}, async (args)=>{
|
|
118
|
+
try {
|
|
119
|
+
const response = await _client.bolnaClient.delete(`/sub-accounts/${args.sub_account_id}`);
|
|
120
|
+
return {
|
|
121
|
+
content: [
|
|
122
|
+
{
|
|
123
|
+
type: "text",
|
|
124
|
+
text: JSON.stringify(response.data, null, 2) || `Sub-account ${args.sub_account_id} deleted successfully.`
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
};
|
|
128
|
+
} catch (error) {
|
|
129
|
+
(0, _client.handleAxiosError)(error, "bolna_delete_sub_account");
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "registerUserTools", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return registerUserTools;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _zod = require("zod");
|
|
12
|
+
const _client = require("../client.js");
|
|
13
|
+
function registerUserTools(server) {
|
|
14
|
+
server.tool("bolna_get_user_info", "Get your Bolna account details including name, email, wallet balance, and concurrency limits", {}, async ()=>{
|
|
15
|
+
try {
|
|
16
|
+
const response = await _client.bolnaClient.get("/user/me");
|
|
17
|
+
return {
|
|
18
|
+
content: [
|
|
19
|
+
{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: JSON.stringify(response.data, null, 2)
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
};
|
|
25
|
+
} catch (error) {
|
|
26
|
+
(0, _client.handleAxiosError)(error, "bolna_get_user_info");
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
server.tool("bolna_add_custom_llm", "Integrate a custom Large Language Model with your Bolna account for use in agents", {
|
|
30
|
+
model_name: _zod.z.string().describe("A unique name/identifier for your custom LLM model"),
|
|
31
|
+
api_base: _zod.z.string().url().describe("Base URL of your custom LLM's OpenAI-compatible API endpoint"),
|
|
32
|
+
api_key: _zod.z.string().optional().describe("API key for the custom LLM endpoint (if required)"),
|
|
33
|
+
model: _zod.z.string().optional().describe("The specific model ID to use at the endpoint")
|
|
34
|
+
}, async (args)=>{
|
|
35
|
+
try {
|
|
36
|
+
const body = {
|
|
37
|
+
model_name: args.model_name,
|
|
38
|
+
api_base: args.api_base
|
|
39
|
+
};
|
|
40
|
+
if (args.api_key) body.api_key = args.api_key;
|
|
41
|
+
if (args.model) body.model = args.model;
|
|
42
|
+
const response = await _client.bolnaClient.post("/user/add_model", body);
|
|
43
|
+
return {
|
|
44
|
+
content: [
|
|
45
|
+
{
|
|
46
|
+
type: "text",
|
|
47
|
+
text: JSON.stringify(response.data, null, 2)
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
};
|
|
51
|
+
} catch (error) {
|
|
52
|
+
(0, _client.handleAxiosError)(error, "bolna_add_custom_llm");
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|