validate_email
Validates that a string is a syntactically well-formed email address in local-part@domain format (RFC 5322). Returns a valid flag and, on failure, a human-readable reason explaining the structural problem.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Yes | The email address string to validate. |
Response
| Field | Type | Description |
|---|---|---|
valid | boolean | true if the address is syntactically well-formed, false otherwise. |
reason | string | null | Short explanation of why the address is invalid; null when valid. |
Examples
Valid address
{
"email": "user@example.com"
}
Result:
{
"valid": true,
"reason": null
}
Invalid address — missing @
{
"email": "userexample.com"
}
Result:
{
"valid": false,
"reason": "Missing '@' separator between local part and domain."
}
Invalid address — no TLD
{
"email": "user@localhost"
}
Result:
{
"valid": false,
"reason": "Domain must contain at least one dot separating labels (e.g. 'example.com')."
}
Errors
Each failure carries a precise code in the response. Argument-schema and server errors are JSON-RPC protocol errors; a rejected value is returned as a tool result with isError: true (so the agent can read the code and self-correct).
An invalid email is not an error — the tool returns valid: false with a reason. Only an ill-formed request or a server fault can fail.
| Code | When | Delivered as |
|---|---|---|
invalid_arguments | An argument is missing or the wrong type. | protocol error (invalid_params) |
internal_error | An unexpected server error. | protocol error (internal_error) |
Notes
- Validation is purely structural — no DNS or MX-record lookup is performed. A syntactically valid address may still be undeliverable.
- Leading and trailing whitespace is ignored before validation.
- The check is case-insensitive (both
User@Example.COManduser@example.comare accepted).