# MentorRagRequest class

> What a search is for: the user's message and the context it was asked in. Passed to IMentorRagSource.SearchAsync before every turn when UseRag is on.

- URL: https://docs.mentoragent.net/api/novior-mentoragent-rag/mentorragrequest
- Verified with: MentorAgent 1.2.0
- Last updated: 2026-10-27
- Packages: Novior.MentorAgent

A source that only needs the text keeps implementing [`IMentorRagSource.SearchAsync`](https://docs.mentoragent.net/api/novior-mentoragent-rag/imentorragsource#searchasync): the default implementation of the request overload calls it with [`MentorRagRequest.Query`](https://docs.mentoragent.net/api/novior-mentoragent-rag/mentorragrequest#query) and [`MentorRagRequest.MaxResults`](https://docs.mentoragent.net/api/novior-mentoragent-rag/mentorragrequest#maxresults). A source that filters by user, page or conversation implements this one.

A class with init-only properties rather than a parameter list, so that what a search can know can grow — a tenant, for one — without breaking a source that already implements it.

## Definition

Namespace: `Novior.MentorAgent.Rag`. Package: `Novior.MentorAgent`.

`public sealed class MentorRagRequest`

```shell
dotnet add package Novior.MentorAgent
```

## Constructors

`public MentorRagRequest()`

## Properties

### `MaxResults`

`public int MaxResults { get; init; }`

Maximum number of documents to return (`RagResultCount`).

### `PageData`

`public IReadOnlyDictionary<string, object?> PageData { get; init; }`

The data the current page put in context with `IMentorPageContext.Set` — the same entries the model is shown. Empty when no page has set any.

### `PageName`

`public string? PageName { get; init; }`

The current page's name, as the page set it with `IMentorPageContext.SetPageName`.

### `Query`

`public required string Query { get; init; }`

The user's message for this turn.

### `RecentMessages`

`public IReadOnlyList<ChatMessage> RecentMessages { get; init; }`

The conversation before this message, oldest first: the user's messages and the assistant's replies of the last turns in this session, text only (up to six messages). Empty on the first turn, after a reset, and after a session is restored. Lets a source resolve "and the second one?" against what was said before.

### `User`

`public ClaimsPrincipal? User { get; init; }`

Who is asking: the caller of the hub, of `/mentor/chat` or of an A2A request, and in a Blazor circuit the user the host's `AuthenticationStateProvider` reports. `null` when the host has no authentication at all. An anonymous visitor, or a peer agent that did not authenticate, has an unauthenticated principal. A source that applies per-user permissions should treat both as "no access to anything restricted".

---

- Previous: [IMentorRagSource interface](https://docs.mentoragent.net/api/novior-mentoragent-rag/imentorragsource.md)
- Next: [A2ADetailBar class](https://docs.mentoragent.net/api/novior-mentoragent-abstractions-components/a2adetailbar.md)
