purchase_did
Acquire a DID (Direct Inward Dialing) number in E164 format. Returns details including SMS capability, channels, costs, activation fees, and required documents for activation.
Instructions
Purchase DID from DIDLogic
Args: number: DID number for purchase in E164 format
Returns a JSON object with purchased DID details where: errors: Errors what happened in purchase process purchases: Array of purchased dids where: id: ID of purchased DID number: number of DID country: Country name area: City name sms_enabled: Is number capable of receiving SMS channels: How many parallel channels have DID free_minutes: How many free minutes per month DID have activation: Activation cost for DID in USD monthly_fee: Monthly fee for DID per_minute: Per minute cost for DID origination_per_min: per minute cost if origin based rate applied requir_docs: required documents for activating number, where: 1 = Any form of ID 2 = Proof of address 3 = Proof of local address codec: what SIP codec is preferred for this number
Example:
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| number | Yes | DID number for purchase |
Implementation Reference
- The purchase_did tool handler function, registered via @mcp.tool() decorator. It takes a DID number, calls the DIDLogic purchase API endpoint, and returns the response as text. The input schema is defined using Pydantic Field.@mcp.tool() async def purchase_did( ctx: Context, number: str | int = Field( description="DID number for purchase" ) ) -> str: """ Purchase DID from DIDLogic Args: number: DID number for purchase in E164 format Returns a JSON object with purchased DID details where: errors: Errors what happened in purchase process purchases: Array of purchased dids where: id: ID of purchased DID number: number of DID country: Country name area: City name sms_enabled: Is number capable of receiving SMS channels: How many parallel channels have DID free_minutes: How many free minutes per month DID have activation: Activation cost for DID in USD monthly_fee: Monthly fee for DID per_minute: Per minute cost for DID origination_per_min: per minute cost if origin based rate applied requir_docs: required documents for activating number, where: 1 = Any form of ID 2 = Proof of address 3 = Proof of local address codec: what SIP codec is preferred for this number Example: ``` { "purchase": { "errors": {}, "purchases": [ { "id": 728070, "number": "17806999999", "sms_enabled": false, "no_local_cli": false, "channels": 4, "country": "Canada", "area": "Edmonton, AB", "free_minutes": 0, "codec": "G711", "require_docs": "", "activation": 1.0, "monthly_fee": 1.0, "per_minute": 0.01, "origination_per_min": 0.0 } ] } } ``` """ response = await base.call_didlogic_api( ctx, "POST", "/v2/buy/purchase", data={"did_numbers": number} ) return response.text