Array Utilities

Array Reverse

Reverses array elements in deterministic order using `/v1/array/reverse`. Pass any array via MCP in Cursor or Claude Code, or send JSON arrays to the REST endpoint. Returns `[3,2,1]` from `[1,2,3]`. Handles nested arrays, mixed types, and preserves original data structure perfectly.

API Endpoint

GET /v1/array/reverse

Code Examples

curl "https://tinyfn.io/v1/array/reverse" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/reverse', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/array/reverse',
    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 array tools:

{
  "mcpServers": {
    "tinyfn-array": {
      "url": "https://tinyfn.io/mcp/array",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I reverse an array with the MCP tool?

Call the array reverse tool through your MCP-enabled editor with your array as input. It works with any data types including strings, numbers, objects, and nested arrays.

Does array reverse modify the original array or create a new one?

Creates a new reversed array without modifying the original. The function is deterministic and side-effect free.

Can I reverse arrays containing mixed data types?

Yes, it preserves all data types exactly. Arrays with strings, numbers, objects, booleans, and null values are all supported.

What happens when I reverse an empty array?

Returns an empty array `[]`. The operation is safe for edge cases including single-element and empty arrays.

How does this compare to JavaScript's array.reverse()?

Unlike JavaScript's built-in reverse() which mutates the original array, TinyFn's version returns a new array, making it safer for functional programming patterns.

Try Array Reverse Now

Get your free API key and start using Array Reverse in seconds.

Get Free API Key