Skip to main content
Glama
avivshafir

abstractapi-mcp-server

verify_email

Validate email addresses to ensure format, deliverability, and domain health. Returns detailed results including format validity, SMTP server status, and disposability checks for accurate email verification.

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

NameRequiredDescriptionDefault
emailYes

Input Schema (JSON Schema)

{ "properties": { "email": { "title": "Email", "type": "string" } }, "required": [ "email" ], "title": "verify_emailArguments", "type": "object" }

Implementation Reference

  • The complete implementation of the 'verify_email' tool handler. It is decorated with @mcp.tool() for registration and FastMCP integration. The function validates the email using AbstractAPI's email validation service, handling API requests, errors, and returning detailed validation results including deliverability, quality score, format validity, and more.
    @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 in the FastMCP server.
    @mcp.tool()
  • The function signature and comprehensive docstring define the input schema (email: str) and detailed output schema (dict with specific keys like deliverability, quality_score, is_valid_format, etc.).
    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. """

Other Tools

Related 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