Math Utilities

Minimum

Returns the smallest value from a list of numbers with guaranteed accuracy. Available via MCP in AI coding tools like Cursor and Windsurf, or REST API at `/v1/math/min`. Pass an array `[5, 2, 9, 1]` and get `1`. Handles integers, floats, and negative numbers without floating-point precision issues that plague native implementations.

API Endpoint

GET /v1/math/min

Code Examples

curl "https://tinyfn.io/v1/math/min" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/math/min', {
  headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests

response = requests.get('https://tinyfn.io/v1/math/min',
    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 math tools:

{
  "mcpServers": {
    "tinyfn-math": {
      "url": "https://tinyfn.io/mcp/math",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Learn more about MCP setup →

FAQ

How do I find the minimum value in an array using MCP?

Call the min tool with your number array. In Cursor or other MCP clients, it returns the exact smallest value without JavaScript's floating-point quirks.

What happens when I pass an empty array to the min function?

The function returns an error since there's no minimum value in an empty set. Always validate your input arrays have at least one element.

Can the min function handle negative numbers and decimals?

Yes, it processes integers, floats, and negative numbers correctly. For example, `[-3.5, 2, -10, 0.1]` returns `-10`.

Why use TinyFn's min instead of native language functions?

TinyFn provides deterministic results across different environments and avoids floating-point precision errors that can occur in native implementations.

What's the REST API format for finding minimum values?

Send a GET request to `/v1/math/min` with your numbers as query parameters or in the request body, depending on the API specification.

Try Minimum Now

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

Get Free API Key