Miscellaneous Utilities

Compare

Compare performs deep equality checks between any two values — strings, numbers, objects, arrays, or mixed types. Use via MCP in Cursor or call GET /v1/misc/compare with value1 and value2 parameters. Returns boolean true/false with detailed comparison metadata. Handles nested structures and type coercion consistently.

API Endpoint

GET /v1/misc/compare

Code Examples

curl "https://tinyfn.io/v1/misc/compare" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/misc/compare', {
  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/compare',
    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 does the compare tool handle different data types?

It performs strict equality checking by default, so string '5' does not equal number 5. Use type coercion parameters to enable flexible comparisons across types.

Can I compare nested JSON objects and arrays?

Yes, the tool recursively compares all nested properties and array elements. It returns detailed metadata about which specific fields differ in complex structures.

What's the difference between this and simple == comparison in code?

This tool provides structured comparison results with metadata, handles edge cases consistently, and works across different programming contexts via MCP or REST API.

How do MCP agents use the compare tool effectively?

AI agents can validate data transformations, check API response consistency, or verify that generated content matches expected formats before proceeding with workflows.

Does the compare tool handle null, undefined, and empty values properly?

Yes, it distinguishes between null, undefined, empty strings, empty objects, and empty arrays. Each is treated as a distinct value type in comparisons.

Try Compare Now

Get your free API key and start using Compare in seconds.

Get Free API Key