Formatting Utilities

Format Truncate

Cuts text to a specified maximum length with optional ellipsis handling. Use via MCP in Cursor or Windsurf, or call GET /v1/format/truncate with text and length parameters. Perfect for preview snippets, UI constraints, or data processing where content needs consistent sizing. Returns deterministic results unlike AI-generated summaries.

API Endpoint

GET /v1/format/truncate

Code Examples

curl "https://tinyfn.io/v1/format/truncate" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/format/truncate', {
  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/truncate',
    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 truncate text to 100 characters with ellipsis?

Pass your text and max_length=100 parameters. The tool will cut at exactly 100 characters and can optionally append '...' if the original text was longer.

Does Format Truncate preserve word boundaries when cutting text?

The basic truncation cuts at the exact character limit. For word-boundary preservation, you'd need to post-process or use a different approach depending on your specific requirements.

Can I use Format Truncate in MCP tools like Cline for batch text processing?

Yes, MCP integration lets you truncate multiple strings programmatically in AI workflows. Useful for standardizing data lengths before further processing or display.

What happens if my text is shorter than the maximum length?

The text returns unchanged. No padding or modification occurs when content is already within the specified limit.

How does Format Truncate handle Unicode characters and emojis?

It counts by Unicode code points, so multi-byte characters like emojis count as single characters. This ensures consistent behavior across different character sets.

Try Format Truncate Now

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

Get Free API Key