Skip to main content
Glama

get_all_phone_numbers

Retrieve all phone numbers associated with a Twilio subaccount to manage telephony resources and configure communication services.

Instructions

Get all phone numbers associated with a Twilio subaccount

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
phone_number_sidYes
source_account_sidYes
target_account_sidYes

Implementation Reference

  • Registration of the MCP tool named 'get_all_phone_numbers' using the @mcp.tool decorator. Note: The description suggests retrieving phone numbers, but the decorated function performs a transfer.
    @mcp.tool( name="get_all_phone_numbers", description="Get all phone numbers associated with a Twilio subaccount", )
  • The handler function executed when the 'get_all_phone_numbers' tool is called. It transfers a phone number between subaccounts by calling AsyncTwilioManager.transfer_phone_number. Note mismatch with tool name and description.
    async def transfer_phone_number( source_account_sid: str, phone_number_sid: str, target_account_sid: str, ) -> dict: """ Transfer a phone number from one Twilio subaccount to another Args: source_account_sid: The SID of the Twilio subaccount to transfer the phone number from phone_number_sid: The SID of the phone number to transfer target_account_sid: The SID of the Twilio subaccount to transfer the phone number to Returns: Dictionary containing the transfer details """ async with async_twilio_manager: return await async_twilio_manager.transfer_phone_number( source_account_sid, phone_number_sid, target_account_sid )
  • Helper function named 'get_all_phone_numbers' that retrieves all phone numbers for the main Twilio account (no account_sid specified). Not registered as a tool.
    async def get_all_phone_numbers() -> list[dict]: """ Get all phone numbers associated with a Twilio subaccount """ async with async_twilio_manager: return await async_twilio_manager.get_account_numbers()
  • Low-level helper in AsyncTwilioManager that fetches phone numbers (local and mobile) for a given account_sid or main account if None. Called by tool wrappers.
    async def get_account_numbers(self, account_sid: Optional[str] = None) -> List[Dict]: """ Get all phone numbers associated with a subaccount. Args: account_sid: The subaccount SID Returns: List of phone numbers and their details """ try: numbers = [] if account_sid: local_numbers = await self.client.api.v2010.accounts( account_sid ).incoming_phone_numbers.local.list_async() mobile_numbers = await self.client.api.v2010.accounts( account_sid ).incoming_phone_numbers.mobile.list_async() else: local_numbers = await self.client.incoming_phone_numbers.local.list_async() mobile_numbers = await self.client.incoming_phone_numbers.mobile.list_async() numbers.extend( [{**number.__dict__, "number_type": "national"} for number in local_numbers] ) numbers.extend( [{**number.__dict__, "number_type": "mobile"} for number in mobile_numbers] ) return numbers except Exception as e: self.logger.error(f"Failed to fetch phone numbers: {str(e)}") raise

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/errajibadr/twilio_manager_mcp'

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