Data Format Validation - Instructions
Overview
Validate data formats including emails, URLs, JSON, UUIDs, IP addresses, credit cards, phone numbers, colors, ISBNs, IBANs, MAC addresses, Base64, and regex patterns. Each action returns whether the input is valid along with format-specific details.
Parameters
- action (required): The validation action to perform.
- text (required): The string to validate.
Actions
validate-json
Validate whether a string is well-formed JSON. Also used by validate-json-syntax.
- text (required): The JSON string to check.
Example:
{ "action": "validate-json", "text": "{\"name\": \"Alice\", \"age\": 30}" }
Returns: valid status, parsed type (dict, list, etc.).
validate-email
Validate an email address format (RFC 5322 simplified).
- text (required): The email address to validate.
Example:
{ "action": "validate-email", "text": "user@example.com" }
Returns: valid status, local_part, domain.
validate-uuid
Validate a UUID string (versions 1-5, RFC 4122).
- text (required): The UUID to validate.
Example:
{ "action": "validate-uuid", "text": "550e8400-e29b-41d4-a716-446655440000" }
Returns: valid status, version number, variant.
validate-base64
Validate whether a string is properly Base64-encoded.
- text (required): The Base64 string to validate.
Example:
{ "action": "validate-base64", "text": "SGVsbG8gV29ybGQ=" }
Returns: valid status, decoded byte length.
validate-url
Validate a URL format (checks for scheme and domain).
- text (required): The URL to validate.
Example:
{ "action": "validate-url", "text": "https://www.example.com/path?q=test#section" }
Returns: valid status, scheme, domain, path, has_query, has_fragment.
validate-ipv4
Validate an IPv4 address and classify it.
- text (required): The IPv4 address to validate.
Example:
{ "action": "validate-ipv4", "text": "192.168.1.1" }
Returns: valid status, octets, is_private, is_loopback.
validate-ipv6
Validate an IPv6 address and classify it.
- text (required): The IPv6 address to validate.
Example:
{ "action": "validate-ipv6", "text": "2001:0db8:85a3:0000:0000:8a2e:0370:7334" }
Returns: valid status, is_loopback, is_link_local, compressed.
validate-mac-address
Validate a MAC address (colon or hyphen separated).
- text (required): The MAC address to validate.
Example:
{ "action": "validate-mac-address", "text": "00:1A:2B:3C:4D:5E" }
Returns: valid status, format (colon/hyphen-separated), octets, canonical form.
validate-credit-card
Validate a credit card number using the Luhn algorithm and detect card type.
- text (required): The card number (spaces and hyphens are stripped automatically).
Example:
{ "action": "validate-credit-card", "text": "4111 1111 1111 1111" }
Returns: valid status, card_type (Visa, Mastercard, Amex, Discover), length, last_four.
validate-phone
Validate a phone number format (10-15 digits, optional international prefix).
- text (required): The phone number to validate (parentheses, spaces, hyphens, dots are stripped).
Example:
{ "action": "validate-phone", "text": "+1 (555) 123-4567" }
Returns: valid status, international flag, digit_count, formatted number.
validate-hex-color
Validate a hex color code (#RGB or #RRGGBB).
- text (required): The hex color string to validate.
Example:
{ "action": "validate-hex-color", "text": "#FF5733" }
Returns: valid status, format (short/long), RGB values or expanded form.
validate-isbn
Validate an ISBN-10 or ISBN-13 (with checksum verification).
- text (required): The ISBN to validate (hyphens and spaces are stripped).
Example:
{ "action": "validate-isbn", "text": "978-0-306-40615-7" }
Returns: valid status, format (ISBN-10 or ISBN-13), cleaned ISBN.
validate-iban
Validate an International Bank Account Number (mod-97 checksum).
- text (required): The IBAN to validate (spaces are stripped).
Example:
{ "action": "validate-iban", "text": "GB29 NWBK 6016 1331 9268 19" }
Returns: valid status, country_code, check_digits, BBAN.
validate-regex
Validate whether a string is a compilable regular expression.
- text (required): The regex pattern to validate.
Example:
{ "action": "validate-regex", "text": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+$" }
Returns: valid status. If invalid, returns the specific regex error.
validate-json-syntax
Alias for validate-json. Validates whether a string is well-formed JSON.
- text (required): The JSON string to check.
Example:
{ "action": "validate-json-syntax", "text": "[1, 2, 3]" }
Common Workflows
- Data ingestion pipeline: Use
validate-jsonto check incoming payloads,validate-emailfor contact fields, andvalidate-urlfor link fields before processing. - Network configuration audit: Combine
validate-ipv4,validate-ipv6, andvalidate-mac-addressto verify device configuration data. - E-commerce checkout: Use
validate-credit-cardto pre-check card numbers,validate-emailfor customer email, andvalidate-phonefor contact number. - Book catalog management: Use
validate-isbnto verify book identifiers during import. - Financial data validation: Use
validate-ibanto verify bank account numbers in international transactions.
Important Notes
- All actions require the
textparameter. - Whitespace, hyphens, and common separators are automatically stripped where appropriate (credit cards, phone numbers, ISBNs, IBANs, MAC addresses).
- Credit card validation uses the Luhn algorithm and detects Visa, Mastercard, American Express, and Discover.
- UUID validation supports versions 1 through 5.
- Phone validation accepts 10-15 digit numbers with optional international (+) prefix.
- IBAN validation uses the mod-97 checksum per ISO 13616.
- Every response includes a
validboolean and a descriptivemessage.







