Miscellaneous Utilities

Chunk Array

Splits arrays into smaller chunks of specified size for batch processing or pagination. Available via MCP in Cursor and other AI coding tools, or REST API at `/v1/misc/chunk`. Pass an array and chunk size — get back nested arrays. Perfect for processing large datasets in manageable batches or implementing pagination logic.

API Endpoint

GET /v1/misc/chunk

Code Examples

curl "https://tinyfn.io/v1/misc/chunk" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/misc/chunk', {
  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/chunk',
    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 chunk an array into groups of 3 items?

Send a GET request with your array and size=3. For example, [1,2,3,4,5,6,7] becomes [[1,2,3],[4,5,6],[7]].

What happens if the last chunk is smaller than the specified size?

The final chunk contains the remaining items even if fewer than the chunk size. This is standard chunking behavior for uneven divisions.

Can I use chunk array in MCP tools for batch processing data?

Yes, it's ideal for breaking large datasets into batches before processing in Claude Code, Cursor, or other MCP-enabled editors.

What's the maximum chunk size I can specify?

The chunk size must be a positive integer. Very large chunk sizes are pointless but technically allowed — you'd just get fewer, larger chunks.

Does chunk array work with strings or just numbers?

Works with any array elements — strings, objects, numbers, booleans. The chunking logic operates on array positions, not content types.

Try Chunk Array Now

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

Get Free API Key