Calculate a percentage from an AI agent

You need a percentage worked out exactly: 18 percent of 250, what percent 45 is of 250, the change from 80 to 100, a price after a 20 percent increase, or the amount before a percentage was added.

Use percent-compute@1.0.0. It is free and needs no key or sign-up. Exact percentage of, ratio, change, increase, decrease and reverse percentage, rounded once at a chosen scale.

Why call a tool for this

Percent arithmetic is short, but a slipped decimal place gives a confident wrong number. The tool works on decimal strings, rounds once at the scale you choose, and says whether the result is exact. For example, mode of with percent 18 and value 250 returns 45.00, and mode change from 80 to 100 returns 25.00.

Call it over HTTP

curl -X POST https://computefirst.net/v1/tools/percent-compute/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"mode":"of","percent":"20","value":"150","scale":2,"rounding":"half_even"}'

Response:

{
  "result": {
    "result": "30.00",
    "exact": true,
    "mode": "of"
  }
}

Call it over MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "percent-compute",
  "version": "1.0.0",
  "input": {
    "mode": "of",
    "percent": "20",
    "value": "150",
    "scale": 2,
    "rounding": "half_even"
  }
}

Check the result

Every call needs mode, scale and rounding. Pick the mode first: of, ratio, change, increase, decrease or reverse. Each mode takes its own fields (percent and value, part and whole, or from and to). Numbers are strings such as "18" or "2.5", and the percent is a number of percent, not a fraction, so 18 means 18 percent. A zero whole or a zero starting amount returns not_computable. Rounding unnecessary returns not_computable when the result would need rounding.

Full contract, limits and unsupported cases: Percent compute.