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.
Files changed (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +533 -0
  3. package/dist/constants.d.ts +25 -0
  4. package/dist/constants.d.ts.map +1 -0
  5. package/dist/constants.js +51 -0
  6. package/dist/constants.js.map +1 -0
  7. package/dist/index.d.ts +8 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +93 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/schemas/agent-schemas.d.ts +147 -0
  12. package/dist/schemas/agent-schemas.d.ts.map +1 -0
  13. package/dist/schemas/agent-schemas.js +145 -0
  14. package/dist/schemas/agent-schemas.js.map +1 -0
  15. package/dist/schemas/batch-calling-schemas.d.ts +170 -0
  16. package/dist/schemas/batch-calling-schemas.d.ts.map +1 -0
  17. package/dist/schemas/batch-calling-schemas.js +77 -0
  18. package/dist/schemas/batch-calling-schemas.js.map +1 -0
  19. package/dist/schemas/common-schemas.d.ts +54 -0
  20. package/dist/schemas/common-schemas.d.ts.map +1 -0
  21. package/dist/schemas/common-schemas.js +72 -0
  22. package/dist/schemas/common-schemas.js.map +1 -0
  23. package/dist/schemas/conversation-schemas.d.ts +72 -0
  24. package/dist/schemas/conversation-schemas.d.ts.map +1 -0
  25. package/dist/schemas/conversation-schemas.js +30 -0
  26. package/dist/schemas/conversation-schemas.js.map +1 -0
  27. package/dist/schemas/outbound-schemas.d.ts +115 -0
  28. package/dist/schemas/outbound-schemas.d.ts.map +1 -0
  29. package/dist/schemas/outbound-schemas.js +61 -0
  30. package/dist/schemas/outbound-schemas.js.map +1 -0
  31. package/dist/schemas/phone-number-schemas.d.ts +168 -0
  32. package/dist/schemas/phone-number-schemas.d.ts.map +1 -0
  33. package/dist/schemas/phone-number-schemas.js +116 -0
  34. package/dist/schemas/phone-number-schemas.js.map +1 -0
  35. package/dist/schemas/tool-schemas.d.ts +208 -0
  36. package/dist/schemas/tool-schemas.d.ts.map +1 -0
  37. package/dist/schemas/tool-schemas.js +131 -0
  38. package/dist/schemas/tool-schemas.js.map +1 -0
  39. package/dist/services/elevenlabs-api.d.ts +37 -0
  40. package/dist/services/elevenlabs-api.d.ts.map +1 -0
  41. package/dist/services/elevenlabs-api.js +78 -0
  42. package/dist/services/elevenlabs-api.js.map +1 -0
  43. package/dist/services/formatters.d.ts +76 -0
  44. package/dist/services/formatters.d.ts.map +1 -0
  45. package/dist/services/formatters.js +475 -0
  46. package/dist/services/formatters.js.map +1 -0
  47. package/dist/tools/agent-tools.d.ts +228 -0
  48. package/dist/tools/agent-tools.d.ts.map +1 -0
  49. package/dist/tools/agent-tools.js +369 -0
  50. package/dist/tools/agent-tools.js.map +1 -0
  51. package/dist/tools/batch-calling-tools.d.ts +183 -0
  52. package/dist/tools/batch-calling-tools.d.ts.map +1 -0
  53. package/dist/tools/batch-calling-tools.js +203 -0
  54. package/dist/tools/batch-calling-tools.js.map +1 -0
  55. package/dist/tools/conversation-tools.d.ts +103 -0
  56. package/dist/tools/conversation-tools.d.ts.map +1 -0
  57. package/dist/tools/conversation-tools.js +140 -0
  58. package/dist/tools/conversation-tools.js.map +1 -0
  59. package/dist/tools/knowledge-tools.d.ts +75 -0
  60. package/dist/tools/knowledge-tools.d.ts.map +1 -0
  61. package/dist/tools/knowledge-tools.js +63 -0
  62. package/dist/tools/knowledge-tools.js.map +1 -0
  63. package/dist/tools/outbound-tools.d.ts +44 -0
  64. package/dist/tools/outbound-tools.d.ts.map +1 -0
  65. package/dist/tools/outbound-tools.js +84 -0
  66. package/dist/tools/outbound-tools.js.map +1 -0
  67. package/dist/tools/phone-number-tools.d.ts +215 -0
  68. package/dist/tools/phone-number-tools.d.ts.map +1 -0
  69. package/dist/tools/phone-number-tools.js +295 -0
  70. package/dist/tools/phone-number-tools.js.map +1 -0
  71. package/dist/tools/tool-tools.d.ts +165 -0
  72. package/dist/tools/tool-tools.d.ts.map +1 -0
  73. package/dist/tools/tool-tools.js +166 -0
  74. package/dist/tools/tool-tools.js.map +1 -0
  75. package/dist/tools/utility-tools.d.ts +76 -0
  76. package/dist/tools/utility-tools.d.ts.map +1 -0
  77. package/dist/tools/utility-tools.js +121 -0
  78. package/dist/tools/utility-tools.js.map +1 -0
  79. package/dist/types.d.ts +282 -0
  80. package/dist/types.d.ts.map +1 -0
  81. package/dist/types.js +12 -0
  82. package/dist/types.js.map +1 -0
  83. package/dist/utils/error-handlers.d.ts +29 -0
  84. package/dist/utils/error-handlers.d.ts.map +1 -0
  85. package/dist/utils/error-handlers.js +90 -0
  86. package/dist/utils/error-handlers.js.map +1 -0
  87. package/dist/utils/truncation.d.ts +41 -0
  88. package/dist/utils/truncation.d.ts.map +1 -0
  89. package/dist/utils/truncation.js +78 -0
  90. package/dist/utils/truncation.js.map +1 -0
  91. package/package.json +61 -0
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Zod validation schemas for phone number management operations
3
+ *
4
+ * Provides strict input validation for listing, importing, updating,
5
+ * and deleting phone numbers connected to voice agents.
6
+ */
7
+ import { z } from "zod";
8
+ import { ResponseFormatSchema, AgentIdSchema } from "./common-schemas.js";
9
+ import { PhoneNumberSchema, PhoneNumberIdSchema } from "./outbound-schemas.js";
10
+ /**
11
+ * Phone provider enum
12
+ */
13
+ export const PhoneProviderSchema = z.enum(["twilio", "sip_trunk"], {
14
+ errorMap: () => ({ message: "Provider must be 'twilio' or 'sip_trunk'" })
15
+ }).describe("Phone number provider");
16
+ /**
17
+ * Region ID schema
18
+ */
19
+ export const RegionIdSchema = z.enum(["us1", "ie1", "au1"], {
20
+ errorMap: () => ({ message: "Region must be 'us1', 'ie1', or 'au1'" })
21
+ }).describe("ElevenLabs region identifier");
22
+ /**
23
+ * Edge location schema
24
+ */
25
+ export const EdgeLocationSchema = z.enum([
26
+ "ashburn", "dublin", "frankfurt", "sao-paulo",
27
+ "singapore", "sydney", "tokyo", "umatilla", "roaming"
28
+ ], {
29
+ errorMap: () => ({ message: "Invalid edge location" })
30
+ }).describe("Twilio edge location");
31
+ /**
32
+ * LiveKit stack schema
33
+ */
34
+ export const LiveKitStackSchema = z.enum(["standard", "static"], {
35
+ errorMap: () => ({ message: "LiveKit stack must be 'standard' or 'static'" })
36
+ }).describe("LiveKit stack configuration");
37
+ /**
38
+ * Region config schema for Twilio
39
+ */
40
+ export const RegionConfigSchema = z.object({
41
+ region_id: RegionIdSchema,
42
+ token: z.string().min(1, "Region token is required"),
43
+ edge_location: EdgeLocationSchema
44
+ }).describe("Regional configuration for Twilio phone numbers");
45
+ /**
46
+ * Schema for listing phone numbers
47
+ */
48
+ export const ListPhoneNumbersSchema = z.object({
49
+ response_format: ResponseFormatSchema
50
+ }).passthrough();
51
+ /**
52
+ * Schema for getting a phone number
53
+ */
54
+ export const GetPhoneNumberSchema = z.object({
55
+ phone_number_id: PhoneNumberIdSchema,
56
+ response_format: ResponseFormatSchema
57
+ }).passthrough();
58
+ /**
59
+ * Schema for importing a Twilio phone number
60
+ */
61
+ export const ImportPhoneNumberSchema = z.object({
62
+ phone_number: PhoneNumberSchema
63
+ .describe("Phone number to import from Twilio"),
64
+ label: z.string()
65
+ .min(1, "Label is required")
66
+ .max(100, "Label must not exceed 100 characters")
67
+ .describe("Descriptive label for this phone number"),
68
+ sid: z.string()
69
+ .min(1, "Twilio Account SID is required")
70
+ .describe("Twilio Account SID"),
71
+ token: z.string()
72
+ .min(1, "Twilio Auth Token is required")
73
+ .describe("Twilio Auth Token"),
74
+ provider: z.literal("twilio")
75
+ .describe("Must be 'twilio' for Twilio phone numbers"),
76
+ supports_inbound: z.boolean()
77
+ .default(true)
78
+ .describe("Enable inbound call handling"),
79
+ supports_outbound: z.boolean()
80
+ .default(true)
81
+ .describe("Enable outbound call capability"),
82
+ region_config: RegionConfigSchema
83
+ .optional()
84
+ .describe("Optional regional configuration for Twilio"),
85
+ response_format: ResponseFormatSchema
86
+ }).passthrough();
87
+ /**
88
+ * Schema for updating a phone number
89
+ */
90
+ export const UpdatePhoneNumberSchema = z.object({
91
+ phone_number_id: PhoneNumberIdSchema,
92
+ agent_id: AgentIdSchema
93
+ .optional()
94
+ .nullable()
95
+ .describe("Assign or unassign agent (null to unassign)"),
96
+ inbound_trunk_config: z.record(z.any())
97
+ .optional()
98
+ .nullable()
99
+ .describe("SIP trunk configuration for inbound calls"),
100
+ outbound_trunk_config: z.record(z.any())
101
+ .optional()
102
+ .nullable()
103
+ .describe("SIP trunk configuration for outbound calls"),
104
+ livekit_stack: LiveKitStackSchema
105
+ .optional()
106
+ .nullable()
107
+ .describe("LiveKit stack configuration"),
108
+ response_format: ResponseFormatSchema
109
+ }).passthrough();
110
+ /**
111
+ * Schema for deleting a phone number
112
+ */
113
+ export const DeletePhoneNumberSchema = z.object({
114
+ phone_number_id: PhoneNumberIdSchema
115
+ }).passthrough();
116
+ //# sourceMappingURL=phone-number-schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phone-number-schemas.js","sourceRoot":"","sources":["../../src/schemas/phone-number-schemas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE;IACjE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,0CAA0C,EAAE,CAAC;CAC1E,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE;IAC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CAAC,6CAA6C,CAAC;IAE1D,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;SACpC,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CAAC,2CAA2C,CAAC;IAExD,qBAAqB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;SACrC,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CAAC,4CAA4C,CAAC;IAEzD,aAAa,EAAE,kBAAkB;SAC9B,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CAAC,6BAA6B,CAAC;IAE1C,eAAe,EAAE,oBAAoB;CACtC,CAAC,CAAC,WAAW,EAAE,CAAC;AAEjB;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,eAAe,EAAE,mBAAmB;CACrC,CAAC,CAAC,WAAW,EAAE,CAAC"}
@@ -0,0 +1,208 @@
1
+ /**
2
+ * Zod validation schemas for tool and knowledge base operations
3
+ *
4
+ * Provides strict input validation for managing agent tools and knowledge bases.
5
+ */
6
+ import { z } from "zod";
7
+ /**
8
+ * Schema for creating a webhook tool
9
+ */
10
+ export declare const CreateWebhookToolSchema: z.ZodObject<{
11
+ agent_id: z.ZodString;
12
+ name: z.ZodString;
13
+ description: z.ZodString;
14
+ url: z.ZodString;
15
+ method: z.ZodDefault<z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>>;
16
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
17
+ parameters: z.ZodArray<z.ZodObject<{
18
+ name: z.ZodString;
19
+ type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
20
+ description: z.ZodString;
21
+ required: z.ZodBoolean;
22
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
23
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
24
+ name: z.ZodString;
25
+ type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
26
+ description: z.ZodString;
27
+ required: z.ZodBoolean;
28
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
29
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
30
+ name: z.ZodString;
31
+ type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
32
+ description: z.ZodString;
33
+ required: z.ZodBoolean;
34
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
35
+ }, z.ZodTypeAny, "passthrough">>, "many">;
36
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
37
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
38
+ agent_id: z.ZodString;
39
+ name: z.ZodString;
40
+ description: z.ZodString;
41
+ url: z.ZodString;
42
+ method: z.ZodDefault<z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>>;
43
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
44
+ parameters: z.ZodArray<z.ZodObject<{
45
+ name: z.ZodString;
46
+ type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
47
+ description: z.ZodString;
48
+ required: z.ZodBoolean;
49
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
50
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
51
+ name: z.ZodString;
52
+ type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
53
+ description: z.ZodString;
54
+ required: z.ZodBoolean;
55
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
56
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
57
+ name: z.ZodString;
58
+ type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
59
+ description: z.ZodString;
60
+ required: z.ZodBoolean;
61
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
62
+ }, z.ZodTypeAny, "passthrough">>, "many">;
63
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
64
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
65
+ agent_id: z.ZodString;
66
+ name: z.ZodString;
67
+ description: z.ZodString;
68
+ url: z.ZodString;
69
+ method: z.ZodDefault<z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE"]>>;
70
+ headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
71
+ parameters: z.ZodArray<z.ZodObject<{
72
+ name: z.ZodString;
73
+ type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
74
+ description: z.ZodString;
75
+ required: z.ZodBoolean;
76
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
77
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
78
+ name: z.ZodString;
79
+ type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
80
+ description: z.ZodString;
81
+ required: z.ZodBoolean;
82
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
83
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
84
+ name: z.ZodString;
85
+ type: z.ZodEnum<["string", "number", "boolean", "object", "array"]>;
86
+ description: z.ZodString;
87
+ required: z.ZodBoolean;
88
+ enum: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
89
+ }, z.ZodTypeAny, "passthrough">>, "many">;
90
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
91
+ }, z.ZodTypeAny, "passthrough">>;
92
+ /**
93
+ * Schema for listing tools
94
+ */
95
+ export declare const ListToolsSchema: z.ZodObject<{
96
+ agent_id: z.ZodString;
97
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
98
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
99
+ agent_id: z.ZodString;
100
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
101
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
102
+ agent_id: z.ZodString;
103
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
104
+ }, z.ZodTypeAny, "passthrough">>;
105
+ /**
106
+ * Schema for deleting a tool
107
+ */
108
+ export declare const DeleteToolSchema: z.ZodObject<{
109
+ agent_id: z.ZodString;
110
+ tool_name: z.ZodString;
111
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
112
+ agent_id: z.ZodString;
113
+ tool_name: z.ZodString;
114
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
115
+ agent_id: z.ZodString;
116
+ tool_name: z.ZodString;
117
+ }, z.ZodTypeAny, "passthrough">>;
118
+ /**
119
+ * Schema for adding knowledge base documents
120
+ */
121
+ export declare const AddKnowledgeBaseSchema: z.ZodObject<{
122
+ agent_id: z.ZodString;
123
+ documents: z.ZodArray<z.ZodObject<{
124
+ type: z.ZodEnum<["text", "url"]>;
125
+ content: z.ZodString;
126
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
127
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
128
+ type: z.ZodEnum<["text", "url"]>;
129
+ content: z.ZodString;
130
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
131
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
132
+ type: z.ZodEnum<["text", "url"]>;
133
+ content: z.ZodString;
134
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
135
+ }, z.ZodTypeAny, "passthrough">>, "many">;
136
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
137
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
138
+ agent_id: z.ZodString;
139
+ documents: z.ZodArray<z.ZodObject<{
140
+ type: z.ZodEnum<["text", "url"]>;
141
+ content: z.ZodString;
142
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
143
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
144
+ type: z.ZodEnum<["text", "url"]>;
145
+ content: z.ZodString;
146
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
147
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
148
+ type: z.ZodEnum<["text", "url"]>;
149
+ content: z.ZodString;
150
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
151
+ }, z.ZodTypeAny, "passthrough">>, "many">;
152
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
153
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
154
+ agent_id: z.ZodString;
155
+ documents: z.ZodArray<z.ZodObject<{
156
+ type: z.ZodEnum<["text", "url"]>;
157
+ content: z.ZodString;
158
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
159
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
160
+ type: z.ZodEnum<["text", "url"]>;
161
+ content: z.ZodString;
162
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
163
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
164
+ type: z.ZodEnum<["text", "url"]>;
165
+ content: z.ZodString;
166
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
167
+ }, z.ZodTypeAny, "passthrough">>, "many">;
168
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
169
+ }, z.ZodTypeAny, "passthrough">>;
170
+ /**
171
+ * Schema for generating widget code
172
+ */
173
+ export declare const GenerateWidgetCodeSchema: z.ZodObject<{
174
+ agent_id: z.ZodString;
175
+ color: z.ZodOptional<z.ZodString>;
176
+ avatar_url: z.ZodOptional<z.ZodString>;
177
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
178
+ agent_id: z.ZodString;
179
+ color: z.ZodOptional<z.ZodString>;
180
+ avatar_url: z.ZodOptional<z.ZodString>;
181
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
182
+ agent_id: z.ZodString;
183
+ color: z.ZodOptional<z.ZodString>;
184
+ avatar_url: z.ZodOptional<z.ZodString>;
185
+ }, z.ZodTypeAny, "passthrough">>;
186
+ /**
187
+ * Schema for listing voices
188
+ */
189
+ export declare const ListVoicesSchema: z.ZodObject<{
190
+ language: z.ZodOptional<z.ZodString>;
191
+ gender: z.ZodOptional<z.ZodEnum<["male", "female"]>>;
192
+ age: z.ZodOptional<z.ZodEnum<["young", "middle_aged", "old"]>>;
193
+ limit: z.ZodDefault<z.ZodNumber>;
194
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
195
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
196
+ language: z.ZodOptional<z.ZodString>;
197
+ gender: z.ZodOptional<z.ZodEnum<["male", "female"]>>;
198
+ age: z.ZodOptional<z.ZodEnum<["young", "middle_aged", "old"]>>;
199
+ limit: z.ZodDefault<z.ZodNumber>;
200
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
201
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
202
+ language: z.ZodOptional<z.ZodString>;
203
+ gender: z.ZodOptional<z.ZodEnum<["male", "female"]>>;
204
+ age: z.ZodOptional<z.ZodEnum<["young", "middle_aged", "old"]>>;
205
+ limit: z.ZodDefault<z.ZodNumber>;
206
+ response_format: z.ZodDefault<z.ZodNativeEnum<typeof import("../types.js").ResponseFormat>>;
207
+ }, z.ZodTypeAny, "passthrough">>;
208
+ //# sourceMappingURL=tool-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/tool-schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2BxB;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAgCpB,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;gCAGZ,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;gCAMb,CAAC;AAmBjB;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCASnB,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;gCAWrB,CAAC;AAEjB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;gCAqBb,CAAC"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Zod validation schemas for tool and knowledge base operations
3
+ *
4
+ * Provides strict input validation for managing agent tools and knowledge bases.
5
+ */
6
+ import { z } from "zod";
7
+ import { AgentIdSchema, ResponseFormatSchema, URLSchema } from "./common-schemas.js";
8
+ /**
9
+ * Tool parameter schema
10
+ */
11
+ const ToolParameterSchema = z.object({
12
+ name: z.string()
13
+ .min(1, "Parameter name is required")
14
+ .describe("Name of the parameter"),
15
+ type: z.enum(["string", "number", "boolean", "object", "array"], {
16
+ errorMap: () => ({ message: "Type must be: string, number, boolean, object, or array" })
17
+ }).describe("Data type of the parameter"),
18
+ description: z.string()
19
+ .min(1, "Parameter description is required")
20
+ .describe("Description of what this parameter does"),
21
+ required: z.boolean()
22
+ .describe("Whether this parameter is required"),
23
+ enum: z.array(z.string())
24
+ .optional()
25
+ .describe("Optional array of allowed values for this parameter")
26
+ }).passthrough();
27
+ /**
28
+ * Schema for creating a webhook tool
29
+ */
30
+ export const CreateWebhookToolSchema = z.object({
31
+ agent_id: AgentIdSchema,
32
+ name: z.string()
33
+ .min(1, "Tool name is required")
34
+ .max(64, "Tool name must not exceed 64 characters")
35
+ .regex(/^[a-zA-Z0-9_-]+$/, "Tool name must contain only alphanumeric characters, hyphens, and underscores")
36
+ .describe("Unique name for the tool (e.g., 'check_order_status')"),
37
+ description: z.string()
38
+ .min(10, "Description must be at least 10 characters")
39
+ .max(500, "Description must not exceed 500 characters")
40
+ .describe("Clear description of what this tool does"),
41
+ url: URLSchema
42
+ .describe("Webhook URL that will be called when the tool is invoked"),
43
+ method: z.enum(["GET", "POST", "PUT", "PATCH", "DELETE"], {
44
+ errorMap: () => ({ message: "Method must be: GET, POST, PUT, PATCH, or DELETE" })
45
+ })
46
+ .default("POST")
47
+ .describe("HTTP method to use (default: POST)"),
48
+ headers: z.record(z.string(), z.string())
49
+ .optional()
50
+ .describe("Optional custom headers to send with the request"),
51
+ parameters: z.array(ToolParameterSchema)
52
+ .min(0, "Parameters array is required (can be empty)")
53
+ .describe("Array of parameters the tool accepts"),
54
+ response_format: ResponseFormatSchema
55
+ }).passthrough();
56
+ /**
57
+ * Schema for listing tools
58
+ */
59
+ export const ListToolsSchema = z.object({
60
+ agent_id: AgentIdSchema,
61
+ response_format: ResponseFormatSchema
62
+ }).passthrough();
63
+ /**
64
+ * Schema for deleting a tool
65
+ */
66
+ export const DeleteToolSchema = z.object({
67
+ agent_id: AgentIdSchema,
68
+ tool_name: z.string()
69
+ .min(1, "Tool name is required")
70
+ .describe("Name of the tool to delete")
71
+ }).passthrough();
72
+ /**
73
+ * Knowledge base document schema
74
+ */
75
+ const KnowledgeBaseDocumentSchema = z.object({
76
+ type: z.enum(["text", "url"], {
77
+ errorMap: () => ({ message: "Document type must be 'text' or 'url'" })
78
+ }).describe("Type of document to add"),
79
+ content: z.string()
80
+ .min(1, "Document content is required")
81
+ .describe("For 'text' type: the actual text content. For 'url' type: the URL to fetch"),
82
+ metadata: z.record(z.string(), z.string())
83
+ .optional()
84
+ .describe("Optional metadata about the document")
85
+ }).passthrough();
86
+ /**
87
+ * Schema for adding knowledge base documents
88
+ */
89
+ export const AddKnowledgeBaseSchema = z.object({
90
+ agent_id: AgentIdSchema,
91
+ documents: z.array(KnowledgeBaseDocumentSchema)
92
+ .min(1, "At least one document is required")
93
+ .max(100, "Cannot add more than 100 documents at once")
94
+ .describe("Array of documents to add to the agent's knowledge base"),
95
+ response_format: ResponseFormatSchema
96
+ }).passthrough();
97
+ /**
98
+ * Schema for generating widget code
99
+ */
100
+ export const GenerateWidgetCodeSchema = z.object({
101
+ agent_id: AgentIdSchema,
102
+ color: z.string()
103
+ .regex(/^#[0-9A-Fa-f]{6}$/, "Must be a valid hex color (e.g., #FF5733)")
104
+ .optional()
105
+ .describe("Optional widget color (hex format)"),
106
+ avatar_url: URLSchema
107
+ .optional()
108
+ .describe("Optional avatar image URL for the widget")
109
+ }).passthrough();
110
+ /**
111
+ * Schema for listing voices
112
+ */
113
+ export const ListVoicesSchema = z.object({
114
+ language: z.string()
115
+ .optional()
116
+ .describe("Filter by language code (e.g., 'en', 'es')"),
117
+ gender: z.enum(["male", "female"])
118
+ .optional()
119
+ .describe("Filter by gender"),
120
+ age: z.enum(["young", "middle_aged", "old"])
121
+ .optional()
122
+ .describe("Filter by age category"),
123
+ limit: z.number()
124
+ .int()
125
+ .min(1)
126
+ .max(100)
127
+ .default(20)
128
+ .describe("Maximum number of voices to return"),
129
+ response_format: ResponseFormatSchema
130
+ }).passthrough();
131
+ //# sourceMappingURL=tool-schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-schemas.js","sourceRoot":"","sources":["../../src/schemas/tool-schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErF;;GAEG;AACH,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;SACb,GAAG,CAAC,CAAC,EAAE,4BAA4B,CAAC;SACpC,QAAQ,CAAC,u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AC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;SAC/B,QAAQ,EAAE;SACV,QAAQ,CAAC,kBAAkB,CAAC;IAE/B,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;SACzC,QAAQ,EAAE;SACV,QAAQ,CAAC,wBAAwB,CAAC;IAErC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;SACd,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,GAAG,CAAC;SACR,OAAO,CAAC,EAAE,CAAC;SACX,QAAQ,CAAC,oCAAoC,CAAC;IAEjD,eAAe,EAAE,oBAAoB;CACtC,CAAC,CAAC,WAAW,EAAE,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * ElevenLabs API client service
3
+ *
4
+ * Provides core HTTP request functionality for interacting with the
5
+ * ElevenLabs Voice Agent API, including authentication and error handling.
6
+ */
7
+ /**
8
+ * Makes an authenticated request to the ElevenLabs API
9
+ *
10
+ * @param method - HTTP method (GET, POST, PUT, DELETE, etc.)
11
+ * @param endpoint - API endpoint path (e.g., "/convai/agents")
12
+ * @param data - Request body data (for POST, PUT, PATCH)
13
+ * @param params - URL query parameters
14
+ * @returns Response data from the API
15
+ */
16
+ export declare function makeElevenLabsRequest<T = unknown>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", endpoint: string, data?: unknown, params?: Record<string, unknown>): Promise<T>;
17
+ /**
18
+ * GET request helper
19
+ */
20
+ export declare function getRequest<T>(endpoint: string, params?: Record<string, unknown>): Promise<T>;
21
+ /**
22
+ * POST request helper
23
+ */
24
+ export declare function postRequest<T>(endpoint: string, data: unknown, params?: Record<string, unknown>): Promise<T>;
25
+ /**
26
+ * PUT request helper
27
+ */
28
+ export declare function putRequest<T>(endpoint: string, data: unknown, params?: Record<string, unknown>): Promise<T>;
29
+ /**
30
+ * PATCH request helper
31
+ */
32
+ export declare function patchRequest<T>(endpoint: string, data: unknown, params?: Record<string, unknown>): Promise<T>;
33
+ /**
34
+ * DELETE request helper
35
+ */
36
+ export declare function deleteRequest<T>(endpoint: string, params?: Record<string, unknown>): Promise<T>;
37
+ //# sourceMappingURL=elevenlabs-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elevenlabs-api.d.ts","sourceRoot":"","sources":["../../src/services/elevenlabs-api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,GAAG,OAAO,EACrD,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,EACnD,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAkCZ;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,CAAC,EACjC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED;;GAEG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,EACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,CAAC,EACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,CAAC,CAAC,CAEZ"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * ElevenLabs API client service
3
+ *
4
+ * Provides core HTTP request functionality for interacting with the
5
+ * ElevenLabs Voice Agent API, including authentication and error handling.
6
+ */
7
+ import axios from "axios";
8
+ import { API_BASE_URL, REQUEST_TIMEOUT } from "../constants.js";
9
+ import { handleElevenLabsError } from "../utils/error-handlers.js";
10
+ /**
11
+ * Makes an authenticated request to the ElevenLabs API
12
+ *
13
+ * @param method - HTTP method (GET, POST, PUT, DELETE, etc.)
14
+ * @param endpoint - API endpoint path (e.g., "/convai/agents")
15
+ * @param data - Request body data (for POST, PUT, PATCH)
16
+ * @param params - URL query parameters
17
+ * @returns Response data from the API
18
+ */
19
+ export async function makeElevenLabsRequest(method, endpoint, data, params) {
20
+ const apiKey = process.env.ELEVENLABS_API_KEY;
21
+ if (!apiKey) {
22
+ throw new Error("ELEVENLABS_API_KEY environment variable is not set. " +
23
+ "Please set it to your ElevenLabs API key.");
24
+ }
25
+ const config = {
26
+ method,
27
+ url: `${API_BASE_URL}${endpoint}`,
28
+ headers: {
29
+ "xi-api-key": apiKey,
30
+ "Content-Type": "application/json",
31
+ },
32
+ timeout: REQUEST_TIMEOUT,
33
+ };
34
+ if (data) {
35
+ config.data = data;
36
+ }
37
+ if (params) {
38
+ config.params = params;
39
+ }
40
+ try {
41
+ const response = await axios(config);
42
+ return response.data;
43
+ }
44
+ catch (error) {
45
+ throw new Error(handleElevenLabsError(error));
46
+ }
47
+ }
48
+ /**
49
+ * GET request helper
50
+ */
51
+ export async function getRequest(endpoint, params) {
52
+ return makeElevenLabsRequest("GET", endpoint, undefined, params);
53
+ }
54
+ /**
55
+ * POST request helper
56
+ */
57
+ export async function postRequest(endpoint, data, params) {
58
+ return makeElevenLabsRequest("POST", endpoint, data, params);
59
+ }
60
+ /**
61
+ * PUT request helper
62
+ */
63
+ export async function putRequest(endpoint, data, params) {
64
+ return makeElevenLabsRequest("PUT", endpoint, data, params);
65
+ }
66
+ /**
67
+ * PATCH request helper
68
+ */
69
+ export async function patchRequest(endpoint, data, params) {
70
+ return makeElevenLabsRequest("PATCH", endpoint, data, params);
71
+ }
72
+ /**
73
+ * DELETE request helper
74
+ */
75
+ export async function deleteRequest(endpoint, params) {
76
+ return makeElevenLabsRequest("DELETE", endpoint, undefined, params);
77
+ }
78
+ //# sourceMappingURL=elevenlabs-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elevenlabs-api.js","sourceRoot":"","sources":["../../src/services/elevenlabs-api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA4C,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAmD,EACnD,QAAgB,EAChB,IAAc,EACd,MAAgC;IAEhC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAE9C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,sDAAsD;YACtD,2CAA2C,CAC5C,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAuB;QACjC,MAAM;QACN,GAAG,EAAE,GAAG,YAAY,GAAG,QAAQ,EAAE;QACjC,OAAO,EAAE;YACP,YAAY,EAAE,MAAM;YACpB,cAAc,EAAE,kBAAkB;SACnC;QACD,OAAO,EAAE,e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