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
| Name | Required | Description | Default |
|---|---|---|---|
| source_account_sid | Yes | ||
| phone_number_sid | Yes | ||
| target_account_sid | Yes |
Implementation Reference
- twilio_manager_mcp.py:69-72 (registration)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", )
- twilio_manager_mcp.py:73-90 (handler)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 )
- twilio_manager_mcp.py:45-51 (helper)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()
- api/async_twilio_api.py:229-266 (helper)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