verify_email
Validate email addresses for validity using the 2ip.me API. Provides a JSON response indicating whether the email exists without requiring an API key.
Instructions
Verify an email address using the 2ip.me API.
Args:
email (str): The email address to verify
Returns:
str: "true" or "false" indicating if the email is valid
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes |
Implementation Reference
- src/email_checker/tools.py:12-23 (handler)The main MCP tool handler for 'verify_email', decorated with @mcp.tool(). Delegates to EmailValidatorAPI.verify_email.@mcp.tool() async def verify_email(email: str) -> str: """ Verify an email address using the 2ip.me API. Args: email (str): The email address to verify Returns: str: "true" or "false" indicating if the email is valid """ return await api.verify_email(email)
- Helper method in EmailValidatorAPI that performs the actual email verification by calling the 2ip.me API via make_request.async def verify_email(self, email: str) -> str: """Verify an email address.""" result = await self.make_request(email) if result is None: return "Error: Unable to verify email" return result
- Low-level helper that makes the HTTP request to the 2ip.me email validation API.async def make_request(self, email: str) -> str | None: """Make a request to the 2ip.me API with proper error handling.""" url = f"{self.api_base}?email={email}" async with httpx.AsyncClient() as client: try: response = await client.get(url, timeout=30.0) response.raise_for_status() return response.text.strip() except Exception as e: logger.error(f"API request failed: {str(e)}") return None
- src/email_checker/tools.py:9-9 (registration)Initialization of the FastMCP server instance used for tool registration.mcp = FastMCP("email-checker")