@vapi-ai/mcp-server 0.0.4 → 0.0.6
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 +39 -2
- package/dist/schemas/index.d.ts +154 -8
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +73 -6
- package/dist/tools/assistant.d.ts.map +1 -1
- package/dist/tools/assistant.js +21 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +2 -0
- package/dist/tools/tool.d.ts +4 -0
- package/dist/tools/tool.d.ts.map +1 -0
- package/dist/tools/tool.js +13 -0
- package/dist/transformers/index.d.ts +3 -1
- package/dist/transformers/index.d.ts.map +1 -1
- package/dist/transformers/index.js +75 -1
- package/dist/utils/response.js +2 -2
- package/package.json +4 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Vapi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
# Vapi MCP Server
|
|
2
2
|
|
|
3
|
+
[](https://smithery.ai/server/@VapiAI/vapi-mcp-server)
|
|
4
|
+
|
|
3
5
|
The Vapi [Model Context Protocol](https://modelcontextprotocol.com/) server allows you to integrate with Vapi APIs through function calling.
|
|
4
6
|
|
|
7
|
+
<a href="https://glama.ai/mcp/servers/@VapiAI/mcp-server">
|
|
8
|
+
<img width="380" height="200" src="https://glama.ai/mcp/servers/@VapiAI/mcp-server/badge" alt="Vapi Server MCP server" />
|
|
9
|
+
</a>
|
|
10
|
+
|
|
5
11
|
## Claude Desktop Setup
|
|
6
12
|
|
|
7
13
|
1. Open `Claude Desktop` and press `CMD + ,` to go to `Settings`.
|
|
@@ -35,10 +41,18 @@ The Vapi [Model Context Protocol](https://modelcontextprotocol.com/) server allo
|
|
|
35
41
|
1. Create or import a phone number using the Vapi dashboard (<https://dashboard.vapi.ai/phone-numbers>).
|
|
36
42
|
2. Create a new assistant using the existing 'Appointment Scheduler' template in the Vapi dashboard (<https://dashboard.vapi.ai/assistants>).
|
|
37
43
|
3. Make sure to configure Claude Desktop to use the Vapi MCP server and restart the Claude Desktop app.
|
|
38
|
-
4. Ask Claude
|
|
44
|
+
4. Ask Claude to initiate or schedule a call. See examples below:
|
|
45
|
+
|
|
46
|
+
**Example 1:** Request an immediate call
|
|
47
|
+
|
|
48
|
+
```md
|
|
49
|
+
I'd like to speak with my ShopHelper assistant to talk about my recent order. Can you have it call me at +1234567890?
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Example 2:** Schedule a future call
|
|
39
53
|
|
|
40
54
|
```md
|
|
41
|
-
I
|
|
55
|
+
I need to schedule a call with Mary assistant for next Tuesday at 3:00 PM. My phone number is +1555123456.
|
|
42
56
|
```
|
|
43
57
|
|
|
44
58
|
## Remote SSE Connection
|
|
@@ -120,3 +134,26 @@ npm test
|
|
|
120
134
|
- [VAPI MCP Tool](https://docs.vapi.ai/tools/mcp)
|
|
121
135
|
- [Model Context Protocol](https://modelcontextprotocol.com/)
|
|
122
136
|
- [Claude Desktop](https://modelcontextprotocol.io/quickstart/user)
|
|
137
|
+
|
|
138
|
+
## Supported Actions
|
|
139
|
+
|
|
140
|
+
The Vapi MCP Server provides the following tools for integration:
|
|
141
|
+
|
|
142
|
+
### Assistant Tools
|
|
143
|
+
|
|
144
|
+
- `list_assistants`: Lists all Vapi assistants
|
|
145
|
+
- `create_assistant`: Creates a new Vapi assistant
|
|
146
|
+
- `get_assistant`: Gets a Vapi assistant by ID
|
|
147
|
+
|
|
148
|
+
### Call Tools
|
|
149
|
+
|
|
150
|
+
- `list_calls`: Lists all Vapi calls
|
|
151
|
+
- `create_call`: Creates an outbound call
|
|
152
|
+
- `get_call`: Gets details of a specific call
|
|
153
|
+
|
|
154
|
+
> **Note:** The `create_call` action supports scheduling calls for immediate execution or for a future time.
|
|
155
|
+
|
|
156
|
+
### Phone Number Tools
|
|
157
|
+
|
|
158
|
+
- `list_phone_numbers`: Lists all Vapi phone numbers
|
|
159
|
+
- `get_phone_number`: Gets details of a specific phone number
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ export declare const CreateAssistantInputSchema: z.ZodObject<{
|
|
|
96
96
|
provider: string;
|
|
97
97
|
model: string;
|
|
98
98
|
}>]>, z.ZodEffects<z.ZodString, any, string>]>>;
|
|
99
|
+
toolIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
99
100
|
transcriber: z.ZodDefault<z.ZodObject<{
|
|
100
101
|
provider: z.ZodString;
|
|
101
102
|
model: z.ZodString;
|
|
@@ -135,6 +136,7 @@ export declare const CreateAssistantInputSchema: z.ZodObject<{
|
|
|
135
136
|
};
|
|
136
137
|
firstMessage: string;
|
|
137
138
|
llm?: any;
|
|
139
|
+
toolIds?: string[] | undefined;
|
|
138
140
|
firstMessageMode?: "assistant-speaks-first" | "assistant-waits-for-user" | "assistant-speaks-first-with-model-generated-message" | undefined;
|
|
139
141
|
}, {
|
|
140
142
|
name: string;
|
|
@@ -152,6 +154,7 @@ export declare const CreateAssistantInputSchema: z.ZodObject<{
|
|
|
152
154
|
provider: string;
|
|
153
155
|
model: string;
|
|
154
156
|
} | undefined;
|
|
157
|
+
toolIds?: string[] | undefined;
|
|
155
158
|
transcriber?: {
|
|
156
159
|
provider: string;
|
|
157
160
|
model: string;
|
|
@@ -203,6 +206,7 @@ export declare const AssistantOutputSchema: z.ZodObject<z.objectUtil.extendShape
|
|
|
203
206
|
provider: string;
|
|
204
207
|
model: string;
|
|
205
208
|
}>;
|
|
209
|
+
toolIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
206
210
|
}>, "strip", z.ZodTypeAny, {
|
|
207
211
|
id: string;
|
|
208
212
|
createdAt: string;
|
|
@@ -221,6 +225,7 @@ export declare const AssistantOutputSchema: z.ZodObject<z.objectUtil.extendShape
|
|
|
221
225
|
voiceId: string;
|
|
222
226
|
model?: string | undefined;
|
|
223
227
|
};
|
|
228
|
+
toolIds?: string[] | undefined;
|
|
224
229
|
}, {
|
|
225
230
|
id: string;
|
|
226
231
|
createdAt: string;
|
|
@@ -239,6 +244,7 @@ export declare const AssistantOutputSchema: z.ZodObject<z.objectUtil.extendShape
|
|
|
239
244
|
voiceId: string;
|
|
240
245
|
model?: string | undefined;
|
|
241
246
|
};
|
|
247
|
+
toolIds?: string[] | undefined;
|
|
242
248
|
}>;
|
|
243
249
|
export declare const GetAssistantInputSchema: z.ZodObject<{
|
|
244
250
|
assistantId: z.ZodString;
|
|
@@ -247,6 +253,120 @@ export declare const GetAssistantInputSchema: z.ZodObject<{
|
|
|
247
253
|
}, {
|
|
248
254
|
assistantId: string;
|
|
249
255
|
}>;
|
|
256
|
+
export declare const UpdateAssistantInputSchema: z.ZodObject<{
|
|
257
|
+
assistantId: z.ZodString;
|
|
258
|
+
name: z.ZodOptional<z.ZodString>;
|
|
259
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
260
|
+
llm: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
|
|
261
|
+
provider: z.ZodLiteral<"openai">;
|
|
262
|
+
model: z.ZodEnum<["gpt-4o", "gpt-4o-mini"]>;
|
|
263
|
+
}, "strip", z.ZodTypeAny, {
|
|
264
|
+
provider: "openai";
|
|
265
|
+
model: "gpt-4o" | "gpt-4o-mini";
|
|
266
|
+
}, {
|
|
267
|
+
provider: "openai";
|
|
268
|
+
model: "gpt-4o" | "gpt-4o-mini";
|
|
269
|
+
}>, z.ZodObject<{
|
|
270
|
+
provider: z.ZodLiteral<"anthropic">;
|
|
271
|
+
model: z.ZodEnum<["claude-3-7-sonnet-20250219", "claude-3-5-haiku-20241022"]>;
|
|
272
|
+
}, "strip", z.ZodTypeAny, {
|
|
273
|
+
provider: "anthropic";
|
|
274
|
+
model: "claude-3-7-sonnet-20250219" | "claude-3-5-haiku-20241022";
|
|
275
|
+
}, {
|
|
276
|
+
provider: "anthropic";
|
|
277
|
+
model: "claude-3-7-sonnet-20250219" | "claude-3-5-haiku-20241022";
|
|
278
|
+
}>, z.ZodObject<{
|
|
279
|
+
provider: z.ZodLiteral<"google">;
|
|
280
|
+
model: z.ZodEnum<["gemini-1.5-pro", "gemini-1.5-flash", "gemini-2.0-flash", "gemini-2.0-pro"]>;
|
|
281
|
+
}, "strip", z.ZodTypeAny, {
|
|
282
|
+
provider: "google";
|
|
283
|
+
model: "gemini-1.5-pro" | "gemini-1.5-flash" | "gemini-2.0-flash" | "gemini-2.0-pro";
|
|
284
|
+
}, {
|
|
285
|
+
provider: "google";
|
|
286
|
+
model: "gemini-1.5-pro" | "gemini-1.5-flash" | "gemini-2.0-flash" | "gemini-2.0-pro";
|
|
287
|
+
}>, z.ZodObject<{
|
|
288
|
+
provider: z.ZodString;
|
|
289
|
+
model: z.ZodString;
|
|
290
|
+
}, "strip", z.ZodTypeAny, {
|
|
291
|
+
provider: string;
|
|
292
|
+
model: string;
|
|
293
|
+
}, {
|
|
294
|
+
provider: string;
|
|
295
|
+
model: string;
|
|
296
|
+
}>]>, z.ZodEffects<z.ZodString, any, string>]>>;
|
|
297
|
+
toolIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
298
|
+
transcriber: z.ZodOptional<z.ZodObject<{
|
|
299
|
+
provider: z.ZodString;
|
|
300
|
+
model: z.ZodString;
|
|
301
|
+
}, "strip", z.ZodTypeAny, {
|
|
302
|
+
provider: string;
|
|
303
|
+
model: string;
|
|
304
|
+
}, {
|
|
305
|
+
provider: string;
|
|
306
|
+
model: string;
|
|
307
|
+
}>>;
|
|
308
|
+
voice: z.ZodOptional<z.ZodObject<{
|
|
309
|
+
provider: z.ZodEnum<["vapi", "11labs", "azure", "cartesia", "custom-voice", "deepgram", "11labs", "hume", "lmnt", "neuphonic", "openai", "playht", "rime-ai", "smallest-ai", "tavus", "sesame"]>;
|
|
310
|
+
voiceId: z.ZodString;
|
|
311
|
+
model: z.ZodOptional<z.ZodString>;
|
|
312
|
+
}, "strip", z.ZodTypeAny, {
|
|
313
|
+
provider: "openai" | "vapi" | "11labs" | "azure" | "cartesia" | "custom-voice" | "deepgram" | "hume" | "lmnt" | "neuphonic" | "playht" | "rime-ai" | "smallest-ai" | "tavus" | "sesame";
|
|
314
|
+
voiceId: string;
|
|
315
|
+
model?: string | undefined;
|
|
316
|
+
}, {
|
|
317
|
+
provider: "openai" | "vapi" | "11labs" | "azure" | "cartesia" | "custom-voice" | "deepgram" | "hume" | "lmnt" | "neuphonic" | "playht" | "rime-ai" | "smallest-ai" | "tavus" | "sesame";
|
|
318
|
+
voiceId: string;
|
|
319
|
+
model?: string | undefined;
|
|
320
|
+
}>>;
|
|
321
|
+
firstMessage: z.ZodOptional<z.ZodString>;
|
|
322
|
+
firstMessageMode: z.ZodOptional<z.ZodEnum<["assistant-speaks-first", "assistant-waits-for-user", "assistant-speaks-first-with-model-generated-message"]>>;
|
|
323
|
+
}, "strip", z.ZodTypeAny, {
|
|
324
|
+
assistantId: string;
|
|
325
|
+
name?: string | undefined;
|
|
326
|
+
instructions?: string | undefined;
|
|
327
|
+
llm?: any;
|
|
328
|
+
toolIds?: string[] | undefined;
|
|
329
|
+
transcriber?: {
|
|
330
|
+
provider: string;
|
|
331
|
+
model: string;
|
|
332
|
+
} | undefined;
|
|
333
|
+
voice?: {
|
|
334
|
+
provider: "openai" | "vapi" | "11labs" | "azure" | "cartesia" | "custom-voice" | "deepgram" | "hume" | "lmnt" | "neuphonic" | "playht" | "rime-ai" | "smallest-ai" | "tavus" | "sesame";
|
|
335
|
+
voiceId: string;
|
|
336
|
+
model?: string | undefined;
|
|
337
|
+
} | undefined;
|
|
338
|
+
firstMessage?: string | undefined;
|
|
339
|
+
firstMessageMode?: "assistant-speaks-first" | "assistant-waits-for-user" | "assistant-speaks-first-with-model-generated-message" | undefined;
|
|
340
|
+
}, {
|
|
341
|
+
assistantId: string;
|
|
342
|
+
name?: string | undefined;
|
|
343
|
+
instructions?: string | undefined;
|
|
344
|
+
llm?: string | {
|
|
345
|
+
provider: "openai";
|
|
346
|
+
model: "gpt-4o" | "gpt-4o-mini";
|
|
347
|
+
} | {
|
|
348
|
+
provider: "anthropic";
|
|
349
|
+
model: "claude-3-7-sonnet-20250219" | "claude-3-5-haiku-20241022";
|
|
350
|
+
} | {
|
|
351
|
+
provider: "google";
|
|
352
|
+
model: "gemini-1.5-pro" | "gemini-1.5-flash" | "gemini-2.0-flash" | "gemini-2.0-pro";
|
|
353
|
+
} | {
|
|
354
|
+
provider: string;
|
|
355
|
+
model: string;
|
|
356
|
+
} | undefined;
|
|
357
|
+
toolIds?: string[] | undefined;
|
|
358
|
+
transcriber?: {
|
|
359
|
+
provider: string;
|
|
360
|
+
model: string;
|
|
361
|
+
} | undefined;
|
|
362
|
+
voice?: {
|
|
363
|
+
provider: "openai" | "vapi" | "11labs" | "azure" | "cartesia" | "custom-voice" | "deepgram" | "hume" | "lmnt" | "neuphonic" | "playht" | "rime-ai" | "smallest-ai" | "tavus" | "sesame";
|
|
364
|
+
voiceId: string;
|
|
365
|
+
model?: string | undefined;
|
|
366
|
+
} | undefined;
|
|
367
|
+
firstMessage?: string | undefined;
|
|
368
|
+
firstMessageMode?: "assistant-speaks-first" | "assistant-waits-for-user" | "assistant-speaks-first-with-model-generated-message" | undefined;
|
|
369
|
+
}>;
|
|
250
370
|
export declare const CallInputSchema: z.ZodObject<{
|
|
251
371
|
assistantId: z.ZodOptional<z.ZodString>;
|
|
252
372
|
phoneNumberId: z.ZodOptional<z.ZodString>;
|
|
@@ -322,18 +442,19 @@ export declare const GetCallInputSchema: z.ZodObject<{
|
|
|
322
442
|
}, {
|
|
323
443
|
callId: string;
|
|
324
444
|
}>;
|
|
325
|
-
export declare const
|
|
326
|
-
|
|
445
|
+
export declare const GetPhoneNumberInputSchema: z.ZodObject<{
|
|
446
|
+
phoneNumberId: z.ZodString;
|
|
327
447
|
}, "strip", z.ZodTypeAny, {
|
|
328
|
-
|
|
448
|
+
phoneNumberId: string;
|
|
329
449
|
}, {
|
|
330
|
-
|
|
450
|
+
phoneNumberId: string;
|
|
331
451
|
}>;
|
|
332
452
|
export declare const PhoneNumberOutputSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
333
453
|
id: z.ZodString;
|
|
334
454
|
createdAt: z.ZodString;
|
|
335
455
|
updatedAt: z.ZodString;
|
|
336
456
|
}, {
|
|
457
|
+
name: z.ZodOptional<z.ZodString>;
|
|
337
458
|
phoneNumber: z.ZodString;
|
|
338
459
|
status: z.ZodString;
|
|
339
460
|
capabilities: z.ZodOptional<z.ZodObject<{
|
|
@@ -352,6 +473,7 @@ export declare const PhoneNumberOutputSchema: z.ZodObject<z.objectUtil.extendSha
|
|
|
352
473
|
createdAt: string;
|
|
353
474
|
updatedAt: string;
|
|
354
475
|
phoneNumber: string;
|
|
476
|
+
name?: string | undefined;
|
|
355
477
|
capabilities?: {
|
|
356
478
|
voice?: boolean | undefined;
|
|
357
479
|
sms?: boolean | undefined;
|
|
@@ -362,17 +484,41 @@ export declare const PhoneNumberOutputSchema: z.ZodObject<z.objectUtil.extendSha
|
|
|
362
484
|
createdAt: string;
|
|
363
485
|
updatedAt: string;
|
|
364
486
|
phoneNumber: string;
|
|
487
|
+
name?: string | undefined;
|
|
365
488
|
capabilities?: {
|
|
366
489
|
voice?: boolean | undefined;
|
|
367
490
|
sms?: boolean | undefined;
|
|
368
491
|
} | undefined;
|
|
369
492
|
}>;
|
|
370
|
-
export declare const
|
|
371
|
-
|
|
493
|
+
export declare const GetToolInputSchema: z.ZodObject<{
|
|
494
|
+
toolId: z.ZodString;
|
|
372
495
|
}, "strip", z.ZodTypeAny, {
|
|
373
|
-
|
|
496
|
+
toolId: string;
|
|
374
497
|
}, {
|
|
375
|
-
|
|
498
|
+
toolId: string;
|
|
499
|
+
}>;
|
|
500
|
+
export declare const ToolOutputSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
501
|
+
id: z.ZodString;
|
|
502
|
+
createdAt: z.ZodString;
|
|
503
|
+
updatedAt: z.ZodString;
|
|
504
|
+
}, {
|
|
505
|
+
type: z.ZodString;
|
|
506
|
+
name: z.ZodString;
|
|
507
|
+
description: z.ZodString;
|
|
508
|
+
}>, "strip", z.ZodTypeAny, {
|
|
509
|
+
type: string;
|
|
510
|
+
id: string;
|
|
511
|
+
createdAt: string;
|
|
512
|
+
updatedAt: string;
|
|
513
|
+
name: string;
|
|
514
|
+
description: string;
|
|
515
|
+
}, {
|
|
516
|
+
type: string;
|
|
517
|
+
id: string;
|
|
518
|
+
createdAt: string;
|
|
519
|
+
updatedAt: string;
|
|
520
|
+
name: string;
|
|
521
|
+
description: string;
|
|
376
522
|
}>;
|
|
377
523
|
export {};
|
|
378
524
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,eAAO,MAAM,eAAe;;;CAGlB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AACrD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAC/E,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AACzD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAqC/E,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,QAAA,MAAM,mBAAmB,wLAiBvB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEpE,eAAO,MAAM,aAAa;cACF,iBAAiB;;CAExC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC;AAIX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC;AAIH,eAAO,MAAM,0BAA0B
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,eAAO,MAAM,eAAe;;;CAGlB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AACrD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAC/E,MAAM,MAAM,kBAAkB,GAC5B,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AACzD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAqC/E,eAAO,MAAM,WAAW;;;CAGvB,CAAC;AAEF,QAAA,MAAM,mBAAmB,wLAiBvB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEpE,eAAO,MAAM,aAAa;cACF,iBAAiB;;CAExC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC;AAIX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC;AAIH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDrC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBhC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;EAElC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmDrC,CAAC;AAIH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;EAqB1B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AAIH,eAAO,MAAM,yBAAyB;;;;;;EAEpC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUlC,CAAC;AAIH,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -114,6 +114,10 @@ export const CreateAssistantInputSchema = z.object({
|
|
|
114
114
|
])
|
|
115
115
|
.default(DEFAULT_LLM)
|
|
116
116
|
.describe('LLM configuration'),
|
|
117
|
+
toolIds: z
|
|
118
|
+
.array(z.string())
|
|
119
|
+
.optional()
|
|
120
|
+
.describe('IDs of tools to use with this assistant'),
|
|
117
121
|
transcriber: z
|
|
118
122
|
.object({
|
|
119
123
|
provider: z.string().describe('Provider to use for transcription'),
|
|
@@ -133,7 +137,7 @@ export const CreateAssistantInputSchema = z.object({
|
|
|
133
137
|
.string()
|
|
134
138
|
.optional()
|
|
135
139
|
.default('Hello, how can I help you today?')
|
|
136
|
-
.describe('First message to
|
|
140
|
+
.describe('First message to say to the user'),
|
|
137
141
|
firstMessageMode: z
|
|
138
142
|
.enum([
|
|
139
143
|
'assistant-speaks-first',
|
|
@@ -142,7 +146,7 @@ export const CreateAssistantInputSchema = z.object({
|
|
|
142
146
|
])
|
|
143
147
|
.default('assistant-speaks-first')
|
|
144
148
|
.optional()
|
|
145
|
-
.describe('
|
|
149
|
+
.describe('This determines who speaks first, either assistant or user'),
|
|
146
150
|
});
|
|
147
151
|
export const AssistantOutputSchema = BaseResponseSchema.extend({
|
|
148
152
|
name: z.string(),
|
|
@@ -159,10 +163,64 @@ export const AssistantOutputSchema = BaseResponseSchema.extend({
|
|
|
159
163
|
provider: z.string(),
|
|
160
164
|
model: z.string(),
|
|
161
165
|
}),
|
|
166
|
+
toolIds: z.array(z.string()).optional(),
|
|
162
167
|
});
|
|
163
168
|
export const GetAssistantInputSchema = z.object({
|
|
164
169
|
assistantId: z.string().describe('ID of the assistant to get'),
|
|
165
170
|
});
|
|
171
|
+
export const UpdateAssistantInputSchema = z.object({
|
|
172
|
+
assistantId: z.string().describe('ID of the assistant to update'),
|
|
173
|
+
name: z.string().optional().describe('New name for the assistant'),
|
|
174
|
+
instructions: z
|
|
175
|
+
.string()
|
|
176
|
+
.optional()
|
|
177
|
+
.describe('New instructions for the assistant'),
|
|
178
|
+
llm: z
|
|
179
|
+
.union([
|
|
180
|
+
LLMSchema,
|
|
181
|
+
z.string().transform((str) => {
|
|
182
|
+
try {
|
|
183
|
+
return JSON.parse(str);
|
|
184
|
+
}
|
|
185
|
+
catch (e) {
|
|
186
|
+
throw new Error(`Invalid LLM JSON string: ${str}`);
|
|
187
|
+
}
|
|
188
|
+
}),
|
|
189
|
+
])
|
|
190
|
+
.optional()
|
|
191
|
+
.describe('New LLM configuration'),
|
|
192
|
+
toolIds: z
|
|
193
|
+
.array(z.string())
|
|
194
|
+
.optional()
|
|
195
|
+
.describe('New IDs of tools to use with this assistant'),
|
|
196
|
+
transcriber: z
|
|
197
|
+
.object({
|
|
198
|
+
provider: z.string().describe('Provider to use for transcription'),
|
|
199
|
+
model: z.string().describe('Transcription model to use'),
|
|
200
|
+
})
|
|
201
|
+
.optional()
|
|
202
|
+
.describe('New transcription configuration'),
|
|
203
|
+
voice: z
|
|
204
|
+
.object({
|
|
205
|
+
provider: VoiceProviderSchema.describe('Provider to use for voice'),
|
|
206
|
+
voiceId: z.string().describe('Voice ID to use'),
|
|
207
|
+
model: z.string().optional().describe('Voice model to use'),
|
|
208
|
+
})
|
|
209
|
+
.optional()
|
|
210
|
+
.describe('New voice configuration'),
|
|
211
|
+
firstMessage: z
|
|
212
|
+
.string()
|
|
213
|
+
.optional()
|
|
214
|
+
.describe('First message to say to the user'),
|
|
215
|
+
firstMessageMode: z
|
|
216
|
+
.enum([
|
|
217
|
+
'assistant-speaks-first',
|
|
218
|
+
'assistant-waits-for-user',
|
|
219
|
+
'assistant-speaks-first-with-model-generated-message',
|
|
220
|
+
])
|
|
221
|
+
.optional()
|
|
222
|
+
.describe('This determines who speaks first, either assistant or user'),
|
|
223
|
+
});
|
|
166
224
|
// ===== Call Schemas =====
|
|
167
225
|
export const CallInputSchema = z.object({
|
|
168
226
|
assistantId: z
|
|
@@ -200,10 +258,11 @@ export const GetCallInputSchema = z.object({
|
|
|
200
258
|
callId: z.string().describe('ID of the call to get'),
|
|
201
259
|
});
|
|
202
260
|
// ===== Phone Number Schemas =====
|
|
203
|
-
export const
|
|
204
|
-
|
|
261
|
+
export const GetPhoneNumberInputSchema = z.object({
|
|
262
|
+
phoneNumberId: z.string().describe('ID of the phone number to get'),
|
|
205
263
|
});
|
|
206
264
|
export const PhoneNumberOutputSchema = BaseResponseSchema.extend({
|
|
265
|
+
name: z.string().optional(),
|
|
207
266
|
phoneNumber: z.string(),
|
|
208
267
|
status: z.string(),
|
|
209
268
|
capabilities: z
|
|
@@ -213,6 +272,14 @@ export const PhoneNumberOutputSchema = BaseResponseSchema.extend({
|
|
|
213
272
|
})
|
|
214
273
|
.optional(),
|
|
215
274
|
});
|
|
216
|
-
|
|
217
|
-
|
|
275
|
+
// ===== Tool Schemas =====
|
|
276
|
+
export const GetToolInputSchema = z.object({
|
|
277
|
+
toolId: z.string().describe('ID of the tool to get'),
|
|
278
|
+
});
|
|
279
|
+
export const ToolOutputSchema = BaseResponseSchema.extend({
|
|
280
|
+
type: z
|
|
281
|
+
.string()
|
|
282
|
+
.describe('Type of the tool (dtmf, function, mcp, query, etc.)'),
|
|
283
|
+
name: z.string().describe('Name of the tool'),
|
|
284
|
+
description: z.string().describe('Description of the tool'),
|
|
218
285
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.d.ts","sourceRoot":"","sources":["../../src/tools/assistant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAQ,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"assistant.d.ts","sourceRoot":"","sources":["../../src/tools/assistant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAQ,MAAM,qBAAqB,CAAC;AAavD,eAAO,MAAM,sBAAsB,GACjC,QAAQ,SAAS,EACjB,YAAY,UAAU,SA2EvB,CAAC"}
|
package/dist/tools/assistant.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CreateAssistantInputSchema, GetAssistantInputSchema, } from '../schemas/index.js';
|
|
2
|
-
import { transformAssistantInput, transformAssistantOutput, } from '../transformers/index.js';
|
|
1
|
+
import { CreateAssistantInputSchema, GetAssistantInputSchema, UpdateAssistantInputSchema, } from '../schemas/index.js';
|
|
2
|
+
import { transformAssistantInput, transformAssistantOutput, transformUpdateAssistantInput, } from '../transformers/index.js';
|
|
3
3
|
import { createToolHandler } from './utils.js';
|
|
4
4
|
export const registerAssistantTools = (server, vapiClient) => {
|
|
5
5
|
server.tool('list_assistants', 'Lists all Vapi assistants', {}, createToolHandler(async () => {
|
|
@@ -29,4 +29,23 @@ export const registerAssistantTools = (server, vapiClient) => {
|
|
|
29
29
|
throw error;
|
|
30
30
|
}
|
|
31
31
|
}));
|
|
32
|
+
server.tool('update_assistant', 'Updates an existing Vapi assistant', UpdateAssistantInputSchema.shape, createToolHandler(async (data) => {
|
|
33
|
+
const assistantId = data.assistantId;
|
|
34
|
+
try {
|
|
35
|
+
// First check if the assistant exists
|
|
36
|
+
const existingAssistant = await vapiClient.assistants.get(assistantId);
|
|
37
|
+
if (!existingAssistant) {
|
|
38
|
+
throw new Error(`Assistant with ID ${assistantId} not found`);
|
|
39
|
+
}
|
|
40
|
+
// Transform the update data
|
|
41
|
+
const updateAssistantDto = transformUpdateAssistantInput(data);
|
|
42
|
+
// Update the assistant
|
|
43
|
+
const updatedAssistant = await vapiClient.assistants.update(assistantId, updateAssistantDto);
|
|
44
|
+
return transformAssistantOutput(updatedAssistant);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error(`Error updating assistant: ${error.message}`);
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
32
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAOjD,eAAO,MAAM,gBAAgB,GAAI,QAAQ,SAAS,EAAE,YAAY,UAAU,SAKzE,CAAC"}
|
package/dist/tools/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { registerAssistantTools } from './assistant.js';
|
|
2
2
|
import { registerCallTools } from './call.js';
|
|
3
3
|
import { registerPhoneNumberTools } from './phone-number.js';
|
|
4
|
+
import { registerToolTools } from './tool.js';
|
|
4
5
|
export const registerAllTools = (server, vapiClient) => {
|
|
5
6
|
registerAssistantTools(server, vapiClient);
|
|
6
7
|
registerCallTools(server, vapiClient);
|
|
7
8
|
registerPhoneNumberTools(server, vapiClient);
|
|
9
|
+
registerToolTools(server, vapiClient);
|
|
8
10
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/tools/tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAQ,MAAM,qBAAqB,CAAC;AAMvD,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,SAAS,EACjB,YAAY,UAAU,SAqBvB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GetToolInputSchema } from '../schemas/index.js';
|
|
2
|
+
import { transformToolOutput } from '../transformers/index.js';
|
|
3
|
+
import { createToolHandler } from './utils.js';
|
|
4
|
+
export const registerToolTools = (server, vapiClient) => {
|
|
5
|
+
server.tool('list_tools', 'Lists all Vapi tools', {}, createToolHandler(async () => {
|
|
6
|
+
const tools = await vapiClient.tools.list({ limit: 10 });
|
|
7
|
+
return tools.map(transformToolOutput);
|
|
8
|
+
}));
|
|
9
|
+
server.tool('get_tool', 'Gets details of a specific tool', GetToolInputSchema.shape, createToolHandler(async (data) => {
|
|
10
|
+
const tool = await vapiClient.tools.get(data.toolId);
|
|
11
|
+
return transformToolOutput(tool);
|
|
12
|
+
}));
|
|
13
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Vapi } from '@vapi-ai/server-sdk';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { CreateAssistantInputSchema, CallInputSchema, AssistantOutputSchema, CallOutputSchema, PhoneNumberOutputSchema } from '../schemas/index.js';
|
|
3
|
+
import { CreateAssistantInputSchema, CallInputSchema, AssistantOutputSchema, CallOutputSchema, PhoneNumberOutputSchema, ToolOutputSchema, UpdateAssistantInputSchema } from '../schemas/index.js';
|
|
4
4
|
export declare function transformAssistantInput(input: z.infer<typeof CreateAssistantInputSchema>): Vapi.CreateAssistantDto;
|
|
5
|
+
export declare function transformUpdateAssistantInput(input: z.infer<typeof UpdateAssistantInputSchema>): Vapi.UpdateAssistantDto;
|
|
5
6
|
export declare function transformAssistantOutput(assistant: Vapi.Assistant): z.infer<typeof AssistantOutputSchema>;
|
|
6
7
|
export declare function transformCallInput(input: z.infer<typeof CallInputSchema>): Vapi.CreateCallDto;
|
|
7
8
|
export declare function transformCallOutput(call: Vapi.Call): z.infer<typeof CallOutputSchema>;
|
|
8
9
|
export declare function transformPhoneNumberOutput(phoneNumber: any): z.infer<typeof PhoneNumberOutputSchema>;
|
|
10
|
+
export declare function transformToolOutput(tool: any): z.infer<typeof ToolOutputSchema>;
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transformers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transformers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAI7B,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,GAChD,IAAI,CAAC,kBAAkB,CA2CzB;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,GAChD,IAAI,CAAC,kBAAkB,CAiEzB;AAED,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,IAAI,CAAC,SAAS,GACxB,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAqBvC;AA2BD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,GACrC,IAAI,CAAC,aAAa,CAmBpB;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,CAAC,IAAI,GACd,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAgBlC;AAID,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,GAAG,GACf,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CASzC;AAID,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,GAAG,GACR,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CASlC"}
|
|
@@ -7,6 +7,9 @@ export function transformAssistantInput(input) {
|
|
|
7
7
|
provider: input.llm.provider,
|
|
8
8
|
model: input.llm.model,
|
|
9
9
|
};
|
|
10
|
+
if (input.toolIds && input.toolIds.length > 0) {
|
|
11
|
+
assistantDto.model.toolIds = input.toolIds;
|
|
12
|
+
}
|
|
10
13
|
if (input.instructions) {
|
|
11
14
|
assistantDto.model.messages = [
|
|
12
15
|
{
|
|
@@ -32,6 +35,64 @@ export function transformAssistantInput(input) {
|
|
|
32
35
|
}
|
|
33
36
|
return assistantDto;
|
|
34
37
|
}
|
|
38
|
+
export function transformUpdateAssistantInput(input) {
|
|
39
|
+
const updateDto = {};
|
|
40
|
+
if (input.name) {
|
|
41
|
+
updateDto.name = input.name;
|
|
42
|
+
}
|
|
43
|
+
if (input.llm) {
|
|
44
|
+
updateDto.model = {
|
|
45
|
+
provider: input.llm.provider,
|
|
46
|
+
model: input.llm.model,
|
|
47
|
+
};
|
|
48
|
+
if (input.toolIds && input.toolIds.length > 0) {
|
|
49
|
+
updateDto.model.toolIds = input.toolIds;
|
|
50
|
+
}
|
|
51
|
+
if (input.instructions) {
|
|
52
|
+
updateDto.model.messages = [
|
|
53
|
+
{
|
|
54
|
+
role: 'system',
|
|
55
|
+
content: input.instructions,
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
if (input.toolIds && input.toolIds.length > 0) {
|
|
62
|
+
updateDto.model = { toolIds: input.toolIds };
|
|
63
|
+
}
|
|
64
|
+
if (input.instructions) {
|
|
65
|
+
if (!updateDto.model)
|
|
66
|
+
updateDto.model = {};
|
|
67
|
+
updateDto.model.messages = [
|
|
68
|
+
{
|
|
69
|
+
role: 'system',
|
|
70
|
+
content: input.instructions,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (input.transcriber) {
|
|
76
|
+
updateDto.transcriber = {
|
|
77
|
+
provider: input.transcriber.provider,
|
|
78
|
+
...(input.transcriber.model ? { model: input.transcriber.model } : {}),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (input.voice) {
|
|
82
|
+
updateDto.voice = {
|
|
83
|
+
provider: input.voice.provider,
|
|
84
|
+
voiceId: input.voice.voiceId,
|
|
85
|
+
...(input.voice.model ? { model: input.voice.model } : {}),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (input.firstMessage) {
|
|
89
|
+
updateDto.firstMessage = input.firstMessage;
|
|
90
|
+
}
|
|
91
|
+
if (input.firstMessageMode) {
|
|
92
|
+
updateDto.firstMessageMode = input.firstMessageMode;
|
|
93
|
+
}
|
|
94
|
+
return updateDto;
|
|
95
|
+
}
|
|
35
96
|
export function transformAssistantOutput(assistant) {
|
|
36
97
|
return {
|
|
37
98
|
id: assistant.id,
|
|
@@ -51,6 +112,7 @@ export function transformAssistantOutput(assistant) {
|
|
|
51
112
|
provider: assistant.transcriber?.provider || 'deepgram',
|
|
52
113
|
model: getAssistantTranscriberModel(assistant.transcriber) || 'nova-3',
|
|
53
114
|
},
|
|
115
|
+
toolIds: assistant.model?.toolIds || [],
|
|
54
116
|
};
|
|
55
117
|
}
|
|
56
118
|
function getAssistantVoiceId(voice) {
|
|
@@ -113,9 +175,21 @@ export function transformCallOutput(call) {
|
|
|
113
175
|
export function transformPhoneNumberOutput(phoneNumber) {
|
|
114
176
|
return {
|
|
115
177
|
id: phoneNumber.id,
|
|
178
|
+
name: phoneNumber.name,
|
|
116
179
|
createdAt: phoneNumber.createdAt,
|
|
117
180
|
updatedAt: phoneNumber.updatedAt,
|
|
118
|
-
phoneNumber: phoneNumber.
|
|
181
|
+
phoneNumber: phoneNumber.number,
|
|
119
182
|
status: phoneNumber.status,
|
|
120
183
|
};
|
|
121
184
|
}
|
|
185
|
+
// ===== Tool Transformers =====
|
|
186
|
+
export function transformToolOutput(tool) {
|
|
187
|
+
return {
|
|
188
|
+
id: tool.id,
|
|
189
|
+
createdAt: tool.createdAt,
|
|
190
|
+
updatedAt: tool.updatedAt,
|
|
191
|
+
type: tool.type || '',
|
|
192
|
+
name: tool.function?.name || '',
|
|
193
|
+
description: tool.function?.description || '',
|
|
194
|
+
};
|
|
195
|
+
}
|
package/dist/utils/response.js
CHANGED
|
@@ -6,8 +6,8 @@ export function parseToolResponse(response) {
|
|
|
6
6
|
if (response.content && Array.isArray(response.content)) {
|
|
7
7
|
const textContent = response.content.find((item) => item.type === 'text')?.text;
|
|
8
8
|
if (textContent) {
|
|
9
|
-
// Check if it's an error message first
|
|
10
|
-
if (textContent.startsWith('Error:')
|
|
9
|
+
// Check if it's an error message first - only if it starts with 'Error:'
|
|
10
|
+
if (textContent.startsWith('Error:')) {
|
|
11
11
|
return { error: textContent };
|
|
12
12
|
}
|
|
13
13
|
try {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vapi-ai/mcp-server",
|
|
3
3
|
"description": "Vapi MCP Server",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.6",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"build": "tsc && shx chmod +x dist/*.js",
|
|
38
38
|
"start": "node dist/index.js",
|
|
39
39
|
"dev": "tsx watch src/index.ts",
|
|
40
|
-
"dev:example": "tsx examples/client.ts",
|
|
40
|
+
"dev:stdio-example": "tsx examples/stdio-client.ts",
|
|
41
|
+
"dev:sse-example": "tsx examples/sse-client.ts",
|
|
41
42
|
"inspector": "mcp-inspector",
|
|
42
43
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
43
44
|
"test:unit": "NODE_OPTIONS=--experimental-vm-modules jest src/tests/mcp-server-mock.test.ts",
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"dist/**/*.d.ts.map"
|
|
50
51
|
],
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
53
|
+
"@modelcontextprotocol/sdk": "^1.11.0",
|
|
53
54
|
"@vapi-ai/server-sdk": "^0.5.2",
|
|
54
55
|
"dotenv": "^16.4.7",
|
|
55
56
|
"zod": "^3.24.2",
|