> ## 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.

# builtin__sort

> Sorts a list by a field, with no model call.

## Behavior

* `by` is the field, as a dot path such as `score` or `meta.date`. Without `by`, the items themselves are compared.
* `order` is `asc` (the default) or `desc`.
* Numbers compare as numbers and strings as text, so ISO dates sort correctly. The sort is stable.
* Items missing the field go last in either order.

## When to use it

* Ordering by a value the items already carry: a date, a count, a score from an earlier step.
* To order items by how well they fit a question, use [`builtin__rank`](https://graph.mintlify.site/tools/reference/builtin/rank).

| Available to | Effect |
| - | - |
| Any agent or plan step | Read-only |

## Input

**by** `string`

Dot path into each item to sort on, e.g. `url` or `meta.date`

**items** `any[]` *required*

The list, usually a template like \{\{E1.results}}

**order** `enum\<string\>`

Default asc

Available options: `asc`, `desc`

## Output

**items** `any[]` *required*

```yaml Plan step theme={null}
- id: E1
  tool_name: builtin__sort
  input:
    items: "{{input.items}}"
```


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