Skip to main content
Glama

list_country_cities

Retrieve a list of cities in a specific country where DIDs are available for purchase, including SMS-enabled options. Returns JSON with city IDs, names, area codes, and available DID counts.

Instructions

List of Cities with available DID for purchase in a country

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

Returns a JSON object with available cities for purchase DIDs. Returned cities list have following fields: id: ID of city name: Name of city in DIDLogic area_code: Area code within country count: count of available DIDs for purchasing

403 error indicates disabled API calls for purchase.

Example:

{ "cities": [ { "id": 118557, "name": "Ottawa-Hull, ON", "area_code": "613800", "count": 81 } ] }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
country_idYesCountry ID
sms_enabledNoFilter for sms enabled numbers

Implementation Reference

  • The handler function for the 'list_country_cities' MCP tool. Decorated with @mcp.tool(), it takes country_id and optional sms_enabled parameters (defined with Field for schema), calls the DIDLogic API to list cities with available DIDs, and returns the JSON response as string.
    async def list_country_cities( ctx: Context, country_id: int = Field(description="Country ID"), sms_enabled: Optional[bool] = Field( description="Filter for sms enabled numbers", default=None ) ) -> str: """ List of Cities with available DID for purchase in a country Args: country_id: ID of country for search sms_enabled: search for DID with SMS functionality Returns a JSON object with available cities for purchase DIDs. Returned cities list have following fields: id: ID of city name: Name of city in DIDLogic area_code: Area code within country count: count of available DIDs for purchasing 403 error indicates disabled API calls for purchase. Example: ``` { "cities": [ { "id": 118557, "name": "Ottawa-Hull, ON", "area_code": "613800", "count": 81 } ] } ``` """ 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}/cities", params=params ) return response.text
  • Input schema defined using Pydantic Field in the function signature: country_id (int, required), sms_enabled (Optional[bool]).
    ctx: Context, country_id: int = Field(description="Country ID"), sms_enabled: Optional[bool] = Field( description="Filter for sms enabled numbers", default=None )
  • Tool registration via @mcp.tool() decorator above the handler function.
    @mcp.tool()

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