Miscellaneous Utilities

Sort Items

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.

API Endpoint

GET /v1/misc/sort

Code Examples

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)

Use via MCP

Add to your AI agent

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"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I sort an array of mixed strings and numbers?

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').

What's the difference between natural sorting and alphabetical sorting?

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).

Can I use this MCP tool for case-insensitive sorting in Cursor?

Yes, the tool includes case sensitivity parameters. Set case_sensitive to false for case-insensitive sorting of text data.

What happens if I pass an empty array or null values?

Empty arrays return empty results. Null values are typically moved to the beginning or end depending on the sort configuration, ensuring predictable behavior.

How does this compare to JavaScript's Array.sort() method?

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.

Try Sort Items Now

Get your free API key and start using Sort Items in seconds.

Get Free API Key