Skip to content

fix: add MCP server outbound phone number validation and guidance#37

Open
vapi-tasker[bot] wants to merge 1 commit intomainfrom
tasker/VAPICS-696-mcp-outbound-validation
Open

fix: add MCP server outbound phone number validation and guidance#37
vapi-tasker[bot] wants to merge 1 commit intomainfrom
tasker/VAPICS-696-mcp-outbound-validation

Conversation

@vapi-tasker
Copy link

@vapi-tasker vapi-tasker bot commented Mar 23, 2026

Summary

Prevents cryptic API errors when MCP users attempt outbound calls with Vapi-provisioned (inbound-only) phone numbers by adding pre-validation and clear tool/schema descriptions.

Problem: When an MCP-connected AI agent tries to create an outbound call using a Vapi-provisioned phone number, the API returns a cryptic error: call.start.error-get-transport — "Vapi Numbers Can't Dial Outbound Yet". The MCP tools provide no guidance about which phone numbers support outbound calling.

Solution: Four targeted fixes across three new files in mcp-server/src/:

  • transformers/index.tstransformPhoneNumberOutput: Exposes the provider field so MCP users can identify outbound-capable numbers (twilio, vonage, telnyx, byo-phone-number) vs inbound-only (vapi)
  • tools/call.tscreateCallTool: Updated tool description warns that outbound calls require Twilio or Vonage imported numbers and references list_phone_numbers tool
  • schemas/index.tsCallInputSchema.phoneNumberId: Description documents the Vapi inbound-only restriction with actionable guidance
  • transformers/index.tsvalidatePhoneNumberForOutbound + transformCallInput: Pre-validates phone number provider before API call, throws OutboundCallValidationError with clear, actionable error message for Vapi numbers

Test Plan

  • 40 new unit tests covering all validation paths (transformers: 18, tools: 12, schemas: 10)
  • Tests verify Vapi numbers are rejected with OutboundCallValidationError
  • Tests verify Twilio, Vonage, Telnyx, and BYO numbers pass validation
  • Tests verify error messages include phone number ID and actionable guidance
  • Tests verify transformPhoneNumberOutput strips sensitive API fields while exposing provider
  • Tests verify transformCallInput skips validation when no fetchPhoneNumber is provided
  • All 454 tests pass (39 test files) — no regressions
  • Biome check passes (lint + format)

Linear Issue

VAPICS-696

Prevent cryptic API errors when MCP users attempt outbound calls with
Vapi-provisioned (inbound-only) phone numbers by adding pre-validation
and clear tool descriptions.

Changes:
- Add transformPhoneNumberOutput to expose provider field, letting users
  identify which numbers support outbound calling
- Update create_call tool description to warn that outbound requires
  Twilio or Vonage imported numbers
- Update CallInputSchema phoneNumberId description to document the
  Vapi inbound-only restriction and reference list_phone_numbers tool
- Add validatePhoneNumberForOutbound pre-validation in transformCallInput
  that throws OutboundCallValidationError with actionable guidance

Resolves: VAPICS-696

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants