Skip to main content
Glama
dahuangbaojian

Phone Carrier Detector MCP Server

batch_detect_carriers

Identify Chinese mobile carriers and geographic locations for up to 100 phone numbers simultaneously using a comprehensive database.

Instructions

Detect carriers and locations for multiple phone numbers

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
phone_numbersYesList of phone numbers to detect (max 100)

Implementation Reference

  • The main handler function for the batch_detect_carriers tool. Validates input as a list of up to 100 strings, calls detect_carrier for each valid phone number, and returns aggregated results.
    def batch_detect_carriers(phone_numbers: list) -> Dict[str, Any]: """批量检测手机号运营商和归属地""" if not isinstance(phone_numbers, list): return {"success": False, "error": "Input must be a list of phone numbers"} if len(phone_numbers) > 100: return { "success": False, "error": "Maximum 100 phone numbers allowed per batch", } results = [] for phone in phone_numbers: if not isinstance(phone, str): results.append( {"success": False, "error": f"Invalid phone number type: {type(phone)}"} ) else: results.append(detect_carrier(phone)) return {"success": True, "results": results, "total": len(results)}
  • Input schema definition for the batch_detect_carriers tool, specifying that it takes an object with a required 'phone_numbers' array of strings.
    "inputSchema": { "type": "object", "properties": { "phone_numbers": { "type": "array", "items": {"type": "string"}, "description": "List of phone numbers to detect (max 100)", } }, "required": ["phone_numbers"], },
  • mcp_server.py:121-135 (registration)
    Registration of the batch_detect_carriers tool in the list_tools method, including name, description, and input schema.
    { "name": "batch_detect_carriers", "description": "Detect carriers and locations for multiple phone numbers", "inputSchema": { "type": "object", "properties": { "phone_numbers": { "type": "array", "items": {"type": "string"}, "description": "List of phone numbers to detect (max 100)", } }, "required": ["phone_numbers"], }, },
  • Helper function used by batch_detect_carriers to detect carrier and location for individual phone numbers using prefix lookup in the PHONE_DATABASE.
    def detect_carrier(phone_number: str) -> Dict[str, Any]: """检测手机号运营商和归属地""" # 验证手机号格式 if not re.match(r"^1[3-9]\d{9}$", phone_number): return { "success": False, "error": "Invalid phone number format. Must be 11 digits starting with 1.", } # 提取前缀(前7位) prefix = phone_number[:7] # 查找数据库 if prefix in PHONE_DATABASE: info = PHONE_DATABASE[prefix] return { "success": True, "phone_number": phone_number, "carrier": info["carrier"], "carrier_cn": info["carrier_cn"], "province": info["province"], "city": info["city"], "prefix": prefix, } else: return { "success": False, "error": f"Phone number prefix {prefix} not found in database", }
Install Server

Other Tools

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/dahuangbaojian/sms-mcp-server'

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