Miscellaneous Utilities

In Range

Validates whether a numeric value falls within specified bounds using configurable inclusivity. Access via MCP in Cursor or Windsurf for AI-driven validation, or GET /v1/misc/range for direct API calls. Returns boolean result with boundary details. Handles edge cases like floating-point precision and infinity values deterministically.

API Endpoint

GET /v1/misc/range

Code Examples

curl "https://tinyfn.io/v1/misc/range" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/misc/range', {
  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/range',
    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 check if a number is within a range using MCP?

Use the in_range tool in your MCP-enabled editor like Cursor or Claude Code. Specify the value, minimum, maximum, and optionally whether boundaries are inclusive (default true).

What's the difference between inclusive and exclusive range checking?

Inclusive (default) includes boundary values: 5 is within [5,10]. Exclusive excludes boundaries: 5 is not within (5,10) but 6 is.

Can I use this for floating-point numbers with precision issues?

Yes, the tool handles floating-point comparisons deterministically. It uses exact comparisons, so be aware of precision limitations when working with calculated decimal values.

What happens with edge cases like infinity or NaN values?

The tool returns false for NaN inputs and handles positive/negative infinity according to mathematical rules. Infinity is greater than any finite number.

How does this compare to writing my own range validation?

TinyFn's implementation handles edge cases consistently across languages and provides standardized behavior for boundary conditions, infinity, and type coercion that custom code often misses.

Try In Range Now

Get your free API key and start using In Range in seconds.

Get Free API Key