list_twilio_subaccounts
Retrieve and manage Twilio subaccounts by listing all available accounts or filtering them using friendly names for better organization and oversight.
Instructions
List all Twilio subaccounts or filter by friendly name. Provide an empty string for all subaccounts
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- twilio_manager_mcp.py:29-43 (handler)The @mcp.tool decorator and the handler function that implements the tool logic by delegating to AsyncTwilioManager.list_subaccounts()@mcp.tool( name="list_twilio_subaccounts", description="List all Twilio subaccounts or filter by friendly name. Provide an empty string for all subaccounts", ) async def list_all_twilio_subaccounts() -> list[dict]: """ List all Twilio subaccounts or filter by friendly name. Args: friendly_name: Optional filter by friendly name (empty string for all) Returns: List of subaccount details """ async with async_twilio_manager: return await async_twilio_manager.list_subaccounts()
- api/async_twilio_api.py:55-85 (helper)Core helper method in AsyncTwilioManager that performs the actual Twilio API call to list subaccounts, supporting optional friendly_name filter and with_token flag.async def list_subaccounts( self, friendly_name: Optional[str] = None, with_token: bool = False ) -> List[Dict]: """ List all subaccounts or filter by friendly name. Args: friendly_name: Optional filter by friendly name Returns: List of subaccount details """ try: params = {} if friendly_name: params["friendly_name"] = friendly_name accounts = await self.client.api.v2010.accounts.list_async(**params) return [ { "sid": account.sid, "friendly_name": account.friendly_name, "auth_token": account.auth_token if with_token else None, } for account in accounts ] except Exception as e: self.logger.error(f"Failed to list subaccounts: {str(e)}") raise