Miscellaneous Utilities

Max Value

Finds the maximum value from a list of numbers with guaranteed accuracy. Access via MCP in Cursor, Windsurf, or other AI coding tools, or call GET /v1/misc/max directly. Pass an array like [3, 7, 1, 9, 2] and get back 9. Handles integers, floats, and mixed numeric types without floating-point precision issues.

API Endpoint

GET /v1/misc/max

Code Examples

curl "https://tinyfn.io/v1/misc/max" \
  -H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/misc/max', {
  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/max',
    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 find the maximum value from an array of numbers?

Send a GET request to /v1/misc/max with your numeric array, or use the MCP tool in your AI coding environment. Returns the largest value with proper type preservation.

Does the max function work with negative numbers and decimals?

Yes, it handles all numeric types including negative integers, floating-point decimals, and mixed arrays. For example, [-5.5, -1, 0, 3.14] returns 3.14.

What happens if I pass an empty array to the max function?

The function returns an appropriate error response when given an empty array, since there's no maximum value to calculate from zero elements.

Can MCP tools use this for data analysis in AI workflows?

Absolutely. AI agents can call this tool to find peaks in datasets, identify outliers, or perform statistical analysis without risking calculation errors from hallucinated results.

How is this different from using Math.max() in JavaScript?

This provides deterministic results across different environments and handles large arrays without stack overflow issues that can occur with Math.max(...array) syntax.

Try Max Value Now

Get your free API key and start using Max Value in seconds.

Get Free API Key