Array Utilities

Array Symmetric Difference

Finds elements that exist in either array but not in both — the symmetric difference operation. Access via MCP in Cursor or Windsurf, or call GET /v1/array/symmetric-difference directly. Pass two arrays like [1,2,3] and [2,3,4] to get [1,4]. Returns deterministic results perfect for set operations in AI workflows.

API Endpoint

GET /v1/array/symmetric-difference

Code Examples

curl "https://tinyfn.io/v1/array/symmetric-difference" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/array/symmetric-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/symmetric-difference',
    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

What is symmetric difference of two arrays?

Items that appear in either array but not in both. If array A has [1,2,3] and array B has [2,3,4], the symmetric difference is [1,4].

How do I use array symmetric difference with MCP in Cursor?

Connect TinyFn's MCP server and call the array_symmetric_difference tool with your two arrays. Perfect for AI agents comparing datasets or finding unique elements.

Does symmetric difference preserve order or remove duplicates?

Implementation varies by tool — some preserve insertion order, others don't. Check the specific response format for your use case.

Can I find symmetric difference of arrays with different data types?

Yes, works with mixed types like strings, numbers, booleans. Elements are compared by value, so [1, '1'] treats the number 1 and string '1' as different.

What's the difference between symmetric difference and regular array difference?

Regular difference is A minus B (items in A but not B). Symmetric difference is (A minus B) plus (B minus A) — items unique to either array.

Try Array Symmetric Difference Now

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

Get Free API Key