Converts any string into a filesystem-safe filename by removing or replacing problematic characters. Use via MCP in Cursor/Windsurf or GET /v1/slug/filename-safe with your text. Perfect for AI agents generating files from user input — "My Project #1.doc" becomes "My-Project-1.doc" while preserving readability and avoiding OS conflicts.
curl "https://tinyfn.io/v1/slug/filename-safe" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/slug/filename-safe', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/slug/filename-safe',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's url/slug tools:
{
"mcpServers": {
"tinyfn-slug": {
"url": "https://tinyfn.io/mcp/slug",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Removes illegal characters like <, >, :, ", |, ?, *, / and \ while replacing spaces with hyphens. Also handles reserved names like CON, PRN, AUX on Windows.
AI agents in Cursor or Cline can sanitize user-provided titles before creating files, ensuring cross-platform compatibility without manual intervention.
Maintains reasonable length while preserving file extensions. Long names get truncated intelligently to stay under filesystem limits.
Each API call processes one string. For batch operations, make multiple requests or integrate into your processing loop.
Filename-safe preserves more characters and file extensions, while slugs are optimized for URLs with stricter character limitations.
Get your free API key and start using Filename Safe in seconds.
Get Free API Key