elevenlabs-voice-agent-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 +533 -0
- package/dist/constants.d.ts +25 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +51 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/agent-schemas.d.ts +147 -0
- package/dist/schemas/agent-schemas.d.ts.map +1 -0
- package/dist/schemas/agent-schemas.js +145 -0
- package/dist/schemas/agent-schemas.js.map +1 -0
- package/dist/schemas/batch-calling-schemas.d.ts +170 -0
- package/dist/schemas/batch-calling-schemas.d.ts.map +1 -0
- package/dist/schemas/batch-calling-schemas.js +77 -0
- package/dist/schemas/batch-calling-schemas.js.map +1 -0
- package/dist/schemas/common-schemas.d.ts +54 -0
- package/dist/schemas/common-schemas.d.ts.map +1 -0
- package/dist/schemas/common-schemas.js +72 -0
- package/dist/schemas/common-schemas.js.map +1 -0
- package/dist/schemas/conversation-schemas.d.ts +72 -0
- package/dist/schemas/conversation-schemas.d.ts.map +1 -0
- package/dist/schemas/conversation-schemas.js +30 -0
- package/dist/schemas/conversation-schemas.js.map +1 -0
- package/dist/schemas/outbound-schemas.d.ts +115 -0
- package/dist/schemas/outbound-schemas.d.ts.map +1 -0
- package/dist/schemas/outbound-schemas.js +61 -0
- package/dist/schemas/outbound-schemas.js.map +1 -0
- package/dist/schemas/phone-number-schemas.d.ts +168 -0
- package/dist/schemas/phone-number-schemas.d.ts.map +1 -0
- package/dist/schemas/phone-number-schemas.js +116 -0
- package/dist/schemas/phone-number-schemas.js.map +1 -0
- package/dist/schemas/tool-schemas.d.ts +208 -0
- package/dist/schemas/tool-schemas.d.ts.map +1 -0
- package/dist/schemas/tool-schemas.js +131 -0
- package/dist/schemas/tool-schemas.js.map +1 -0
- package/dist/services/elevenlabs-api.d.ts +37 -0
- package/dist/services/elevenlabs-api.d.ts.map +1 -0
- package/dist/services/elevenlabs-api.js +78 -0
- package/dist/services/elevenlabs-api.js.map +1 -0
- package/dist/services/formatters.d.ts +76 -0
- package/dist/services/formatters.d.ts.map +1 -0
- package/dist/services/formatters.js +475 -0
- package/dist/services/formatters.js.map +1 -0
- package/dist/tools/agent-tools.d.ts +228 -0
- package/dist/tools/agent-tools.d.ts.map +1 -0
- package/dist/tools/agent-tools.js +369 -0
- package/dist/tools/agent-tools.js.map +1 -0
- package/dist/tools/batch-calling-tools.d.ts +183 -0
- package/dist/tools/batch-calling-tools.d.ts.map +1 -0
- package/dist/tools/batch-calling-tools.js +203 -0
- package/dist/tools/batch-calling-tools.js.map +1 -0
- package/dist/tools/conversation-tools.d.ts +103 -0
- package/dist/tools/conversation-tools.d.ts.map +1 -0
- package/dist/tools/conversation-tools.js +140 -0
- package/dist/tools/conversation-tools.js.map +1 -0
- package/dist/tools/knowledge-tools.d.ts +75 -0
- package/dist/tools/knowledge-tools.d.ts.map +1 -0
- package/dist/tools/knowledge-tools.js +63 -0
- package/dist/tools/knowledge-tools.js.map +1 -0
- package/dist/tools/outbound-tools.d.ts +44 -0
- package/dist/tools/outbound-tools.d.ts.map +1 -0
- package/dist/tools/outbound-tools.js +84 -0
- package/dist/tools/outbound-tools.js.map +1 -0
- package/dist/tools/phone-number-tools.d.ts +215 -0
- package/dist/tools/phone-number-tools.d.ts.map +1 -0
- package/dist/tools/phone-number-tools.js +295 -0
- package/dist/tools/phone-number-tools.js.map +1 -0
- package/dist/tools/tool-tools.d.ts +165 -0
- package/dist/tools/tool-tools.d.ts.map +1 -0
- package/dist/tools/tool-tools.js +166 -0
- package/dist/tools/tool-tools.js.map +1 -0
- package/dist/tools/utility-tools.d.ts +76 -0
- package/dist/tools/utility-tools.d.ts.map +1 -0
- package/dist/tools/utility-tools.js +121 -0
- package/dist/tools/utility-tools.js.map +1 -0
- package/dist/types.d.ts +282 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +12 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/error-handlers.d.ts +29 -0
- package/dist/utils/error-handlers.d.ts.map +1 -0
- package/dist/utils/error-handlers.js +90 -0
- package/dist/utils/error-handlers.js.map +1 -0
- package/dist/utils/truncation.d.ts +41 -0
- package/dist/utils/truncation.d.ts.map +1 -0
- package/dist/utils/truncation.js +78 -0
- package/dist/utils/truncation.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Phone number management tools
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for listing, importing, updating, and deleting phone numbers
|
|
5
|
+
* connected to voice agents via Twilio or SIP trunking.
|
|
6
|
+
*/
|
|
7
|
+
import { getRequest, postRequest, patchRequest, deleteRequest } from "../services/elevenlabs-api.js";
|
|
8
|
+
import { formatResponse } from "../services/formatters.js";
|
|
9
|
+
import { ListPhoneNumbersSchema, GetPhoneNumberSchema, ImportPhoneNumberSchema, UpdatePhoneNumberSchema, DeletePhoneNumberSchema } from "../schemas/phone-number-schemas.js";
|
|
10
|
+
/**
|
|
11
|
+
* Lists all phone numbers connected to the workspace
|
|
12
|
+
*/
|
|
13
|
+
export const elevenlabs_list_phone_numbers = {
|
|
14
|
+
name: "elevenlabs_list_phone_numbers",
|
|
15
|
+
description: `List all phone numbers connected to your ElevenLabs workspace.
|
|
16
|
+
|
|
17
|
+
This tool retrieves all phone numbers you've imported (Twilio or SIP trunk), showing which agents they're assigned to, their capabilities (inbound/outbound), and configuration details.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
- response_format ('markdown' | 'json'): Output format
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
Array of phone number objects, each containing:
|
|
24
|
+
- phone_number: The actual phone number
|
|
25
|
+
- label: Descriptive name
|
|
26
|
+
- phone_number_id: Unique identifier for API operations
|
|
27
|
+
- provider: 'twilio' or 'sip_trunk'
|
|
28
|
+
- supports_inbound: Whether it can receive calls
|
|
29
|
+
- supports_outbound: Whether it can make calls
|
|
30
|
+
- assigned_agent: Agent details (if assigned) or null
|
|
31
|
+
|
|
32
|
+
Examples:
|
|
33
|
+
- Use when: "Show me all my phone numbers"
|
|
34
|
+
- Use when: "List available phone numbers for outbound calling"
|
|
35
|
+
- Use when: "Which phone numbers are assigned to agents?"
|
|
36
|
+
- Don't use when: You want details about a specific phone number (use elevenlabs_get_phone_number)
|
|
37
|
+
|
|
38
|
+
Error Handling:
|
|
39
|
+
- Returns empty array if no phone numbers exist
|
|
40
|
+
- Returns "Error: Invalid API key" if authentication fails`,
|
|
41
|
+
zodSchema: ListPhoneNumbersSchema,
|
|
42
|
+
annotations: {
|
|
43
|
+
readOnlyHint: true,
|
|
44
|
+
destructiveHint: false,
|
|
45
|
+
idempotentHint: true,
|
|
46
|
+
openWorldHint: true
|
|
47
|
+
},
|
|
48
|
+
handler: async (args) => {
|
|
49
|
+
const parsed = ListPhoneNumbersSchema.parse(args);
|
|
50
|
+
const response = await getRequest("/convai/phone-numbers");
|
|
51
|
+
return {
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: "text",
|
|
55
|
+
text: formatResponse(response, parsed.response_format, "phone_number_list")
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Gets details about a specific phone number
|
|
63
|
+
*/
|
|
64
|
+
export const elevenlabs_get_phone_number = {
|
|
65
|
+
name: "elevenlabs_get_phone_number",
|
|
66
|
+
description: `Get detailed information about a specific phone number.
|
|
67
|
+
|
|
68
|
+
This tool retrieves complete configuration details for a phone number, including provider settings, agent assignment, trunk configurations, and capability flags.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
- phone_number_id (string): Unique phone number identifier (e.g., 'pn_abc123')
|
|
72
|
+
- response_format ('markdown' | 'json'): Output format
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Complete phone number details including provider-specific configuration.
|
|
76
|
+
|
|
77
|
+
Examples:
|
|
78
|
+
- Use when: "Show me details for phone number pn_abc123"
|
|
79
|
+
- Use when: "What agent is assigned to phone pn_xyz789?"
|
|
80
|
+
- Use when: "Get configuration for phone number ID pn_test456"
|
|
81
|
+
- Don't use when: You want to list all phone numbers (use elevenlabs_list_phone_numbers)
|
|
82
|
+
|
|
83
|
+
Error Handling:
|
|
84
|
+
- Returns "Error: Phone number not found" if phone_number_id doesn't exist
|
|
85
|
+
- Returns "Error: Invalid API key" if authentication fails`,
|
|
86
|
+
zodSchema: GetPhoneNumberSchema,
|
|
87
|
+
annotations: {
|
|
88
|
+
readOnlyHint: true,
|
|
89
|
+
destructiveHint: false,
|
|
90
|
+
idempotentHint: true,
|
|
91
|
+
openWorldHint: true
|
|
92
|
+
},
|
|
93
|
+
handler: async (args) => {
|
|
94
|
+
const parsed = GetPhoneNumberSchema.parse(args);
|
|
95
|
+
const response = await getRequest(`/convai/phone-numbers/${parsed.phone_number_id}`);
|
|
96
|
+
return {
|
|
97
|
+
content: [
|
|
98
|
+
{
|
|
99
|
+
type: "text",
|
|
100
|
+
text: formatResponse(response, parsed.response_format, "phone_number")
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Imports a Twilio phone number
|
|
108
|
+
*/
|
|
109
|
+
export const elevenlabs_import_phone_number = {
|
|
110
|
+
name: "elevenlabs_import_phone_number",
|
|
111
|
+
description: `Import a Twilio phone number to use with ElevenLabs Voice Agents.
|
|
112
|
+
|
|
113
|
+
This tool connects your existing Twilio phone number to ElevenLabs, enabling it for inbound and/or outbound voice agent calls. You'll need your Twilio Account SID and Auth Token.
|
|
114
|
+
|
|
115
|
+
Prerequisites:
|
|
116
|
+
- Active Twilio account with a purchased phone number
|
|
117
|
+
- Twilio Account SID and Auth Token
|
|
118
|
+
- Phone number must not already be imported
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
- phone_number (string): Phone number to import in E.164 format (e.g., '+1234567890')
|
|
122
|
+
- label (string): Descriptive name for this number (e.g., 'Customer Support Line')
|
|
123
|
+
- sid (string): Twilio Account SID (starts with 'AC')
|
|
124
|
+
- token (string): Twilio Auth Token
|
|
125
|
+
- provider (string): Must be 'twilio'
|
|
126
|
+
- supports_inbound (boolean, optional): Enable inbound calls (default: true)
|
|
127
|
+
- supports_outbound (boolean, optional): Enable outbound calls (default: true)
|
|
128
|
+
- region_config (object, optional): Regional configuration
|
|
129
|
+
- region_id: 'us1', 'ie1', or 'au1'
|
|
130
|
+
- token: Regional token
|
|
131
|
+
- edge_location: Twilio edge location
|
|
132
|
+
- response_format ('markdown' | 'json'): Output format
|
|
133
|
+
|
|
134
|
+
Returns:
|
|
135
|
+
- phone_number_id: Unique identifier for the imported phone number
|
|
136
|
+
|
|
137
|
+
Examples:
|
|
138
|
+
- Use when: "Import my Twilio number +1234567890 for customer support"
|
|
139
|
+
- Use when: "Connect Twilio phone number with SID AC123... for outbound calling"
|
|
140
|
+
- Use when: "Add new phone number +447911123456 from Twilio account"
|
|
141
|
+
- Don't use when: Number is already imported (update it instead)
|
|
142
|
+
- Don't use when: You need to assign it to an agent (use elevenlabs_update_phone_number after)
|
|
143
|
+
|
|
144
|
+
Error Handling:
|
|
145
|
+
- Returns "Error: Invalid Twilio credentials" if SID/token are wrong
|
|
146
|
+
- Returns "Error: Phone number already exists" if already imported
|
|
147
|
+
- Returns "Error: Invalid phone number format" if not E.164`,
|
|
148
|
+
zodSchema: ImportPhoneNumberSchema,
|
|
149
|
+
annotations: {
|
|
150
|
+
readOnlyHint: false,
|
|
151
|
+
destructiveHint: false,
|
|
152
|
+
idempotentHint: false,
|
|
153
|
+
openWorldHint: true
|
|
154
|
+
},
|
|
155
|
+
handler: async (args) => {
|
|
156
|
+
const parsed = ImportPhoneNumberSchema.parse(args);
|
|
157
|
+
const requestData = {
|
|
158
|
+
phone_number: parsed.phone_number,
|
|
159
|
+
label: parsed.label,
|
|
160
|
+
sid: parsed.sid,
|
|
161
|
+
token: parsed.token,
|
|
162
|
+
provider: parsed.provider,
|
|
163
|
+
...(parsed.supports_inbound !== undefined && {
|
|
164
|
+
supports_inbound: parsed.supports_inbound
|
|
165
|
+
}),
|
|
166
|
+
...(parsed.supports_outbound !== undefined && {
|
|
167
|
+
supports_outbound: parsed.supports_outbound
|
|
168
|
+
}),
|
|
169
|
+
...(parsed.region_config && {
|
|
170
|
+
region_config: parsed.region_config
|
|
171
|
+
})
|
|
172
|
+
};
|
|
173
|
+
const response = await postRequest("/convai/phone-numbers", requestData);
|
|
174
|
+
return {
|
|
175
|
+
content: [
|
|
176
|
+
{
|
|
177
|
+
type: "text",
|
|
178
|
+
text: formatResponse(response, parsed.response_format, "phone_number_import")
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Updates a phone number (primarily for agent assignment)
|
|
186
|
+
*/
|
|
187
|
+
export const elevenlabs_update_phone_number = {
|
|
188
|
+
name: "elevenlabs_update_phone_number",
|
|
189
|
+
description: `Update a phone number's configuration, primarily to assign or unassign agents.
|
|
190
|
+
|
|
191
|
+
This tool modifies phone number settings. The most common use is assigning an agent to a phone number so the agent can handle calls from that number. You can also configure SIP trunk settings for advanced deployments.
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
- phone_number_id (string): Phone number identifier to update (e.g., 'pn_abc123')
|
|
195
|
+
- agent_id (string, optional): Agent ID to assign (set to null to unassign)
|
|
196
|
+
- inbound_trunk_config (object, optional): SIP trunk configuration for inbound
|
|
197
|
+
- outbound_trunk_config (object, optional): SIP trunk configuration for outbound
|
|
198
|
+
- livekit_stack ('standard' | 'static', optional): LiveKit stack configuration
|
|
199
|
+
- response_format ('markdown' | 'json'): Output format
|
|
200
|
+
|
|
201
|
+
Returns:
|
|
202
|
+
Updated phone number object with new configuration.
|
|
203
|
+
|
|
204
|
+
Examples:
|
|
205
|
+
- Use when: "Assign agent ag_abc123 to phone number pn_xyz789"
|
|
206
|
+
- Use when: "Connect my customer support agent to the main phone line"
|
|
207
|
+
- Use when: "Unassign agent from phone number pn_test456"
|
|
208
|
+
- Use when: "Update phone number pn_sales to use agent ag_sales"
|
|
209
|
+
- Don't use when: You need to import a new number (use elevenlabs_import_phone_number)
|
|
210
|
+
|
|
211
|
+
Error Handling:
|
|
212
|
+
- Returns "Error: Phone number not found" if phone_number_id doesn't exist
|
|
213
|
+
- Returns "Error: Agent not found" if agent_id doesn't exist
|
|
214
|
+
- Returns "Error: Invalid API key" if authentication fails`,
|
|
215
|
+
zodSchema: UpdatePhoneNumberSchema,
|
|
216
|
+
annotations: {
|
|
217
|
+
readOnlyHint: false,
|
|
218
|
+
destructiveHint: false,
|
|
219
|
+
idempotentHint: true,
|
|
220
|
+
openWorldHint: true
|
|
221
|
+
},
|
|
222
|
+
handler: async (args) => {
|
|
223
|
+
const parsed = UpdatePhoneNumberSchema.parse(args);
|
|
224
|
+
const updateData = {};
|
|
225
|
+
if (parsed.agent_id !== undefined) {
|
|
226
|
+
updateData.agent_id = parsed.agent_id;
|
|
227
|
+
}
|
|
228
|
+
if (parsed.inbound_trunk_config !== undefined) {
|
|
229
|
+
updateData.inbound_trunk_config = parsed.inbound_trunk_config;
|
|
230
|
+
}
|
|
231
|
+
if (parsed.outbound_trunk_config !== undefined) {
|
|
232
|
+
updateData.outbound_trunk_config = parsed.outbound_trunk_config;
|
|
233
|
+
}
|
|
234
|
+
if (parsed.livekit_stack !== undefined) {
|
|
235
|
+
updateData.livekit_stack = parsed.livekit_stack;
|
|
236
|
+
}
|
|
237
|
+
const response = await patchRequest(`/convai/phone-numbers/${parsed.phone_number_id}`, updateData);
|
|
238
|
+
return {
|
|
239
|
+
content: [
|
|
240
|
+
{
|
|
241
|
+
type: "text",
|
|
242
|
+
text: formatResponse(response, parsed.response_format, "phone_number")
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Deletes a phone number
|
|
250
|
+
*/
|
|
251
|
+
export const elevenlabs_delete_phone_number = {
|
|
252
|
+
name: "elevenlabs_delete_phone_number",
|
|
253
|
+
description: `Delete a phone number from your ElevenLabs workspace.
|
|
254
|
+
|
|
255
|
+
This tool permanently removes a phone number from ElevenLabs. This does NOT delete the number from your Twilio account - it only disconnects it from ElevenLabs. You can re-import it later if needed.
|
|
256
|
+
|
|
257
|
+
IMPORTANT: This action cannot be undone. Any agent assignments will be removed.
|
|
258
|
+
|
|
259
|
+
Args:
|
|
260
|
+
- phone_number_id (string): Phone number identifier to delete (e.g., 'pn_abc123')
|
|
261
|
+
|
|
262
|
+
Returns:
|
|
263
|
+
Confirmation message indicating successful deletion.
|
|
264
|
+
|
|
265
|
+
Examples:
|
|
266
|
+
- Use when: "Delete phone number pn_test123"
|
|
267
|
+
- Use when: "Remove phone number pn_old456 from ElevenLabs"
|
|
268
|
+
- Use when: "Disconnect Twilio number pn_unused789"
|
|
269
|
+
- Don't use when: You just want to unassign an agent (use elevenlabs_update_phone_number)
|
|
270
|
+
- Don't use when: You're not sure - this is permanent!
|
|
271
|
+
|
|
272
|
+
Error Handling:
|
|
273
|
+
- Returns "Error: Phone number not found" if phone_number_id doesn't exist
|
|
274
|
+
- Returns "Error: Invalid API key" if authentication fails`,
|
|
275
|
+
zodSchema: DeletePhoneNumberSchema,
|
|
276
|
+
annotations: {
|
|
277
|
+
readOnlyHint: false,
|
|
278
|
+
destructiveHint: true,
|
|
279
|
+
idempotentHint: true,
|
|
280
|
+
openWorldHint: true
|
|
281
|
+
},
|
|
282
|
+
handler: async (args) => {
|
|
283
|
+
const parsed = DeletePhoneNumberSchema.parse(args);
|
|
284
|
+
await deleteRequest(`/convai/phone-numbers/${parsed.phone_number_id}`);
|
|
285
|
+
return {
|
|
286
|
+
content: [
|
|
287
|
+
{
|
|
288
|
+
type: "text",
|
|
289
|
+
text: `Successfully deleted phone number: ${parsed.phone_number_id}`
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
//# sourceMappingURL=phone-number-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone-number-tools.js","sourceRoot":"","sources":["../../src/tools/phone-number-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,oCAAoC,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;6DAyB8C;IAE3D,SAAS,EAAE,sBAAsB;IAEjC,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,IAAI;KACpB;IAED,OAAO,EAAE,KAAK,EAAE,IAAa,EAAE,EAAE;QAC/B,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAElD,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAgB,uBAAuB,CAAC,CAAC;QAE1E,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,eAAe,EAAE,mBAAmB,CAAC;iBAC5E;aACF;SACF,CAAC;IACJ,CAAC;CACF,CA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;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent tool management
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for creating, listing, and deleting webhook tools that agents can invoke.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Creates a webhook tool for an agent
|
|
8
|
+
*/
|
|
9
|
+
export declare const elevenlabs_create_webhook_tool: {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
zodSchema: import("zod").ZodObject<{
|
|
13
|
+
agent_id: import("zod").ZodString;
|
|
14
|
+
name: import("zod").ZodString;
|
|
15
|
+
description: import("zod").ZodString;
|
|
16
|
+
url: import("zod").ZodString;
|
|
17
|
+
method: import("zod").ZodDefault<import("zod").ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>>;
|
|
18
|
+
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
19
|
+
parameters: import("zod").ZodArray<import("zod").ZodObject<{
|
|
20
|
+
name: import("zod").ZodString;
|
|
21
|
+
type: import("zod").ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
22
|
+
description: import("zod").ZodString;
|
|
23
|
+
required: import("zod").ZodBoolean;
|
|
24
|
+
enum: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
25
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
26
|
+
name: import("zod").ZodString;
|
|
27
|
+
type: import("zod").ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
28
|
+
description: import("zod").ZodString;
|
|
29
|
+
required: import("zod").ZodBoolean;
|
|
30
|
+
enum: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
31
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
32
|
+
name: import("zod").ZodString;
|
|
33
|
+
type: import("zod").ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
34
|
+
description: import("zod").ZodString;
|
|
35
|
+
required: import("zod").ZodBoolean;
|
|
36
|
+
enum: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
37
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">;
|
|
38
|
+
response_format: import("zod").ZodDefault<import("zod").ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
|
|
39
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
40
|
+
agent_id: import("zod").ZodString;
|
|
41
|
+
name: import("zod").ZodString;
|
|
42
|
+
description: import("zod").ZodString;
|
|
43
|
+
url: import("zod").ZodString;
|
|
44
|
+
method: import("zod").ZodDefault<import("zod").ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>>;
|
|
45
|
+
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
46
|
+
parameters: import("zod").ZodArray<import("zod").ZodObject<{
|
|
47
|
+
name: import("zod").ZodString;
|
|
48
|
+
type: import("zod").ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
49
|
+
description: import("zod").ZodString;
|
|
50
|
+
required: import("zod").ZodBoolean;
|
|
51
|
+
enum: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
52
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
53
|
+
name: import("zod").ZodString;
|
|
54
|
+
type: import("zod").ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
55
|
+
description: import("zod").ZodString;
|
|
56
|
+
required: import("zod").ZodBoolean;
|
|
57
|
+
enum: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
58
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
59
|
+
name: import("zod").ZodString;
|
|
60
|
+
type: import("zod").ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
61
|
+
description: import("zod").ZodString;
|
|
62
|
+
required: import("zod").ZodBoolean;
|
|
63
|
+
enum: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
64
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">;
|
|
65
|
+
response_format: import("zod").ZodDefault<import("zod").ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
|
|
66
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
67
|
+
agent_id: import("zod").ZodString;
|
|
68
|
+
name: import("zod").ZodString;
|
|
69
|
+
description: import("zod").ZodString;
|
|
70
|
+
url: import("zod").ZodString;
|
|
71
|
+
method: import("zod").ZodDefault<import("zod").ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>>;
|
|
72
|
+
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
73
|
+
parameters: import("zod").ZodArray<import("zod").ZodObject<{
|
|
74
|
+
name: import("zod").ZodString;
|
|
75
|
+
type: import("zod").ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
76
|
+
description: import("zod").ZodString;
|
|
77
|
+
required: import("zod").ZodBoolean;
|
|
78
|
+
enum: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
79
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
80
|
+
name: import("zod").ZodString;
|
|
81
|
+
type: import("zod").ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
82
|
+
description: import("zod").ZodString;
|
|
83
|
+
required: import("zod").ZodBoolean;
|
|
84
|
+
enum: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
85
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
86
|
+
name: import("zod").ZodString;
|
|
87
|
+
type: import("zod").ZodEnum<["string", "number", "boolean", "object", "array"]>;
|
|
88
|
+
description: import("zod").ZodString;
|
|
89
|
+
required: import("zod").ZodBoolean;
|
|
90
|
+
enum: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
91
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">;
|
|
92
|
+
response_format: import("zod").ZodDefault<import("zod").ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
|
|
93
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
94
|
+
annotations: {
|
|
95
|
+
readOnlyHint: boolean;
|
|
96
|
+
destructiveHint: boolean;
|
|
97
|
+
idempotentHint: boolean;
|
|
98
|
+
openWorldHint: boolean;
|
|
99
|
+
};
|
|
100
|
+
handler: (args: unknown) => Promise<{
|
|
101
|
+
content: {
|
|
102
|
+
type: string;
|
|
103
|
+
text: string;
|
|
104
|
+
}[];
|
|
105
|
+
}>;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Lists all tools configured for an agent
|
|
109
|
+
*/
|
|
110
|
+
export declare const elevenlabs_list_tools: {
|
|
111
|
+
name: string;
|
|
112
|
+
description: string;
|
|
113
|
+
zodSchema: import("zod").ZodObject<{
|
|
114
|
+
agent_id: import("zod").ZodString;
|
|
115
|
+
response_format: import("zod").ZodDefault<import("zod").ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
|
|
116
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
117
|
+
agent_id: import("zod").ZodString;
|
|
118
|
+
response_format: import("zod").ZodDefault<import("zod").ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
|
|
119
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
120
|
+
agent_id: import("zod").ZodString;
|
|
121
|
+
response_format: import("zod").ZodDefault<import("zod").ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
|
|
122
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
123
|
+
annotations: {
|
|
124
|
+
readOnlyHint: boolean;
|
|
125
|
+
destructiveHint: boolean;
|
|
126
|
+
idempotentHint: boolean;
|
|
127
|
+
openWorldHint: boolean;
|
|
128
|
+
};
|
|
129
|
+
handler: (args: unknown) => Promise<{
|
|
130
|
+
content: {
|
|
131
|
+
type: string;
|
|
132
|
+
text: string;
|
|
133
|
+
}[];
|
|
134
|
+
}>;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Deletes a tool from an agent
|
|
138
|
+
*/
|
|
139
|
+
export declare const elevenlabs_delete_tool: {
|
|
140
|
+
name: string;
|
|
141
|
+
description: string;
|
|
142
|
+
zodSchema: import("zod").ZodObject<{
|
|
143
|
+
agent_id: import("zod").ZodString;
|
|
144
|
+
tool_name: import("zod").ZodString;
|
|
145
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
146
|
+
agent_id: import("zod").ZodString;
|
|
147
|
+
tool_name: import("zod").ZodString;
|
|
148
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
149
|
+
agent_id: import("zod").ZodString;
|
|
150
|
+
tool_name: import("zod").ZodString;
|
|
151
|
+
}, import("zod").ZodTypeAny, "passthrough">>;
|
|
152
|
+
annotations: {
|
|
153
|
+
readOnlyHint: boolean;
|
|
154
|
+
destructiveHint: boolean;
|
|
155
|
+
idempotentHint: boolean;
|
|
156
|
+
openWorldHint: boolean;
|
|
157
|
+
};
|
|
158
|
+
handler: (args: unknown) => Promise<{
|
|
159
|
+
content: {
|
|
160
|
+
type: string;
|
|
161
|
+
text: string;
|
|
162
|
+
}[];
|
|
163
|
+
}>;
|
|
164
|
+
};
|
|
165
|
+
//# sourceMappingURL=tool-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-tools.d.ts","sourceRoot":"","sources":["../../src/tools/tool-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH;;GAEG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA4CnB,OAAO;;;;;;CA2B9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;oBAgCV,OAAO;;;;;;CAgB9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;oBA+BX,OAAO;;;;;;CAgB9B,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent tool management
|
|
3
|
+
*
|
|
4
|
+
* MCP tools for creating, listing, and deleting webhook tools that agents can invoke.
|
|
5
|
+
*/
|
|
6
|
+
import { getRequest, postRequest, deleteRequest } from "../services/elevenlabs-api.js";
|
|
7
|
+
import { formatResponse } from "../services/formatters.js";
|
|
8
|
+
import { CreateWebhookToolSchema, ListToolsSchema, DeleteToolSchema } from "../schemas/tool-schemas.js";
|
|
9
|
+
/**
|
|
10
|
+
* Creates a webhook tool for an agent
|
|
11
|
+
*/
|
|
12
|
+
export const elevenlabs_create_webhook_tool = {
|
|
13
|
+
name: "elevenlabs_create_webhook_tool",
|
|
14
|
+
description: `Create a webhook tool that the agent can invoke during conversations.
|
|
15
|
+
|
|
16
|
+
This tool allows agents to interact with external APIs and services. When the agent determines it needs to use the tool, it will make an HTTP request to the specified URL with the provided parameters. The webhook response can inform the agent's next response.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
- agent_id (string): Agent to add the tool to
|
|
20
|
+
- name (string): Unique tool name (alphanumeric, hyphens, underscores only, max 64 chars)
|
|
21
|
+
- description (string): Clear description of what the tool does (10-500 chars)
|
|
22
|
+
- url (string): Webhook URL to call when tool is invoked
|
|
23
|
+
- method (string): HTTP method (GET, POST, PUT, PATCH, DELETE, default: POST)
|
|
24
|
+
- headers (object): Optional custom headers as key-value pairs
|
|
25
|
+
- parameters (array): Array of parameter definitions with:
|
|
26
|
+
- name (string): Parameter name
|
|
27
|
+
- type (string): Data type (string, number, boolean, object, array)
|
|
28
|
+
- description (string): Parameter description
|
|
29
|
+
- required (boolean): Whether parameter is required
|
|
30
|
+
- enum (array): Optional array of allowed values
|
|
31
|
+
- response_format ('markdown' | 'json'): Output format
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
Created tool configuration.
|
|
35
|
+
|
|
36
|
+
Examples:
|
|
37
|
+
- Use when: "Add a tool to check order status from our API"
|
|
38
|
+
- Use when: "Create a webhook tool to schedule callbacks"
|
|
39
|
+
- Use when: "Give the agent ability to search our product catalog"
|
|
40
|
+
- Don't use when: You want to add knowledge/documents (use elevenlabs_add_knowledge_base)
|
|
41
|
+
|
|
42
|
+
Error Handling:
|
|
43
|
+
- Returns "Error: Agent not found" if agent_id doesn't exist
|
|
44
|
+
- Returns "Error: Tool name already exists" if name is taken
|
|
45
|
+
- Returns "Error: Invalid URL" if webhook URL is not valid`,
|
|
46
|
+
zodSchema: CreateWebhookToolSchema,
|
|
47
|
+
annotations: {
|
|
48
|
+
readOnlyHint: false,
|
|
49
|
+
destructiveHint: false,
|
|
50
|
+
idempotentHint: false,
|
|
51
|
+
openWorldHint: true
|
|
52
|
+
},
|
|
53
|
+
handler: async (args) => {
|
|
54
|
+
const parsed = CreateWebhookToolSchema.parse(args);
|
|
55
|
+
const toolData = {
|
|
56
|
+
name: parsed.name,
|
|
57
|
+
description: parsed.description,
|
|
58
|
+
type: "webhook",
|
|
59
|
+
url: parsed.url,
|
|
60
|
+
method: parsed.method,
|
|
61
|
+
...(parsed.headers && { headers: parsed.headers }),
|
|
62
|
+
parameters: parsed.parameters
|
|
63
|
+
};
|
|
64
|
+
const tool = await postRequest(`/convai/agents/${parsed.agent_id}/tools`, toolData);
|
|
65
|
+
return {
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: "text",
|
|
69
|
+
text: formatResponse(tool, parsed.response_format, "tool")
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Lists all tools configured for an agent
|
|
77
|
+
*/
|
|
78
|
+
export const elevenlabs_list_tools = {
|
|
79
|
+
name: "elevenlabs_list_tools",
|
|
80
|
+
description: `List all tools configured for an agent.
|
|
81
|
+
|
|
82
|
+
This tool retrieves all webhook tools that have been added to an agent. Use this to see what external capabilities the agent currently has access to.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
- agent_id (string): Agent identifier
|
|
86
|
+
- response_format ('markdown' | 'json'): Output format
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
Array of tool configurations including names, descriptions, URLs, and parameters.
|
|
90
|
+
|
|
91
|
+
Examples:
|
|
92
|
+
- Use when: "Show me all tools for this agent"
|
|
93
|
+
- Use when: "What APIs can the agent access?"
|
|
94
|
+
- Use when: "List the webhook tools configured"
|
|
95
|
+
- Don't use when: You want to see agent configuration (use elevenlabs_get_agent)
|
|
96
|
+
|
|
97
|
+
Error Handling:
|
|
98
|
+
- Returns "Error: Agent not found" if agent_id doesn't exist
|
|
99
|
+
- Returns empty list if agent has no tools`,
|
|
100
|
+
zodSchema: ListToolsSchema,
|
|
101
|
+
annotations: {
|
|
102
|
+
readOnlyHint: true,
|
|
103
|
+
destructiveHint: false,
|
|
104
|
+
idempotentHint: true,
|
|
105
|
+
openWorldHint: true
|
|
106
|
+
},
|
|
107
|
+
handler: async (args) => {
|
|
108
|
+
const parsed = ListToolsSchema.parse(args);
|
|
109
|
+
// Get agent to access tools from conversation config
|
|
110
|
+
const agent = await getRequest(`/convai/agents/${parsed.agent_id}`);
|
|
111
|
+
const tools = agent.conversation_config.agent.prompt.tools || [];
|
|
112
|
+
return {
|
|
113
|
+
content: [
|
|
114
|
+
{
|
|
115
|
+
type: "text",
|
|
116
|
+
text: formatResponse(tools, parsed.response_format, "tool_list")
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Deletes a tool from an agent
|
|
124
|
+
*/
|
|
125
|
+
export const elevenlabs_delete_tool = {
|
|
126
|
+
name: "elevenlabs_delete_tool",
|
|
127
|
+
description: `Remove a webhook tool from an agent.
|
|
128
|
+
|
|
129
|
+
This tool permanently deletes a webhook tool from an agent's configuration. The agent will no longer be able to invoke this tool in conversations. This action cannot be undone.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
- agent_id (string): Agent identifier
|
|
133
|
+
- tool_name (string): Name of the tool to delete
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
Confirmation message indicating successful deletion.
|
|
137
|
+
|
|
138
|
+
Examples:
|
|
139
|
+
- Use when: "Remove the order_status tool from the agent"
|
|
140
|
+
- Use when: "Delete the deprecated webhook tool"
|
|
141
|
+
- Don't use when: You want to modify the tool (delete and recreate instead)
|
|
142
|
+
|
|
143
|
+
Error Handling:
|
|
144
|
+
- Returns "Error: Agent not found" if agent_id doesn't exist
|
|
145
|
+
- Returns "Error: Tool not found" if tool_name doesn't exist`,
|
|
146
|
+
zodSchema: DeleteToolSchema,
|
|
147
|
+
annotations: {
|
|
148
|
+
readOnlyHint: false,
|
|
149
|
+
destructiveHint: true,
|
|
150
|
+
idempotentHint: true,
|
|
151
|
+
openWorldHint: true
|
|
152
|
+
},
|
|
153
|
+
handler: async (args) => {
|
|
154
|
+
const parsed = DeleteToolSchema.parse(args);
|
|
155
|
+
await deleteRequest(`/convai/agents/${parsed.agent_id}/tools/${parsed.tool_name}`);
|
|
156
|
+
return {
|
|
157
|
+
content: [
|
|
158
|
+
{
|
|
159
|
+
type: "text",
|
|
160
|
+
text: `Successfully deleted tool "${parsed.tool_name}" from agent ${parsed.agent_id}`
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=tool-tools.js.map
|
|
@@ -0,0 +1 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