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",
            }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool's function but doesn't cover critical aspects like rate limits, authentication needs, error handling, or what the detection entails (e.g., carrier lookup, location mapping). This leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any redundant or unnecessary information. It is appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what 'detect' entails (e.g., output format, accuracy), behavioral traits like performance or constraints, or how it differs from the sibling tool. For a tool with no structured support, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the parameter 'phone_numbers' fully documented in the schema (including the max 100 limit). The description adds no additional semantic meaning beyond implying multiple numbers, so it meets the baseline of 3 where the schema handles parameter documentation effectively.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('detect') and target ('carriers and locations for multiple phone numbers'), distinguishing it from the sibling 'detect_carrier' by specifying 'multiple phone numbers' for batch processing. However, it doesn't explicitly mention the batch nature beyond 'multiple', which could be more specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus the sibling 'detect_carrier' (e.g., for single vs. multiple numbers), nor does it mention any prerequisites, limitations, or alternative scenarios. It lacks explicit usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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