Your agent just told a user that 17 × 23 = 391. It's actually 391? No — it's 391. Wait. It's 391. See the problem? LLMs can't reliably multiply, factor, or check primes. They guess, and sometimes they're close enough to seem right. These MCP tools give your agent a real calculator.
All Math Tools (52)
Your agent gets access to 52 math tools via the /mcp/math/ endpoint. Here's the complete list:
| Tool | Description |
|---|---|
math/is-even | Is Even |
math/is-odd | Is Odd |
math/is-prime | Is Prime |
math/is-positive | Is Positive |
math/is-negative | Is Negative |
math/is-zero | Is Zero |
math/is-integer | Is Integer |
math/is-divisible | Is Divisible |
math/is-perfect-square | Is Perfect Square |
math/is-fibonacci | Is Fibonacci |
math/factorial | Factorial |
math/fibonacci | Fibonacci |
math/gcd | Gcd |
math/lcm | Lcm |
math/abs | Absolute Value |
math/sqrt | Square Root |
math/power | Power |
math/percentage | Percentage |
math/average | Average |
math/round | Round Number |
math/clamp | Clamp |
math/distance | Distance |
math/sin | Sin |
math/cos | Cos |
math/tan | Tan |
math/deg-to-rad | Deg To Rad |
math/rad-to-deg | Rad To Deg |
math/add | Add |
math/subtract | Subtract |
math/multiply | Multiply |
math/divide | Divide |
math/modulo | Modulo |
math/log | Log |
math/log10 | Log10 |
math/log2 | Log2 |
math/exp | Exp |
math/floor | Floor |
math/ceil | Ceil |
math/min | Minimum |
math/max | Maximum |
math/sum | Sum Numbers |
math/sign | Sign |
math/truncate | Truncate |
math/hypotenuse | Hypotenuse |
math/cube | Cube |
math/cube-root | Cube Root |
math/square | Square |
math/nth-root | Nth Root |
math/compare | Compare |
math/compare-decimals | Compare Decimals |
math/rank | Rank Numbers |
math/is-between | Is Between |
Agent Scenarios
Here's how real agents use these tools:
1. E-commerce discount calculator
A shopping agent needs to calculate "25% off $79.99, then 10% tax." Instead of risking rounding errors, it calls math/percentage and math/multiply for exact totals.
math/percentage
{ "value": 79.99, "percentage": 25 }
2. Data analysis agent
An analytics agent computing GCD of sample sizes to determine valid cross-tabulations. math/gcd returns the exact answer every time.
math/gcd
{ "a": 144, "b": 60 }
3. Education chatbot
A tutoring agent checks whether a student's answer about prime numbers is correct. math/is-prime gives a definitive yes or no.
math/is-prime
{ "number": 97 }
MCP Setup
Add math tools to your agent in under 2 minutes. Choose your client:
Claude Desktop / Claude Code
Add this to your MCP config:
{
"mcpServers": {
"tinyfn-math": {
"url": "https://api.tinyfn.io/mcp/math/",
"headers": {
"X-API-Key": "your-api-key"
}
}
}
}
Cursor
Go to Settings > MCP and add a new server:
- Type: SSE
- URL:
https://api.tinyfn.io/mcp/math/sse - Headers:
X-API-Key: your-api-key
Tip: Use the category-specific endpoint (/mcp/math/) for the best experience. The all-in-one endpoint (/mcp/all/) works too but has 500+ tools which some clients handle less efficiently.
When to Use These Tools
Use math MCP tools when your agent needs to:
- Guarantee correctness — when wrong answers have real consequences
- Process user data — when you're operating on actual user input, not hypothetical examples
- Maintain consistency — when the same input must always produce the same output
You don't need these tools for casual conversation or rough estimates. Use them when precision matters.
Ready to add math tools to your agent?
Get Free API Key 100 requests/month free. No credit card required.Frequently Asked Questions
Can LLMs do basic math correctly?
LLMs can handle simple arithmetic most of the time, but they fail unpredictably on multi-step calculations, large numbers, and edge cases. MCP math tools guarantee correct results every time, eliminating the risk of silent errors.
What math operations does TinyFn support?
TinyFn provides 50+ math operations including basic arithmetic, percentages, factorials, prime checking, GCD/LCM, modulo, power, square root, absolute value, rounding, and more.
How fast are MCP math tool calls?
MCP math tool calls typically complete in under 20ms. The overhead is negligible compared to the cost of an incorrect calculation reaching your users.