Skip to main content
Glama

get_all_phone_numbers

Retrieve all phone numbers linked to a Twilio subaccount for management and oversight purposes.

Instructions

Get all phone numbers associated with a Twilio subaccount

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
source_account_sidYes
phone_number_sidYes
target_account_sidYes

Implementation Reference

  • Registration of the MCP tool named 'get_all_phone_numbers' via the @mcp.tool decorator.
    @mcp.tool( name="get_all_phone_numbers", description="Get all phone numbers associated with a Twilio subaccount", )
  • Handler function decorated for 'get_all_phone_numbers' tool. Note: Functionally transfers a phone number despite tool name and description suggesting retrieval of phone numbers.
    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 that implements retrieval of all phone numbers for the main Twilio account, matching the expected tool name and description, but not registered as an MCP 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()
  • Core implementation of phone number transfer logic delegated by the MCP tool handler from AsyncTwilioManager class.
    async def transfer_phone_number( self, source_account_sid: str, phone_number_sid: str, target_account_sid: str, address_sid: Optional[str] = None, bundle_sid: Optional[str] = None, ) -> Dict: """ Transfer a phone number to a different subaccount. Args: source_account_sid: The source subaccount SID phone_number_sid: The SID of the phone number to transfer target_account_sid: The target subaccount SID address_sid: The address SID bundle_sid: The bundle SID Returns: Dict containing the updated phone number information """ try: # Get or create bundle if not provided bundle_sid = await self._get_or_create_bundle( bundle_sid, phone_number_sid, source_account_sid, target_account_sid ) # Get or create address if not provided address_sid = await self._get_or_create_address(address_sid, target_account_sid) return await self._execute_number_transfer( source_account_sid, phone_number_sid, target_account_sid, address_sid, bundle_sid ) except Exception as e: self.logger.error(f"Failed to transfer phone number: {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