Array Utilities

Array Zip

Array Zip combines two arrays element-wise into pairs, creating a new array of tuples. Access via MCP in Cursor or Windsurf, or REST at GET /v1/array/zip with arrays as parameters. Returns [[a1,b1], [a2,b2], ...] format. Stops at the shorter array's length, making it safe for mismatched sizes.

API Endpoint

GET /v1/array/zip

Code Examples

curl "https://tinyfn.io/v1/array/zip" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/zip', {
  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/zip',
    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 does array zip handle arrays of different lengths?

Zip stops at the length of the shorter array, discarding extra elements from the longer array without errors.

What format does the zipped array return?

Returns an array of two-element arrays (tuples): [[first_array[0], second_array[0]], [first_array[1], second_array[1]], ...].

Can I zip arrays with different data types?

Yes, array zip works with mixed types. You can zip strings with numbers, booleans with objects, etc.

How do I use array zip in MCP-enabled editors like Claude Code?

Call the array_zip tool with two array parameters. The AI agent gets deterministic pairing instead of potentially incorrect manual iteration.

What happens when I zip empty arrays?

Zipping with any empty array returns an empty array, regardless of the other array's contents.

Try Array Zip Now

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

Get Free API Key