---
url: 'https://adk.nht.io/api/@nhtio/adk/types/type-aliases/MessageRetrievalFn.md'
description: >-
  A function that retrieves the conversation messages relevant to the current
  turn.
---

# Type Alias: MessageRetrievalFn

```ts
type MessageRetrievalFn = (ctx: TurnContext) => Message[] | Promise<Message[]>;
```

Defined in: [lib/contracts/turn\_runner\_context.ts:114](https://github.com/NHTIO/ADK/blob/v1.20260605.0/src/lib/contracts/turn_runner_context.ts#L114)

A function that retrieves the conversation messages relevant to the current turn.

## Parameters

| Parameter | Type                                          |
| --------- | --------------------------------------------- |
| `ctx`     | [`TurnContext`](../interfaces/TurnContext.md) |

## Returns

| [`Message`](../../common/classes/Message.md)\[]
| `Promise`<[`Message`](../../common/classes/Message.md)\[]>

## Remarks

Receives the active [TurnContext](../interfaces/TurnContext.md) so implementations can apply turn-aware filtering or
windowing. Returns only `user` and `assistant` [@nhtio/adk!Message](../../common/classes/Message.md) entries — system instructions
and tool results are not part of the persisted message history.
May be synchronous or asynchronous.
