Sorts arrays of strings, numbers, or mixed data types using configurable algorithms. Call via MCP in AI coding tools or GET /v1/misc/sort REST endpoint. Supports ascending/descending order, case sensitivity options, and natural sorting for alphanumeric strings. Returns deterministic results perfect for data preprocessing in Claude Code or Cursor workflows.
curl "https://tinyfn.io/v1/misc/sort" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/misc/sort', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/misc/sort',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's miscellaneous tools:
{
"mcpServers": {
"tinyfn-misc": {
"url": "https://tinyfn.io/mcp/misc",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
The tool handles mixed data types by converting everything to strings first, then applying the specified sort algorithm. Numbers become string representations (e.g., 10 becomes '10').
Natural sorting treats embedded numbers correctly (file1.txt, file2.txt, file10.txt), while alphabetical sorting treats everything as pure strings (file1.txt, file10.txt, file2.txt).
Yes, the tool includes case sensitivity parameters. Set case_sensitive to false for case-insensitive sorting of text data.
Empty arrays return empty results. Null values are typically moved to the beginning or end depending on the sort configuration, ensuring predictable behavior.
This tool provides more sorting options and consistent behavior across platforms, plus it's accessible to AI agents that can't execute arbitrary JavaScript code.