Finds elements in the first array that don't exist in the second array. Use via MCP in Cursor or Windsurf, or call GET /v1/array/difference with JSON arrays. Returns [1,3] when comparing [1,2,3] against [2,4]. Performs exact value matching using JavaScript's includes() method for reliable set operations.
curl "https://tinyfn.io/v1/array/difference" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/difference', {
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/difference',
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"
}
}
}
}
It preserves duplicates from the first array. If array1 has [1,1,2] and array2 has [2], the result is [1,1].
Difference returns items in array1 NOT in array2, while intersection returns items present in BOTH arrays.
Yes, it's perfect for filtering datasets in Cursor or Claude Code. Compare user lists, remove processed items, or exclude blacklisted values.
Uses strict equality comparison. Numbers, strings, and booleans work reliably, but objects are compared by reference, not content.
Empty first array returns empty result. Empty second array returns the complete first array since nothing gets excluded.
Get your free API key and start using Array Difference in seconds.
Get Free API Key