elevenlabs-voice-agent-mcp 1.0.15 → 1.1.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/README.md +202 -23
- package/dist/__tests__/mocks/fixtures.d.ts +136 -0
- package/dist/__tests__/mocks/fixtures.d.ts.map +1 -0
- package/dist/__tests__/mocks/fixtures.js +393 -0
- package/dist/__tests__/mocks/fixtures.js.map +1 -0
- package/dist/__tests__/schemas/schemas.test.d.ts +7 -0
- package/dist/__tests__/schemas/schemas.test.d.ts.map +1 -0
- package/dist/__tests__/schemas/schemas.test.js +537 -0
- package/dist/__tests__/schemas/schemas.test.js.map +1 -0
- package/dist/__tests__/services/elevenlabs-api.test.d.ts +7 -0
- package/dist/__tests__/services/elevenlabs-api.test.d.ts.map +1 -0
- package/dist/__tests__/services/elevenlabs-api.test.js +272 -0
- package/dist/__tests__/services/elevenlabs-api.test.js.map +1 -0
- package/dist/__tests__/services/formatters.test.d.ts +7 -0
- package/dist/__tests__/services/formatters.test.d.ts.map +1 -0
- package/dist/__tests__/services/formatters.test.js +387 -0
- package/dist/__tests__/services/formatters.test.js.map +1 -0
- package/dist/__tests__/setup.d.ts +7 -0
- package/dist/__tests__/setup.d.ts.map +1 -0
- package/dist/__tests__/setup.js +25 -0
- package/dist/__tests__/setup.js.map +1 -0
- package/dist/__tests__/tools/agent-tools.test.d.ts +7 -0
- package/dist/__tests__/tools/agent-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/agent-tools.test.js +343 -0
- package/dist/__tests__/tools/agent-tools.test.js.map +1 -0
- package/dist/__tests__/tools/batch-calling-tools.test.d.ts +7 -0
- package/dist/__tests__/tools/batch-calling-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/batch-calling-tools.test.js +236 -0
- package/dist/__tests__/tools/batch-calling-tools.test.js.map +1 -0
- package/dist/__tests__/tools/conversation-tools.test.d.ts +7 -0
- package/dist/__tests__/tools/conversation-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/conversation-tools.test.js +212 -0
- package/dist/__tests__/tools/conversation-tools.test.js.map +1 -0
- package/dist/__tests__/tools/knowledge-tools.test.d.ts +7 -0
- package/dist/__tests__/tools/knowledge-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/knowledge-tools.test.js +209 -0
- package/dist/__tests__/tools/knowledge-tools.test.js.map +1 -0
- package/dist/__tests__/tools/outbound-tools.test.d.ts +7 -0
- package/dist/__tests__/tools/outbound-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/outbound-tools.test.js +194 -0
- package/dist/__tests__/tools/outbound-tools.test.js.map +1 -0
- package/dist/__tests__/tools/phone-number-tools.test.d.ts +7 -0
- package/dist/__tests__/tools/phone-number-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/phone-number-tools.test.js +314 -0
- package/dist/__tests__/tools/phone-number-tools.test.js.map +1 -0
- package/dist/__tests__/tools/tool-tools.test.d.ts +7 -0
- package/dist/__tests__/tools/tool-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/tool-tools.test.js +287 -0
- package/dist/__tests__/tools/tool-tools.test.js.map +1 -0
- package/dist/__tests__/tools/utility-tools.test.d.ts +7 -0
- package/dist/__tests__/tools/utility-tools.test.d.ts.map +1 -0
- package/dist/__tests__/tools/utility-tools.test.js +207 -0
- package/dist/__tests__/tools/utility-tools.test.js.map +1 -0
- package/dist/__tests__/utils/error-handlers.test.d.ts +7 -0
- package/dist/__tests__/utils/error-handlers.test.d.ts.map +1 -0
- package/dist/__tests__/utils/error-handlers.test.js +237 -0
- package/dist/__tests__/utils/error-handlers.test.js.map +1 -0
- package/dist/__tests__/utils/phone-normalizer.test.d.ts +7 -0
- package/dist/__tests__/utils/phone-normalizer.test.d.ts.map +1 -0
- package/dist/__tests__/utils/phone-normalizer.test.js +224 -0
- package/dist/__tests__/utils/phone-normalizer.test.js.map +1 -0
- package/dist/__tests__/utils/truncation.test.d.ts +7 -0
- package/dist/__tests__/utils/truncation.test.d.ts.map +1 -0
- package/dist/__tests__/utils/truncation.test.js +208 -0
- package/dist/__tests__/utils/truncation.test.js.map +1 -0
- package/dist/constants.d.ts +128 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +150 -24
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -3
- package/dist/index.js.map +1 -1
- package/dist/schemas/agent-schemas.d.ts +23 -8
- package/dist/schemas/agent-schemas.d.ts.map +1 -1
- package/dist/schemas/agent-schemas.js +23 -8
- package/dist/schemas/agent-schemas.js.map +1 -1
- package/dist/schemas/batch-calling-schemas.d.ts +24 -9
- package/dist/schemas/batch-calling-schemas.d.ts.map +1 -1
- package/dist/schemas/batch-calling-schemas.js +24 -9
- package/dist/schemas/batch-calling-schemas.js.map +1 -1
- package/dist/schemas/common-schemas.d.ts +45 -13
- package/dist/schemas/common-schemas.d.ts.map +1 -1
- package/dist/schemas/common-schemas.js +45 -13
- package/dist/schemas/common-schemas.js.map +1 -1
- package/dist/schemas/conversation-schemas.d.ts +12 -5
- package/dist/schemas/conversation-schemas.d.ts.map +1 -1
- package/dist/schemas/conversation-schemas.js +12 -5
- package/dist/schemas/conversation-schemas.js.map +1 -1
- package/dist/schemas/outbound-schemas.d.ts +23 -8
- package/dist/schemas/outbound-schemas.d.ts.map +1 -1
- package/dist/schemas/outbound-schemas.js +23 -8
- package/dist/schemas/outbound-schemas.js.map +1 -1
- package/dist/schemas/phone-number-schemas.d.ts +37 -14
- package/dist/schemas/phone-number-schemas.d.ts.map +1 -1
- package/dist/schemas/phone-number-schemas.js +37 -14
- package/dist/schemas/phone-number-schemas.js.map +1 -1
- package/dist/schemas/tool-schemas.d.ts +27 -9
- package/dist/schemas/tool-schemas.d.ts.map +1 -1
- package/dist/schemas/tool-schemas.js +34 -11
- package/dist/schemas/tool-schemas.js.map +1 -1
- package/dist/services/elevenlabs-api.d.ts +108 -14
- package/dist/services/elevenlabs-api.d.ts.map +1 -1
- package/dist/services/elevenlabs-api.js +108 -14
- package/dist/services/elevenlabs-api.js.map +1 -1
- package/dist/services/formatters.d.ts +147 -21
- package/dist/services/formatters.d.ts.map +1 -1
- package/dist/services/formatters.js +147 -21
- package/dist/services/formatters.js.map +1 -1
- package/dist/tools/agent-tools.d.ts +5 -3
- package/dist/tools/agent-tools.d.ts.map +1 -1
- package/dist/tools/agent-tools.js +5 -3
- package/dist/tools/agent-tools.js.map +1 -1
- package/dist/tools/batch-calling-tools.d.ts +5 -3
- package/dist/tools/batch-calling-tools.d.ts.map +1 -1
- package/dist/tools/batch-calling-tools.js +5 -3
- package/dist/tools/batch-calling-tools.js.map +1 -1
- package/dist/tools/conversation-tools.d.ts +5 -3
- package/dist/tools/conversation-tools.d.ts.map +1 -1
- package/dist/tools/conversation-tools.js +5 -3
- package/dist/tools/conversation-tools.js.map +1 -1
- package/dist/tools/knowledge-tools.d.ts +5 -3
- package/dist/tools/knowledge-tools.d.ts.map +1 -1
- package/dist/tools/knowledge-tools.js +5 -3
- package/dist/tools/knowledge-tools.js.map +1 -1
- package/dist/tools/outbound-tools.d.ts +5 -3
- package/dist/tools/outbound-tools.d.ts.map +1 -1
- package/dist/tools/outbound-tools.js +5 -3
- package/dist/tools/outbound-tools.js.map +1 -1
- package/dist/tools/phone-number-tools.d.ts +5 -4
- package/dist/tools/phone-number-tools.d.ts.map +1 -1
- package/dist/tools/phone-number-tools.js +5 -4
- package/dist/tools/phone-number-tools.js.map +1 -1
- package/dist/tools/tool-tools.d.ts +5 -3
- package/dist/tools/tool-tools.d.ts.map +1 -1
- package/dist/tools/tool-tools.js +5 -3
- package/dist/tools/tool-tools.js.map +1 -1
- package/dist/tools/utility-tools.d.ts +5 -3
- package/dist/tools/utility-tools.d.ts.map +1 -1
- package/dist/tools/utility-tools.js +5 -3
- package/dist/tools/utility-tools.js.map +1 -1
- package/dist/types.d.ts +457 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +15 -3
- package/dist/types.js.map +1 -1
- package/dist/utils/error-handlers.d.ts +47 -14
- package/dist/utils/error-handlers.d.ts.map +1 -1
- package/dist/utils/error-handlers.js +47 -14
- package/dist/utils/error-handlers.js.map +1 -1
- package/dist/utils/phone-normalizer.d.ts +43 -22
- package/dist/utils/phone-normalizer.d.ts.map +1 -1
- package/dist/utils/phone-normalizer.js +43 -22
- package/dist/utils/phone-normalizer.js.map +1 -1
- package/dist/utils/truncation.d.ts +46 -22
- package/dist/utils/truncation.d.ts.map +1 -1
- package/dist/utils/truncation.js +46 -22
- package/dist/utils/truncation.js.map +1 -1
- package/package.json +10 -4
package/README.md
CHANGED
|
@@ -490,6 +490,66 @@ The MCP server accepts any valid ElevenLabs model identifier. Common options inc
|
|
|
490
490
|
|
|
491
491
|
`en`, `es`, `fr`, `de`, `it`, `pt`, `pl`, `nl`, `ja`, `zh`, `ko`, `ar`, `hi`
|
|
492
492
|
|
|
493
|
+
## API Reference
|
|
494
|
+
|
|
495
|
+
Complete reference for all 23 MCP tools organized by functionality.
|
|
496
|
+
|
|
497
|
+
### Tier 1: Core Agent Management
|
|
498
|
+
|
|
499
|
+
| Tool | Description | Key Parameters |
|
|
500
|
+
|------|-------------|----------------|
|
|
501
|
+
| `elevenlabs_create_agent` | Create a new voice agent | `name`, `prompt`, `llm`, `voice_id`, `first_message`, `language` |
|
|
502
|
+
| `elevenlabs_get_agent` | Retrieve agent configuration | `agent_id` |
|
|
503
|
+
| `elevenlabs_update_agent` | Modify agent settings | `agent_id`, plus any fields to update |
|
|
504
|
+
| `elevenlabs_delete_agent` | Permanently delete an agent | `agent_id` |
|
|
505
|
+
| `elevenlabs_list_agents` | List all agents with pagination | `limit`, `offset` |
|
|
506
|
+
|
|
507
|
+
### Tier 2: Knowledge Base & Tools
|
|
508
|
+
|
|
509
|
+
| Tool | Description | Key Parameters |
|
|
510
|
+
|------|-------------|----------------|
|
|
511
|
+
| `elevenlabs_add_knowledge_base` | Add documents to agent knowledge | `agent_id`, `documents[]` |
|
|
512
|
+
| `elevenlabs_create_webhook_tool` | Create webhook integration | `agent_id`, `name`, `url`, `method`, `parameters[]` |
|
|
513
|
+
| `elevenlabs_list_tools` | List agent's webhook tools | `agent_id` |
|
|
514
|
+
| `elevenlabs_delete_tool` | Remove a webhook tool | `agent_id`, `tool_name` |
|
|
515
|
+
|
|
516
|
+
### Tier 3: Testing & Monitoring
|
|
517
|
+
|
|
518
|
+
| Tool | Description | Key Parameters |
|
|
519
|
+
|------|-------------|----------------|
|
|
520
|
+
| `elevenlabs_get_conversation` | Get conversation transcript | `conversation_id` |
|
|
521
|
+
| `elevenlabs_list_conversations` | List conversations with filtering | `agent_id`, `status`, `limit`, `offset` |
|
|
522
|
+
| `elevenlabs_generate_widget_code` | Generate HTML embed code | `agent_id`, `color`, `avatar_url` |
|
|
523
|
+
|
|
524
|
+
### Tier 4: Utilities
|
|
525
|
+
|
|
526
|
+
| Tool | Description | Key Parameters |
|
|
527
|
+
|------|-------------|----------------|
|
|
528
|
+
| `elevenlabs_list_voices` | Browse available voices | `language`, `gender`, `age`, `limit` |
|
|
529
|
+
|
|
530
|
+
### Tier 5: Outbound Calling & Phone Management
|
|
531
|
+
|
|
532
|
+
| Tool | Description | Key Parameters |
|
|
533
|
+
|------|-------------|----------------|
|
|
534
|
+
| `elevenlabs_start_outbound_call` | Initiate single call | `agent_id`, `agent_phone_number_id`, `to_number` |
|
|
535
|
+
| `elevenlabs_submit_batch_call` | Submit batch calling job | `call_name`, `agent_id`, `recipients[]` |
|
|
536
|
+
| `elevenlabs_list_batch_calls` | List batch jobs | `limit`, `last_doc` |
|
|
537
|
+
| `elevenlabs_get_batch_call` | Get batch details | `batch_id` |
|
|
538
|
+
| `elevenlabs_list_phone_numbers` | List connected phone numbers | - |
|
|
539
|
+
| `elevenlabs_get_phone_number` | Get phone number details | `phone_number_id` |
|
|
540
|
+
| `elevenlabs_import_phone_number` | Import Twilio number | `phone_number`, `label`, `sid`, `token` |
|
|
541
|
+
| `elevenlabs_update_phone_number` | Assign agent to number | `phone_number_id`, `agent_id` |
|
|
542
|
+
| `elevenlabs_delete_phone_number` | Remove phone number | `phone_number_id` |
|
|
543
|
+
|
|
544
|
+
### Tool Annotations
|
|
545
|
+
|
|
546
|
+
All tools include MCP annotations for client guidance:
|
|
547
|
+
|
|
548
|
+
- `readOnlyHint`: Whether the tool only reads data (no side effects)
|
|
549
|
+
- `destructiveHint`: Whether the tool performs destructive actions (delete)
|
|
550
|
+
- `idempotentHint`: Whether repeated calls have the same effect
|
|
551
|
+
- `openWorldHint`: Whether the tool interacts with external systems
|
|
552
|
+
|
|
493
553
|
## Development
|
|
494
554
|
|
|
495
555
|
### Project Structure
|
|
@@ -497,42 +557,161 @@ The MCP server accepts any valid ElevenLabs model identifier. Common options inc
|
|
|
497
557
|
```
|
|
498
558
|
elevenlabs-voice-agent-mcp/
|
|
499
559
|
├── src/
|
|
500
|
-
│ ├── index.ts # Server initialization
|
|
501
|
-
│ ├── types.ts # TypeScript interfaces
|
|
502
|
-
│ ├── constants.ts # API URLs and defaults
|
|
560
|
+
│ ├── index.ts # Server initialization & tool registration
|
|
561
|
+
│ ├── types.ts # TypeScript interfaces for all entities
|
|
562
|
+
│ ├── constants.ts # API URLs, limits, and defaults
|
|
503
563
|
│ ├── schemas/ # Zod validation schemas
|
|
504
|
-
│ │ ├── agent-schemas.ts
|
|
505
|
-
│ │ ├── tool-schemas.ts
|
|
564
|
+
│ │ ├── agent-schemas.ts # Agent CRUD schemas
|
|
565
|
+
│ │ ├── tool-schemas.ts # Webhook tool & knowledge base schemas
|
|
506
566
|
│ │ ├── conversation-schemas.ts
|
|
507
|
-
│ │
|
|
567
|
+
│ │ ├── outbound-schemas.ts # Single call schemas
|
|
568
|
+
│ │ ├── batch-calling-schemas.ts
|
|
569
|
+
│ │ ├── phone-number-schemas.ts
|
|
570
|
+
│ │ └── common-schemas.ts # Shared schemas (pagination, etc.)
|
|
508
571
|
│ ├── services/ # API clients and utilities
|
|
509
|
-
│ │ ├── elevenlabs-api.ts
|
|
510
|
-
│ │ └── formatters.ts
|
|
572
|
+
│ │ ├── elevenlabs-api.ts # HTTP client with auth
|
|
573
|
+
│ │ └── formatters.ts # Response formatting (Markdown/JSON)
|
|
511
574
|
│ ├── tools/ # MCP tool implementations
|
|
512
|
-
│ │ ├── agent-tools.ts
|
|
513
|
-
│ │ ├── knowledge-tools.ts
|
|
514
|
-
│ │ ├── tool-tools.ts
|
|
575
|
+
│ │ ├── agent-tools.ts # CRUD for agents
|
|
576
|
+
│ │ ├── knowledge-tools.ts # Knowledge base management
|
|
577
|
+
│ │ ├── tool-tools.ts # Webhook tool management
|
|
515
578
|
│ │ ├── conversation-tools.ts
|
|
516
|
-
│ │
|
|
579
|
+
│ │ ├── utility-tools.ts # Voices, widgets
|
|
580
|
+
│ │ ├── outbound-tools.ts # Single outbound calls
|
|
581
|
+
│ │ ├── batch-calling-tools.ts
|
|
582
|
+
│ │ └── phone-number-tools.ts
|
|
517
583
|
│ └── utils/ # Helper functions
|
|
518
|
-
│ ├── error-handlers.ts
|
|
519
|
-
│
|
|
520
|
-
└──
|
|
584
|
+
│ ├── error-handlers.ts # Error parsing & messages
|
|
585
|
+
│ ├── truncation.ts # Response size management
|
|
586
|
+
│ └── phone-normalizer.ts # E.164 format conversion
|
|
587
|
+
├── dist/ # Compiled JavaScript (gitignored)
|
|
588
|
+
├── test/ # Test files
|
|
589
|
+
└── CLAUDE.md # AI assistant guidance
|
|
521
590
|
```
|
|
522
591
|
|
|
523
592
|
### Scripts
|
|
524
593
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
594
|
+
| Command | Description |
|
|
595
|
+
|---------|-------------|
|
|
596
|
+
| `npm run build` | Compile TypeScript to JavaScript in `dist/` |
|
|
597
|
+
| `npm run dev` | Run with auto-reload using `tsx watch` |
|
|
598
|
+
| `npm start` | Run compiled server from `dist/` |
|
|
599
|
+
| `npm run clean` | Remove build artifacts |
|
|
600
|
+
| `npm test` | Run tests (placeholder) |
|
|
601
|
+
|
|
602
|
+
### Environment Variables
|
|
603
|
+
|
|
604
|
+
| Variable | Required | Description |
|
|
605
|
+
|----------|----------|-------------|
|
|
606
|
+
| `ELEVENLABS_API_KEY` | Yes | Your ElevenLabs API key |
|
|
607
|
+
|
|
608
|
+
### Testing
|
|
609
|
+
|
|
610
|
+
The project includes a comprehensive test suite with **351 unit tests** achieving **88%+ code coverage**.
|
|
611
|
+
|
|
612
|
+
#### Running Tests
|
|
613
|
+
|
|
614
|
+
```bash
|
|
615
|
+
# Run all unit tests
|
|
616
|
+
npm test
|
|
617
|
+
|
|
618
|
+
# Run tests in watch mode (re-runs on file changes)
|
|
619
|
+
npm run test:watch
|
|
620
|
+
|
|
621
|
+
# Run tests with coverage report
|
|
622
|
+
npm run test:coverage
|
|
623
|
+
|
|
624
|
+
# Run tests with UI (browser-based test runner)
|
|
625
|
+
npm run test:ui
|
|
626
|
+
|
|
627
|
+
# TypeScript type checking for test files
|
|
628
|
+
npm run test:types
|
|
629
|
+
|
|
630
|
+
# Run integration tests (requires API key)
|
|
631
|
+
npm run test:integration
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
#### Test Structure
|
|
635
|
+
|
|
636
|
+
```
|
|
637
|
+
src/__tests__/
|
|
638
|
+
├── mocks/
|
|
639
|
+
│ └── fixtures.ts # Mock data and test fixtures
|
|
640
|
+
├── schemas/
|
|
641
|
+
│ └── schemas.test.ts # Zod schema validation tests
|
|
642
|
+
├── services/
|
|
643
|
+
│ ├── elevenlabs-api.test.ts # API client tests
|
|
644
|
+
│ └── formatters.test.ts # Response formatter tests
|
|
645
|
+
├── tools/
|
|
646
|
+
│ ├── agent-tools.test.ts # Agent CRUD tests
|
|
647
|
+
│ ├── batch-calling-tools.test.ts
|
|
648
|
+
│ ├── conversation-tools.test.ts
|
|
649
|
+
│ ├── knowledge-tools.test.ts
|
|
650
|
+
│ ├── outbound-tools.test.ts
|
|
651
|
+
│ ├── phone-number-tools.test.ts
|
|
652
|
+
│ ├── tool-tools.test.ts
|
|
653
|
+
│ └── utility-tools.test.ts
|
|
654
|
+
├── utils/
|
|
655
|
+
│ ├── error-handlers.test.ts
|
|
656
|
+
│ └── truncation.test.ts
|
|
657
|
+
└── setup.ts # Test environment setup
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
#### Coverage Thresholds
|
|
661
|
+
|
|
662
|
+
The test suite enforces minimum coverage thresholds:
|
|
663
|
+
- **Statements**: 85%
|
|
664
|
+
- **Branches**: 75%
|
|
665
|
+
- **Functions**: 85%
|
|
666
|
+
- **Lines**: 85%
|
|
529
667
|
|
|
530
668
|
### Adding New Tools
|
|
531
669
|
|
|
532
|
-
1. Create
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
670
|
+
1. **Create schema** in `src/schemas/`:
|
|
671
|
+
```typescript
|
|
672
|
+
export const MyToolSchema = z.object({
|
|
673
|
+
param: z.string().describe("Parameter description"),
|
|
674
|
+
response_format: ResponseFormatSchema
|
|
675
|
+
}).passthrough();
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
2. **Create tool definition** in `src/tools/`:
|
|
679
|
+
```typescript
|
|
680
|
+
export const elevenlabs_my_tool = {
|
|
681
|
+
name: "elevenlabs_my_tool",
|
|
682
|
+
description: `Tool description with examples...`,
|
|
683
|
+
zodSchema: MyToolSchema,
|
|
684
|
+
annotations: { readOnlyHint: true, ... },
|
|
685
|
+
handler: async (args: unknown) => {
|
|
686
|
+
const parsed = MyToolSchema.parse(args);
|
|
687
|
+
// Implementation
|
|
688
|
+
return { content: [{ type: "text", text: result }] };
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
3. **Register in `src/index.ts`**:
|
|
694
|
+
```typescript
|
|
695
|
+
import { elevenlabs_my_tool } from "./tools/my-tools.js";
|
|
696
|
+
// Add to tools array
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
4. **Rebuild**: `npm run build`
|
|
700
|
+
|
|
701
|
+
### Code Style
|
|
702
|
+
|
|
703
|
+
- TypeScript strict mode enabled
|
|
704
|
+
- ESM modules with `.js` extension in imports
|
|
705
|
+
- Zod schemas for runtime validation
|
|
706
|
+
- Consistent error handling via `handleElevenLabsError`
|
|
707
|
+
- Response formatting supports both Markdown and JSON
|
|
708
|
+
|
|
709
|
+
### Testing Locally
|
|
710
|
+
|
|
711
|
+
1. Build the project: `npm run build`
|
|
712
|
+
2. Set API key: `export ELEVENLABS_API_KEY=your_key`
|
|
713
|
+
3. Test with MCP inspector or Claude Desktop
|
|
714
|
+
4. Check server output on stderr for diagnostics
|
|
536
715
|
|
|
537
716
|
## Error Handling
|
|
538
717
|
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test fixtures and mock data
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent mock data for all tests.
|
|
5
|
+
*/
|
|
6
|
+
import { Agent, ConversationMetadata, ToolConfig, Voice, BatchCallResponse, BatchCallDetailedResponse, WorkspaceBatchCallsResponse, PhoneNumber, OutboundCallResponse, ImportPhoneNumberResponse, ResponseFormat } from "../../types.js";
|
|
7
|
+
export declare const mockAgent: Agent;
|
|
8
|
+
export declare const mockAgentMinimal: Agent;
|
|
9
|
+
export declare const mockAgentsList: Agent[];
|
|
10
|
+
export declare const mockConversation: ConversationMetadata;
|
|
11
|
+
export declare const mockConversationInProgress: ConversationMetadata;
|
|
12
|
+
export declare const mockConversationsList: ConversationMetadata[];
|
|
13
|
+
export declare const mockTool: ToolConfig;
|
|
14
|
+
export declare const mockToolWithEnum: ToolConfig;
|
|
15
|
+
export declare const mockToolsList: ToolConfig[];
|
|
16
|
+
export declare const mockVoice: Voice;
|
|
17
|
+
export declare const mockVoiceMale: Voice;
|
|
18
|
+
export declare const mockVoicesList: Voice[];
|
|
19
|
+
export declare const mockBatchCall: BatchCallResponse;
|
|
20
|
+
export declare const mockBatchCallDetailed: BatchCallDetailedResponse;
|
|
21
|
+
export declare const mockBatchCallsList: WorkspaceBatchCallsResponse;
|
|
22
|
+
export declare const mockPhoneNumber: PhoneNumber;
|
|
23
|
+
export declare const mockPhoneNumberUnassigned: PhoneNumber;
|
|
24
|
+
export declare const mockPhoneNumbersList: import("../../types.js").TwilioPhoneNumber[];
|
|
25
|
+
export declare const mockOutboundCallSuccess: OutboundCallResponse;
|
|
26
|
+
export declare const mockOutboundCallFailed: OutboundCallResponse;
|
|
27
|
+
export declare const mockImportPhoneNumber: ImportPhoneNumberResponse;
|
|
28
|
+
export declare const mockApiError400: {
|
|
29
|
+
response: {
|
|
30
|
+
status: number;
|
|
31
|
+
data: {
|
|
32
|
+
detail: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export declare const mockApiError401: {
|
|
37
|
+
response: {
|
|
38
|
+
status: number;
|
|
39
|
+
data: {
|
|
40
|
+
detail: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export declare const mockApiError404: {
|
|
45
|
+
response: {
|
|
46
|
+
status: number;
|
|
47
|
+
data: {
|
|
48
|
+
detail: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export declare const mockApiError429: {
|
|
53
|
+
response: {
|
|
54
|
+
status: number;
|
|
55
|
+
data: {
|
|
56
|
+
detail: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export declare const mockApiError500: {
|
|
61
|
+
response: {
|
|
62
|
+
status: number;
|
|
63
|
+
data: {
|
|
64
|
+
detail: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export declare const validCreateAgentInput: {
|
|
69
|
+
name: string;
|
|
70
|
+
prompt: string;
|
|
71
|
+
llm: string;
|
|
72
|
+
voice_id: string;
|
|
73
|
+
voice_model: "eleven_turbo_v2_5";
|
|
74
|
+
first_message: string;
|
|
75
|
+
language: "en";
|
|
76
|
+
temperature: number;
|
|
77
|
+
max_tokens: number;
|
|
78
|
+
response_format: ResponseFormat;
|
|
79
|
+
};
|
|
80
|
+
export declare const validUpdateAgentInput: {
|
|
81
|
+
agent_id: string;
|
|
82
|
+
name: string;
|
|
83
|
+
prompt: string;
|
|
84
|
+
response_format: ResponseFormat;
|
|
85
|
+
};
|
|
86
|
+
export declare const invalidCreateAgentInputs: {
|
|
87
|
+
emptyName: {
|
|
88
|
+
name: string;
|
|
89
|
+
prompt: string;
|
|
90
|
+
};
|
|
91
|
+
shortPrompt: {
|
|
92
|
+
name: string;
|
|
93
|
+
prompt: string;
|
|
94
|
+
};
|
|
95
|
+
invalidVoiceModel: {
|
|
96
|
+
name: string;
|
|
97
|
+
prompt: string;
|
|
98
|
+
voice_model: string;
|
|
99
|
+
};
|
|
100
|
+
invalidTemperature: {
|
|
101
|
+
name: string;
|
|
102
|
+
prompt: string;
|
|
103
|
+
temperature: number;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
export declare const validBatchCallInput: {
|
|
107
|
+
call_name: string;
|
|
108
|
+
agent_id: string;
|
|
109
|
+
recipients: ({
|
|
110
|
+
phone_number: string;
|
|
111
|
+
conversation_initiation_client_data?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
phone_number: string;
|
|
114
|
+
conversation_initiation_client_data: {
|
|
115
|
+
dynamic_variables: {
|
|
116
|
+
name: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
})[];
|
|
120
|
+
response_format: ResponseFormat;
|
|
121
|
+
};
|
|
122
|
+
export declare const invalidBatchCallInputs: {
|
|
123
|
+
emptyRecipients: {
|
|
124
|
+
call_name: string;
|
|
125
|
+
agent_id: string;
|
|
126
|
+
recipients: never[];
|
|
127
|
+
};
|
|
128
|
+
invalidPhoneNumber: {
|
|
129
|
+
call_name: string;
|
|
130
|
+
agent_id: string;
|
|
131
|
+
recipients: {
|
|
132
|
+
phone_number: string;
|
|
133
|
+
}[];
|
|
134
|
+
};
|
|
135
|
+
};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