# Phone Validator Engine MCP

> Phone Validator Engine validates and formats messy phone numbers into standardized E.164 format. This MCP stops your AI clients from hallucinating incorrect or unusable phone data, ensuring every number passed to downstream services is mathematically perfect and ready for telecom APIs.

## Overview
- **Category:** developer-tools
- **Price:** Free
- **Tags:** phone-validation, e164, data-cleaning, formatting, telecom, input-sanitization

## Description

LLMs are great at chat, but they hate structured data like phone numbers. When users type in messy inputs—like `(555) 123-4567` or `+1-555-123-4567`—your agent might pass the bad string to a system that needs pure E.164 format, and it will fail. This MCP brings Google's phone number validation logic directly into your workflow. It checks if an input is structurally valid and cleans up all the extra characters until you get one reliable standard: `+CCXXXXXXXXXX`. Connecting this validator through Vinkius means any compatible AI client can run a quick check before sending data, eliminating failure points related to formatting or country code ambiguity.

## Tools

### validate_phone
Pass a raw phone number string and an optional country code; the tool returns a validated, formatted E.164 standard number or flags it as invalid.

## Prompt Examples

**Prompt:** 
```
Clean and format this messy user input into an E.164 phone number: '+44 (0) 20 7946 0958'
```

**Response:** 
```
✅ **Result:** Perfectly mapped to E.164 format: `+442079460958`
```

**Prompt:** 
```
Check if the input `11 98888-0000` is structurally valid, assuming the default country is Brazil (`BR`).
```

**Response:** 
```
✅ **Validation Status:** Valid.
- **Country:** `BR`
- **E.164:** `+5511988880000`
```

**Prompt:** 
```
Extract the Alpha-2 Country Code from this international number: `+1-415-555-2671`.
```

**Response:** 
```
✅ **Country Identified:** The number strictly belongs to `US` (United States).
```

## Capabilities

### Standardize phone number formats
It cleans up messy inputs—parentheses, dashes, spaces—and outputs only the required E.164 string.

### Validate structure and existence
The engine checks if the number sequence actually follows a plausible phone number pattern for its supposed country.

### Determine country code
It identifies the originating country of the number, even if the user didn't specify it initially.

### Prevent data hallucinations
Your agent can run a check on any raw text input to guarantee phone numbers are accurate before actioning anything.

## Use Cases

### Cleaning up scraped lead data
A Sales Ops analyst scrapes 100 leads from a website. Instead of copy-pasting raw numbers that use dashes and parentheses, they run the batch through `validate_phone`. The output is a clean list of E.164 numbers ready to import directly into the CRM.

### Handling user chat inputs
A support agent uses an AI assistant to summarize a customer's issue, which includes phone numbers typed in various formats (e.g., `(212) 555-1234`). They pass the number through `validate_phone` before creating a ticket, guaranteeing the contact method is usable.

### Validating agent conversation context
A developer builds an agent that needs to confirm a client's phone number. Rather than letting the raw chat text pass through, the agent first calls `validate_phone` on the user input, immediately flagging it if the structure is wrong.

### Building reliable signup forms
When integrating this MCP into an automated sign-up flow, you use its validation to ensure that even if a user enters text instead of digits, the system catches it and forces correct formatting before accepting the data.

## Benefits

- Avoid API failures. Instead of sending a messy string that breaks your telecom service, the `validate_phone` tool guarantees the output is in strict E.164 format.
- Save manual cleanup time. You don't have to write custom regex for every country code; this MCP handles global phone number formatting automatically.
- Improve data integrity instantly. Before a number hits your database, you run it through validation, confirming its structural validity and identifying the correct country source.
- Reduce LLM risk. Your agents won't hallucinate bad contacts. They validate every input using `validate_phone` before suggesting an action or creating a record.
- Support global operations. Whether the number is from Brazil, France, or the US, the engine processes it correctly and reliably.

## How It Works

The bottom line is you get guaranteed data quality for phone numbers before they leave your agent's hands.

1. You pass the raw, unvalidated phone number string (and optionally a country code) to the MCP.
2. The engine runs Google's library logic against that input, checking its structure and assigning it a definitive E.164 format.
3. You receive back a clear status: either a confirmed, standardized E.164 number or an explicit failure message.

## Frequently Asked Questions

**What kind of inputs does the Phone Validator Engine handle?**
It handles virtually any raw phone string input—including those with spaces, dashes, parentheses, or international prefixes. The tool strips all non-numeric characters to standardize the data.

**Does validate_phone detect fake numbers?**
Yes, it validates structure against known global patterns. If a number sequence is structurally impossible for its purported country code, the tool flags it as invalid.

**Is E.164 format mandatory when using validate_phone?**
Yes, the primary function of this MCP is to convert all inputs into the universally accepted E.164 standard. This ensures compatibility with global communication APIs.

**Can I tell validate_phone what country code to assume?**
You can pass an optional country code alongside the raw number string. This helps the tool accurately determine the intended format if the number itself is ambiguous.

**What happens if validate_phone fails?**
The tool returns a clear failure message, allowing your agent to catch the error immediately and prompt the user for corrected input instead of proceeding with bad data.