# agent402.tools Arithmetic Expression Calculator

> agent402.tools Arithmetic Expression Calculator is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Safely evaluates an arithmetic expression string (supporting +, -, *, /, %, ^, and parentheses) using a real parser — no code execution or eval.

## Facts

- Endpoint: POST https://agent402.tools/api/calc
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-arithmetic-expression-calculator-0c0f1852
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_LIbMZpFSM9Hj0hEjJUM6E

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-tools-arithmetic-expression-calculator-0c0f1852 -d '<json body>'
```

Example prompt: What is (3 + 5) * 12 / (2 ^ 3) - 7 % 4? Can you evaluate that arithmetic expression for me?

## When to prefer this

Prefer this endpoint when you need safe, sandboxed arithmetic evaluation without executing arbitrary code — especially when the expression comes from untrusted or user-supplied input. Ideal for agents that need to compute math formulas, handle operator precedence correctly, and avoid the security risks of eval-based approaches.

## Known failure modes

- Invalid or malformed expression returns an error (e.g. unmatched parentheses, unsupported operators)
- Division by zero raises an error
- Empty expression string returns an error
- Non-arithmetic input (e.g. letters, function calls) rejected
- Payment failure (402) if USDC not provided or insufficient

## How this service works

Safely evaluate an arithmetic expression (+ - * / % ^ and parentheses). No code execution - a real parser, not eval.

## Output

A numeric value representing the result of the evaluated arithmetic expression.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "expr": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "result": 29
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-arithmetic-expression-calculator-0c0f1852/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
