# Array rational sum

`array-rational-sum` · version 1.0.0 · Numbers & math · free, no key needed

Sum an array of canonical rationals and return the reduced total.

**Use when you need to: array rational sum · sum an array of rationals · add a list of fractions.**

## Supported

- array rational sum
- sum an array of rationals
- add a list of fractions
- total of rational numbers

## Not supported

- mean of rationals
- min and max of rationals
- floating-point sum
- decimal string sum
- CSV column sum
- IEEE-754 arithmetic

## Behavior

- Input values is an array of rational objects with canonical integer-string numerator and denominator.
- Each denominator must be a positive canonical integer; zero and negative denominators are rejected.
- An empty array sums to numerator 0 over denominator 1.
- The running total is reduced by gcd after each addition, with the sign only on the numerator.
- Zero is always numerator 0 over denominator 1.
- At most 10000 values. After reduction, numerator and denominator may each have at most 1000 digits excluding sign.

## Input

- `values` (array of object, required): max items 10000

## Output

- `numerator` (string, required)
- `denominator` (string, required)

## Limits

- max values: 10000
- max digits: 1000

## Example

Request input:

```json
{
  "values": [
    {
      "numerator": "1",
      "denominator": "2"
    },
    {
      "numerator": "1",
      "denominator": "3"
    },
    {
      "numerator": "1",
      "denominator": "6"
    }
  ]
}
```

Response:

```json
{
  "result": {
    "numerator": "1",
    "denominator": "1"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "array-rational-sum",
  "version": "1.0.0",
  "input": {
    "values": [
      {
        "numerator": "1",
        "denominator": "2"
      },
      {
        "numerator": "1",
        "denominator": "3"
      },
      {
        "numerator": "1",
        "denominator": "6"
      }
    ]
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/array-rational-sum/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"values":[{"numerator":"1","denominator":"2"},{"numerator":"1","denominator":"3"},{"numerator":"1","denominator":"6"}]}'
```

The machine-readable contract is at [/v1/tools/array-rational-sum/versions/1.0.0](/v1/tools/array-rational-sum/versions/1.0.0).

### CLI

```sh
node cli.mjs run array-rational-sum 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Array rational mean](/tools/array-rational-mean): Return the reduced arithmetic mean of an array of canonical rationals.
- [Array rational min max](/tools/array-rational-min-max): Return the reduced numeric minimum and maximum of an array of canonical rationals.
- [Rational add](/tools/rational-add): Add two rational numbers given as numerator/denominator integer strings and return the reduced sum.
- [Array integer GCD](/tools/array-integer-gcd): Compute the non-negative greatest common divisor of an array of canonical integer strings.
- [Array integer LCM](/tools/array-integer-lcm): Compute the non-negative least common multiple of an array of canonical integer strings.
- [Rational multiply](/tools/rational-multiply): Multiply two rational numbers given as numerator/denominator integer strings and return the reduced product.
