API & MCP
Everything a person can do on Percentage & Ratio Calculator, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://percentageratiocalculator.usefulweb.site/api/v1/calculate– run Percentage & Ratio CalculatorGET https://percentageratiocalculator.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Percentage & Ratio Calculator
Answers every everyday percentage question (X% of Y, X is what percent of Y, percentage change, increase or decrease by a percentage, reverse percentage, percentage points versus percent) and every ratio task (simplify, scale, split an amount, aspect ratios). Each answer shows the formula and the steps.
| Field | Type | Default | Description |
|---|---|---|---|
mode | select (percent-of, what-percent, change, increase, decrease, reverse, points, ratio-simplify, ratio-scale, ratio-split, aspect) | "percent-of" | Question |
x | number | — | Value X. Percentage modes: the percentage or the start value (see the question). Aspect ratio: width. |
y | number | — | Value Y. Percentage modes: the base, end or final value. Aspect ratio: height. |
ratio | text | — | Ratio. For the ratio modes: 2 to 10 positive terms separated by ":" (e.g. 16:9, 2:3:5, 1.5:2). |
amount | number | — | Amount. Split: the total to share out. Scale: the value the chosen term should become. |
scaleTerm | integer | 1 | Term to scale. Scale mode: which ratio term (1 = first) should equal the amount. |
newWidth | number | — | New width. Aspect ratio: optional; the matching height is calculated. |
newHeight | number | — | New height. Aspect ratio: optional; the matching width is calculated. |
decimals | integer | 2 | Decimal places. Rounding of the displayed answer and of split amounts (2 = cents). |
Example request
What is 15% of 80?
curl -X POST https://percentageratiocalculator.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"mode":"percent-of","x":15,"y":80}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://percentageratiocalculator.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
percentage_ratio_calculator - Local stdio connector:
node src/mcp-stdio.ts --tool=percentage-ratio-calculator
{
"mcpServers": {
"percentage-ratio-calculator": { "type": "http", "url": "https://percentageratiocalculator.usefulweb.site/mcp" }
}
}