Skip to main content
Glama
avivshafir

abstractapi-mcp-server

verify_email

Validate email addresses to check format, deliverability, domain quality, and SMTP server status using an external API.

Instructions

Validates an email address using an external email validation API of abstractapi.

This function checks the validity, deliverability, and other attributes of an email address.
It returns a detailed dictionary containing information about the email's format, domain,
and SMTP server.

Args:
    email (str): The email address to validate.

Returns:
    dict[str, Any]: A dictionary containing detailed validation results. The dictionary
    includes the following keys:
        - "email" (str): The email address being validated.
        - "autocorrect" (str): Suggested autocorrection if the email is invalid or malformed.
        - "deliverability" (str): The deliverability status of the email (e.g., "DELIVERABLE").
        - "quality_score" (str): A score representing the quality of the email address.
        - "is_valid_format" (dict): Whether the email is in a valid format.
            - "value" (bool): True if the format is valid, False otherwise.
            - "text" (str): A textual representation of the format validity (e.g., "TRUE").
        - "is_free_email" (dict): Whether the email is from a free email provider.
            - "value" (bool): True if the email is from a free provider, False otherwise.
            - "text" (str): A textual representation (e.g., "TRUE").
        - "is_disposable_email" (dict): Whether the email is from a disposable email service.
            - "value" (bool): True if the email is disposable, False otherwise.
            - "text" (str): A textual representation (e.g., "FALSE").
        - "is_role_email" (dict): Whether the email is a role-based email (e.g., "admin@domain.com").
            - "value" (bool): True if the email is role-based, False otherwise.
            - "text" (str): A textual representation (e.g., "FALSE").
        - "is_catchall_email" (dict): Whether the domain uses a catch-all email address.
            - "value" (bool): True if the domain is catch-all, False otherwise.
            - "text" (str): A textual representation (e.g., "FALSE").
        - "is_mx_found" (dict): Whether MX records are found for the email domain.
            - "value" (bool): True if MX records are found, False otherwise.
            - "text" (str): A textual representation (e.g., "TRUE").
        - "is_smtp_valid" (dict): Whether the SMTP server for the email domain is valid.
            - "value" (bool): True if the SMTP server is valid, False otherwise.
            - "text" (str): A textual representation (e.g., "TRUE").

Example:
    >>> await verify_email("thanos@snap.io")
    {
        "email": "thanos@snap.io",
        "autocorrect": "",
        "deliverability": "UNDELIVERABLE",
        "quality_score": "0.00",
        "is_valid_format": {
            "value": true,
            "text": "TRUE"
        },
        "is_free_email": {
            "value": false,
            "text": "FALSE"
        },
        "is_disposable_email": {
            "value": false,
            "text": "FALSE"
        },
        "is_role_email": {
            "value": false,
            "text": "FALSE"
        },
        "is_catchall_email": {
            "value": false,
            "text": "FALSE"
        },
        "is_mx_found": {
            "value": false,
            "text": "FALSE"
        },
        "is_smtp_valid": {
            "value": false,
            "text": "FALSE"
        }
    }
Raises:
    ValueError: If the API key is not found in the environment variables.
    requests.exceptions.HTTPError: If the API request fails (e.g., 4xx or 5xx error).
    Exception: For any other unexpected errors.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYes

Implementation Reference

  • The @mcp.tool()-decorated async function that implements the verify_email tool logic. It calls the Abstract API to validate the provided email address and returns the API response as a dictionary.
    @mcp.tool()
    async def verify_email(email: str) -> dict[str, Any]:
        """
        Validates an email address using an external email validation API of abstractapi.
    
        This function checks the validity, deliverability, and other attributes of an email address.
        It returns a detailed dictionary containing information about the email's format, domain,
        and SMTP server.
    
        Args:
            email (str): The email address to validate.
    
        Returns:
            dict[str, Any]: A dictionary containing detailed validation results. The dictionary
            includes the following keys:
                - "email" (str): The email address being validated.
                - "autocorrect" (str): Suggested autocorrection if the email is invalid or malformed.
                - "deliverability" (str): The deliverability status of the email (e.g., "DELIVERABLE").
                - "quality_score" (str): A score representing the quality of the email address.
                - "is_valid_format" (dict): Whether the email is in a valid format.
                    - "value" (bool): True if the format is valid, False otherwise.
                    - "text" (str): A textual representation of the format validity (e.g., "TRUE").
                - "is_free_email" (dict): Whether the email is from a free email provider.
                    - "value" (bool): True if the email is from a free provider, False otherwise.
                    - "text" (str): A textual representation (e.g., "TRUE").
                - "is_disposable_email" (dict): Whether the email is from a disposable email service.
                    - "value" (bool): True if the email is disposable, False otherwise.
                    - "text" (str): A textual representation (e.g., "FALSE").
                - "is_role_email" (dict): Whether the email is a role-based email (e.g., "admin@domain.com").
                    - "value" (bool): True if the email is role-based, False otherwise.
                    - "text" (str): A textual representation (e.g., "FALSE").
                - "is_catchall_email" (dict): Whether the domain uses a catch-all email address.
                    - "value" (bool): True if the domain is catch-all, False otherwise.
                    - "text" (str): A textual representation (e.g., "FALSE").
                - "is_mx_found" (dict): Whether MX records are found for the email domain.
                    - "value" (bool): True if MX records are found, False otherwise.
                    - "text" (str): A textual representation (e.g., "TRUE").
                - "is_smtp_valid" (dict): Whether the SMTP server for the email domain is valid.
                    - "value" (bool): True if the SMTP server is valid, False otherwise.
                    - "text" (str): A textual representation (e.g., "TRUE").
    
        Example:
            >>> await verify_email("thanos@snap.io")
            {
                "email": "thanos@snap.io",
                "autocorrect": "",
                "deliverability": "UNDELIVERABLE",
                "quality_score": "0.00",
                "is_valid_format": {
                    "value": true,
                    "text": "TRUE"
                },
                "is_free_email": {
                    "value": false,
                    "text": "FALSE"
                },
                "is_disposable_email": {
                    "value": false,
                    "text": "FALSE"
                },
                "is_role_email": {
                    "value": false,
                    "text": "FALSE"
                },
                "is_catchall_email": {
                    "value": false,
                    "text": "FALSE"
                },
                "is_mx_found": {
                    "value": false,
                    "text": "FALSE"
                },
                "is_smtp_valid": {
                    "value": false,
                    "text": "FALSE"
                }
            }
        Raises:
            ValueError: If the API key is not found in the environment variables.
            requests.exceptions.HTTPError: If the API request fails (e.g., 4xx or 5xx error).
            Exception: For any other unexpected errors.
        """
        # Check if the API key is available
        if not ABSTRACT_API_KEY:
            raise ValueError("API key not found in environment variables.")
    
        # Construct the API URL
        api_url = f"{ABSTRACT_API_URL}?api_key={ABSTRACT_API_KEY}&email={email}"
    
        try:
            # Make the API request (ignoring SSL verification)
            response = requests.get(api_url, verify=False)
            response.raise_for_status()  # Raise an error for bad responses (4xx, 5xx)
    
            # Parse the JSON response
            result = response.json()
    
            # Return the validation results
            return result
    
        except requests.exceptions.HTTPError as http_err:
            # Handle HTTP errors (e.g., 4xx, 5xx)
            raise requests.exceptions.HTTPError(f"HTTP error occurred: {http_err}")
        except Exception as err:
            # Handle any other errors
            raise Exception(f"An error occurred: {err}")
  • server.py:22-22 (registration)
    The @mcp.tool() decorator registers the verify_email function as an MCP tool.
    @mcp.tool()
  • Type hints defining the input schema (email: str) and output schema (dict[str, Any]) for the verify_email tool.
    async def verify_email(email: str) -> dict[str, Any]:
Behavior4/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 effectively describes the tool's behavior: it uses an external API, returns detailed validation results, and includes error handling (raises exceptions for missing API key, HTTP errors, or other issues). It covers key aspects like what the tool does and potential failures, though it could add more on rate limits or performance.

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

Conciseness4/5

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

The description is well-structured with clear sections (purpose, args, returns, example, raises) and front-loaded key information. However, it includes an extensive example and detailed return value breakdown that might be verbose; some of this could be streamlined without losing clarity, but overall it remains efficient and informative.

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

Completeness5/5

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

Given the tool's complexity (external API integration, detailed output) and no annotations or output schema, the description is highly complete. It covers purpose, parameters, return values with examples, and error handling, providing all necessary context for an AI agent to understand and use the tool effectively without relying on structured fields.

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

Parameters5/5

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

Schema description coverage is 0%, so the description must compensate. It provides detailed parameter semantics: 'email (str): The email address to validate.' This adds clear meaning beyond the bare schema, explaining the parameter's purpose and type, which is essential given the low schema coverage.

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

Purpose5/5

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

The description clearly states the tool's purpose: 'Validates an email address using an external email validation API of abstractapi.' It specifies the verb ('validates'), resource ('email address'), and method ('external email validation API'), distinguishing it from sibling tools like 'check_email_reputation' which likely focuses on reputation rather than validation, and 'validate_phone' which handles a different resource type.

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

Usage Guidelines3/5

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

The description implies usage for email validation but does not explicitly state when to use this tool versus alternatives like 'check_email_reputation'. It mentions checking 'validity, deliverability, and other attributes', which suggests use cases, but lacks explicit guidance on when to choose this over siblings or when not to use it (e.g., for simple format checks only).

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/avivshafir/abstractapi-mcp-server'

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