> ## Documentation Index
> Fetch the complete documentation index at: https://graph.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# reduce

> Folds a list into one value by running the same steps for each item in order.

## How it works

* `over` must produce a list. The body (`do`) runs once per item, in order.
* `{{accumulator}}` holds the running value, starting at `initial`. Each run's result becomes the next `{{accumulator}}`.
* `{{item}}` and `{{index}}` are available too.

## Limits

* Always runs one item at a time. For independent per-item work, `map` first and reduce its results.
* The body can't contain another `map` or `reduce`.

## Input

**do** `object | object[]` *required*

**initial** `any`

Starting accumulator value (any JSON; may use templates). Defaults to null.

**over** `any` *required*

The list to fold — usually a template like \{\{E1.results}} that resolves to an array.

## Result

Later steps read these as `{{<step id>.<field>}}`.

**count** `integer`

How many items ran.

**result** `object`

The final value of the accumulator.

```yaml Plan step theme={null}
- id: E1
  tool_name: reduce
  input:
    over: "{{input.over}}"
    do: "{{input.do}}"
```

```json Result theme={null}
{
  "count": 3,
  "result": {
    "…": "…"
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.