Skip to content

Added call functionality for 11labs#101

Open
lchavasse wants to merge 3 commits intoStackOneHQ:mainfrom
lchavasse:feat/elevenlabs-call-functionality
Open

Added call functionality for 11labs#101
lchavasse wants to merge 3 commits intoStackOneHQ:mainfrom
lchavasse:feat/elevenlabs-call-functionality

Conversation

@lchavasse
Copy link

@lchavasse lchavasse commented Aug 28, 2025

Ever been stuck in hyper-focused coding in Cursor or ClaudeCode or your agent of choice? And been like: "Oh fuck! I'm supposed to be at the pub in five minutes but I've got to finish this! And you don't wanna break the flow and call your friends? Well now we have the solution!

Get elevenlabs to call them up for you and tell them all the things that would keep them occupied on the phone for the half an hour you're gonna be gone. Use your own voice clone, and it's even better. What could possibly go wrong?


Summary by cubic

Adds outbound call support to the ElevenLabs connector with tools to create agents, list phone numbers, and place calls. Also adds a local MCP dev server and test coverage for new and existing ElevenLabs features.

  • New Features

    • ElevenLabs tools: create-agent, list-phone-numbers, make-phone-call (supports optional message; returns conversation_id and callSid).
    • Updated example prompt to guide listing numbers, creating an agent, and calling a target number.
    • Added scripts/start-server.ts to run any connector over an HTTP MCP endpoint for local testing.
    • Added CLAUDE.md with repo overview, commands, and connector architecture.
    • Added Vitest + MSW tests covering TTS, STT, voice listing, sound generation, agent creation, phone numbers, and phone calls.
  • Dependencies

    • Added tsx as a dev dependency.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10 issues found across 6 files

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

"lint-staged": "^15.2.0",
"msw": "^2.10.4",
"tsdown": "^0.14.0",
"tsx": "^4.20.5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused devDependency added: tsx is not referenced by any scripts or packages, adding unnecessary install weight and maintenance overhead.

Prompt for AI agents
Address the following comment on package.json at line 32:

<comment>Unused devDependency added: tsx is not referenced by any scripts or packages, adding unnecessary install weight and maintenance overhead.</comment>

<file context>
@@ -29,6 +29,7 @@
         &quot;lint-staged&quot;: &quot;^15.2.0&quot;,
         &quot;msw&quot;: &quot;^2.10.4&quot;,
         &quot;tsdown&quot;: &quot;^0.14.0&quot;,
+        &quot;tsx&quot;: &quot;^4.20.5&quot;,
         &quot;turbo&quot;: &quot;latest&quot;,
         &quot;typescript&quot;: &quot;^5.9.0&quot;,
</file context>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claude reverse this change

it("includes the additional context", async () => {
server.use(
http.post("https://api.elevenlabs.io/v1/convai/twilio/outbound-call", (req) => {
// Verify the request body includes additional_context
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test claims to verify inclusion of additional_context/message but never asserts the request body; add an assertion by reading req.json() and checking the field.

Prompt for AI agents
Address the following comment on packages/mcp-connectors/src/connectors/elevenlabs.spec.ts at line 428:

<comment>Test claims to verify inclusion of additional_context/message but never asserts the request body; add an assertion by reading req.json() and checking the field.</comment>

<file context>
@@ -0,0 +1,654 @@
+        it(&quot;includes the additional context&quot;, async () =&gt; {
+          server.use(
+            http.post(&quot;https://api.elevenlabs.io/v1/convai/twilio/outbound-call&quot;, (req) =&gt; {
+              // Verify the request body includes additional_context
+              return HttpResponse.json({
+                success: true,
</file context>

import { http, HttpResponse } from "msw";
import { setupServer } from "msw/node";

const server = setupServer();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSW server lifecycle is managed per-test without beforeAll/afterAll and no afterEach reset; handlers can accumulate and server may not close if a test fails, risking flaky tests.

Prompt for AI agents
Address the following comment on packages/mcp-connectors/src/connectors/elevenlabs.spec.ts at line 8:

<comment>MSW server lifecycle is managed per-test without beforeAll/afterAll and no afterEach reset; handlers can accumulate and server may not close if a test fails, risking flaky tests.</comment>

<file context>
@@ -0,0 +1,654 @@
+import { http, HttpResponse } from &quot;msw&quot;;
+import { setupServer } from &quot;msw/node&quot;;
+
+const server = setupServer();
+
+describe(&quot;#ElevenLabsConnector&quot;, () =&gt; {
</file context>

const dataStore = new Map<string, unknown>();
const cacheStore = new Map<string, string>();

return {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error responses from tool handlers should include isError: true so clients can reliably detect failures.

Prompt for AI agents
Address the following comment on scripts/start-server.ts at line 41:

<comment>Error responses from tool handlers should include isError: true so clients can reliably detect failures.</comment>

<file context>
@@ -0,0 +1,364 @@
+  const dataStore = new Map&lt;string, unknown&gt;();
+  const cacheStore = new Map&lt;string, string&gt;();
+
+  return {
+    getCredentials: async () =&gt; credentials,
+    getSetup: async () =&gt; setup,
</file context>

});

for (const tool of Object.values(connectorConfig.tools)) {
server.tool(tool.name, tool.description, tool.schema.shape, async (args: unknown) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing tool.schema.shape directly can be undefined for non-object Zod schemas; use a safe fallback to prevent runtime errors.

Prompt for AI agents
Address the following comment on scripts/start-server.ts at line 193:

<comment>Accessing tool.schema.shape directly can be undefined for non-object Zod schemas; use a safe fallback to prevent runtime errors.</comment>

<file context>
@@ -0,0 +1,364 @@
+  });
+
+  for (const tool of Object.values(connectorConfig.tools)) {
+    server.tool(tool.name, tool.description, tool.schema.shape, async (args: unknown) =&gt; {
+      const startTime = Date.now();
+      customLogger(`Tool invoked: ${tool.name}`, &#39;info&#39;);
</file context>

country_code: phone.country_code || phone.country,
})),
count: phoneNumbers.length,
raw_response: result,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not include the raw API response in returned data; it can expose sensitive information. Remove this field or gate it behind a debug flag.

Prompt for AI agents
Address the following comment on packages/mcp-connectors/src/connectors/elevenlabs.ts at line 703:

<comment>Do not include the raw API response in returned data; it can expose sensitive information. Remove this field or gate it behind a debug flag.</comment>

<file context>
@@ -505,5 +556,239 @@ export const ElevenLabsConnectorConfig = mcpConnectorConfig({
+              country_code: phone.country_code || phone.country,
+            })),
+            count: phoneNumbers.length,
+            raw_response: result,
+            message:
+              phoneNumbers.length &gt; 0
</file context>
Suggested change
raw_response: result,
raw_response: undefined,

phoneNumbers = result;
} else {
// Log the actual response structure for debugging
console.log('Unexpected API response structure:', JSON.stringify(result, null, 2));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid logging full API responses; this may leak phone numbers or other sensitive data. Log a minimal message without payload or remove the log.

Prompt for AI agents
Address the following comment on packages/mcp-connectors/src/connectors/elevenlabs.ts at line 689:

<comment>Avoid logging full API responses; this may leak phone numbers or other sensitive data. Log a minimal message without payload or remove the log.</comment>

<file context>
@@ -505,5 +556,239 @@ export const ElevenLabsConnectorConfig = mcpConnectorConfig({
+            phoneNumbers = result;
+          } else {
+            // Log the actual response structure for debugging
+            console.log(&#39;Unexpected API response structure:&#39;, JSON.stringify(result, null, 2));
+          }
+
</file context>
Suggested change
console.log('Unexpected API response structure:', JSON.stringify(result, null, 2));
console.warn('Unexpected API response structure');

CLAUDE.md Outdated

# With credentials for production connectors
bun start --connector asana --credentials '{"apiKey":"your-api-key"}'
bun start --connector github --credentials '{"token":"ghp_xxx"}' --setup '{"org":"myorg"}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI example doesn’t forward arguments past Turbo; use "--" so connector flags reach the server process.

Prompt for AI agents
Address the following comment on CLAUDE.md at line 23:

<comment>CLI example doesn’t forward arguments past Turbo; use &quot;--&quot; so connector flags reach the server process.</comment>

<file context>
@@ -0,0 +1,90 @@
+
+# With credentials for production connectors
+bun start --connector asana --credentials &#39;{&quot;apiKey&quot;:&quot;your-api-key&quot;}&#39;
+bun start --connector github --credentials &#39;{&quot;token&quot;:&quot;ghp_xxx&quot;}&#39; --setup &#39;{&quot;org&quot;:&quot;myorg&quot;}&#39;
+```
+
</file context>
Suggested change
bun start --connector github --credentials '{"token":"ghp_xxx"}' --setup '{"org":"myorg"}'
bun run start -- --connector github --credentials '{"token":"ghp_xxx"}' --setup '{"org":"myorg"}'

CLAUDE.md Outdated
bun start --connector test

# With credentials for production connectors
bun start --connector asana --credentials '{"apiKey":"your-api-key"}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI example doesn’t forward arguments past Turbo; use "--" so connector flags reach the server process.

Prompt for AI agents
Address the following comment on CLAUDE.md at line 22:

<comment>CLI example doesn’t forward arguments past Turbo; use &quot;--&quot; so connector flags reach the server process.</comment>

<file context>
@@ -0,0 +1,90 @@
+bun start --connector test
+
+# With credentials for production connectors
+bun start --connector asana --credentials &#39;{&quot;apiKey&quot;:&quot;your-api-key&quot;}&#39;
+bun start --connector github --credentials &#39;{&quot;token&quot;:&quot;ghp_xxx&quot;}&#39; --setup &#39;{&quot;org&quot;:&quot;myorg&quot;}&#39;
+```
</file context>
Suggested change
bun start --connector asana --credentials '{"apiKey":"your-api-key"}'
bun run start -- --connector asana --credentials '{"apiKey":"your-api-key"}'

CLAUDE.md Outdated
### Start a connector server for testing
```bash
# No credentials needed (test connector)
bun start --connector test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI example doesn’t forward arguments past Turbo; use "--" so connector flags reach the server process.

Prompt for AI agents
Address the following comment on CLAUDE.md at line 19:

<comment>CLI example doesn’t forward arguments past Turbo; use &quot;--&quot; so connector flags reach the server process.</comment>

<file context>
@@ -0,0 +1,90 @@
+### Start a connector server for testing
+```bash
+# No credentials needed (test connector)
+bun start --connector test
+
+# With credentials for production connectors
</file context>
Suggested change
bun start --connector test
bun run start -- --connector test

@lchavasse lchavasse closed this Aug 30, 2025
@lchavasse lchavasse reopened this Aug 30, 2025
@lchavasse
Copy link
Author

should be all ready :)

@claude
Copy link
Contributor

claude bot commented Oct 8, 2025

Claude encountered an error —— View job

Failed with exit code 128

I'll analyze this and get back to you.

@glebedel
Copy link
Contributor

glebedel commented Oct 9, 2025

@claude review PR & make relevant updates based on best practices of creating connectors per .md guidelines

@claude
Copy link
Contributor

claude bot commented Oct 9, 2025

Claude encountered an error —— View job

Failed with exit code 128

I'll analyze this and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants