Formatting Utilities

Format Phone

Standardizes phone numbers into proper country-specific formats. Use via MCP in Cursor or Windsurf for contact processing, or call GET /v1/format/phone with raw number strings. Returns consistently formatted output like "+1 (555) 123-4567" for US numbers. Handles international prefixes and validates number structure automatically.

API Endpoint

GET /v1/format/phone

Code Examples

curl "https://tinyfn.io/v1/format/phone" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/format/phone', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/format/phone',
    headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)

Use via MCP

Add to your AI agent

Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's formatting tools:

{
  "mcpServers": {
    "tinyfn-format": {
      "url": "https://tinyfn.io/mcp/format",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I format phone numbers in MCP-enabled editors like Cursor?

Use the format_phone tool with the raw number as input. It automatically detects country codes and applies proper formatting conventions.

What phone number formats does the API recognize as input?

Accepts various formats: raw digits, numbers with spaces, dashes, parentheses, or international prefixes. Strips formatting before processing.

Does the formatter validate if phone numbers are actually valid?

Yes, it checks number length and structure against country-specific rules. Invalid numbers return error messages instead of formatted output.

Can I specify which country format to use for ambiguous numbers?

The tool auto-detects from country codes when present. For numbers without prefixes, it defaults to common regional formats based on digit patterns.

What's the difference between this and basic string formatting?

This tool understands international dialing rules, validates number structure, and applies country-specific conventions rather than simple pattern matching.

Try Format Phone Now

Get your free API key and start using Format Phone in seconds.

Get Free API Key