---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/context/thrift/contracts/type-aliases/ShedRankFn.md
description: >-
  Ranks a tool by last-resort shed priority: LOWER rank sheds FIRST. Ties are
  broken by encounter order (a stable sort), so two tools ranked equally shed in
  whatever order the caller's `relevantToolNames` listed them.
---

# Type Alias: ShedRankFn

```ts
type ShedRankFn = (name: string) => number;
```

Defined in: [src/batteries/context/thrift/contracts.ts:277](https://github.com/NHTIO/ADK/blob/v1.20261003.0/src/src/batteries/context/thrift/contracts.ts#L277)

Ranks a tool by last-resort shed priority: LOWER rank sheds FIRST. Ties are broken by encounter
order (a stable sort), so two tools ranked equally shed in whatever order the caller's
`relevantToolNames` listed them.

## Parameters

| Parameter | Type     | Description                 |
| --------- | -------- | --------------------------- |
| `name`    | `string` | The tool's registered name. |

## Returns

`number`

A rank; lower sheds first. Any finite number is valid — there is no required range.

## Remarks

This replaces a hard-coded, domain-specific tier list (the flagship agent's `TOOL_SHED_ORDER`,
which knew tool names like `provide_answer` and `search_docs_semantic`) with an INJECTABLE policy.
The battery ships a generic default (see the `shedRank` option on
[@nhtio/adk/batteries/context/thrift/subtractive\_pass!subtractToFit](../../subtractive_pass/functions/subtractToFit.md)) that treats every tool
equally — it has no domain knowledge of which of a caller's tools are "delivery" tools vs. "gather"
tools vs. "exotic reader" tools. A caller who DOES have that knowledge (as the flagship agent does)
should supply a `ShedRankFn` that encodes it, exactly as the flagship's own `TOOL_SHED_ORDER`-derived
function did in production.
