Formatting Utilities

Format Ordinal

Converts integers to ordinal strings like "1st", "2nd", "3rd", "21st". Use via MCP in Cursor or Windsurf for natural language processing, or call GET /v1/format/ordinal?number=42 to get "42nd". Handles English ordinal suffixes correctly, including edge cases like 11th-13th that break typical -st/-nd/-rd patterns.

API Endpoint

GET /v1/format/ordinal

Code Examples

curl "https://tinyfn.io/v1/format/ordinal" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/format/ordinal', {
  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/ordinal',
    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 a number as an ordinal using MCP?

Call the format_ordinal tool with your number. It returns the properly suffixed string like '1st', '2nd', '3rd', handling all English ordinal rules including the 11th-13th exceptions.

What's the REST API endpoint for ordinal formatting?

GET /v1/format/ordinal?number=VALUE where VALUE is your integer. Returns JSON with the formatted ordinal string.

Does ordinal formatting handle negative numbers?

Yes, it works with negative integers, returning forms like '-1st', '-2nd'. The ordinal suffix rules apply the same way regardless of sign.

Why do 11th, 12th, 13th end in -th instead of -st, -nd, -rd?

English ordinals have special cases for numbers ending in 11, 12, 13 — they always use -th suffix, not the typical -st/-nd/-rd pattern.

Can AI agents use this for generating natural language rankings?

Absolutely. Claude, GPT, and other models use this MCP tool to correctly format rankings, dates, and sequences without hallucinating incorrect ordinal forms.

Try Format Ordinal Now

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

Get Free API Key