Finds common elements between two arrays with deterministic results. Use via MCP in Cursor or Windsurf, or call GET /v1/array/intersection directly. Returns [2, 3] for arrays [1, 2, 3] and [2, 3, 4]. Preserves order from the first array and handles duplicates predictably.
curl "https://tinyfn.io/v1/array/intersection" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/intersection', {
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/intersection',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
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"
}
}
}
}
Returns each intersecting element only once, even if it appears multiple times in either input array. Order follows the first array's sequence.
Returns an empty array []. No errors or null values — just an empty result set.
Works with primitive values (strings, numbers, booleans). For nested structures, elements must match exactly including deep equality.
Intersection finds shared elements between arrays. Union combines all unique elements, difference finds elements in first array but not second.
Yes, intersection results maintain the order of elements as they appear in the first input array. Deterministic output every time.
Get your free API key and start using Array Intersection in seconds.
Get Free API Key