Skip to main content
Glama
UserAd

didlogic_mcp

list_country_regions

Retrieve available regions with DIDs for purchase by specifying a country ID and optional SMS functionality. Returns a JSON object detailing region IDs, names, and short codes. Access through the didlogic_mcp server.

Instructions

List country regions with available DIDs for purchase

Args: country_id: ID of country for search sms_enabled: search for DID with SMS functionality

Returns a JSON object with available regions for purchase. Returned countries list have following fields: id: ID of region name: Name of region in DIDLogic short_name: short code for region

403 error indicates disabled API calls for purchase.

Example:

{
    "regions": [
        {
            "id": 1,
            "name": "Alberta",
            "short_name": "AB"
        }
}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
country_idYesCountry ID
sms_enabledNoFilter for sms enabled numbers

Implementation Reference

  • The core handler function for the 'list_country_regions' tool. It takes country_id and optional sms_enabled filter, calls the DIDLogic API via base.call_didlogic_api, and returns the JSON response as string.
    @mcp.tool()
    async def list_country_regions(
        ctx: Context,
        country_id: int = Field(description="Country ID"),
        sms_enabled: Optional[bool] = Field(
            description="Filter for sms enabled numbers", default=None
        )
    ) -> str:
        """
            List country regions with available DIDs for purchase
    
            Args:
                country_id: ID of country for search
                sms_enabled: search for DID with SMS functionality
    
            Returns a JSON object with available regions for purchase.
            Returned countries list have following fields:
                id: ID of region
                name: Name of region in DIDLogic
                short_name: short code for region
    
            403 error indicates disabled API calls for purchase.
    
            Example:
            ```
            {
                "regions": [
                    {
                        "id": 1,
                        "name": "Alberta",
                        "short_name": "AB"
                    }
            }
            ```
        """
        params = {}
        if sms_enabled is not None:
            params["sms_enabled"] = int(sms_enabled)
    
        response = await base.call_didlogic_api(
            ctx,
            "GET",
            f"/v2/buy/countries/{country_id}/regions",
            params=params
        )
        return response.text
  • Registers all tools from the purchase module, including list_country_regions, with the MCP server.
    tools.purchase.register_tools(mcp)
  • Input schema defined using Pydantic Field for parameters country_id (required int) and sms_enabled (optional bool). Output is str (JSON).
    async def list_country_regions(
        ctx: Context,
        country_id: int = Field(description="Country ID"),
        sms_enabled: Optional[bool] = Field(
            description="Filter for sms enabled numbers", default=None
        )
    ) -> str:

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/UserAd/didlogic_mcp'

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