Skip to main content
Glama

make_outbound_call

Initiate phone calls using an ElevenLabs AI agent to connect with phone numbers. Automatically selects the appropriate telephony provider (Twilio or SIP trunk) based on configuration.

Instructions

Make an outbound call using an ElevenLabs agent. Automatically detects provider type (Twilio or SIP trunk) and uses the appropriate API.

⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user. Args: agent_id: The ID of the agent that will handle the call agent_phone_number_id: The ID of the phone number to use for the call to_number: The phone number to call (E.164 format: +1xxxxxxxxxx) Returns: TextContent containing information about the call

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYes
agent_phone_number_idYes
to_numberYes

Implementation Reference

  • The handler function that implements the logic for making an outbound call using ElevenLabs API. Detects the provider type and invokes the appropriate outbound_call method.
    def make_outbound_call( agent_id: str, agent_phone_number_id: str, to_number: str, ) -> TextContent: # Get phone number details to determine provider type phone_number = _get_phone_number_by_id(agent_phone_number_id) if phone_number.provider.lower() == "twilio": response = client.conversational_ai.twilio.outbound_call( agent_id=agent_id, agent_phone_number_id=agent_phone_number_id, to_number=to_number, ) provider_info = "Twilio" elif phone_number.provider.lower() == "sip_trunk": response = client.conversational_ai.sip_trunk.outbound_call( agent_id=agent_id, agent_phone_number_id=agent_phone_number_id, to_number=to_number, ) provider_info = "SIP trunk" else: make_error(f"Unsupported provider type: {phone_number.provider}") return TextContent( type="text", text=f"Outbound call initiated via {provider_info}: {response}." )
  • Registers the 'make_outbound_call' tool using the @mcp.tool decorator, including detailed description, arguments, and usage warnings.
    @mcp.tool( description="""Make an outbound call using an ElevenLabs agent. Automatically detects provider type (Twilio or SIP trunk) and uses the appropriate API. ⚠️ COST WARNING: This tool makes an API call to ElevenLabs which may incur costs. Only use when explicitly requested by the user. Args: agent_id: The ID of the agent that will handle the call agent_phone_number_id: The ID of the phone number to use for the call to_number: The phone number to call (E.164 format: +1xxxxxxxxxx) Returns: TextContent containing information about the call """ )
  • Supporting helper function that retrieves phone number details by ID from the ElevenLabs client, used by the handler to determine the provider type.
    def _get_phone_number_by_id(phone_number_id: str): """Helper function to get phone number details by ID.""" phone_numbers = client.conversational_ai.phone_numbers.list() for phone in phone_numbers: if phone.phone_number_id == phone_number_id: return phone make_error(f"Phone number with ID {phone_number_id} not found.")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/projectservan8n/elevenlabs-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server