Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.
IMentorTenantResolver interface
The IMentorTenantResolver interface of Novior.MentorAgent.Abstractions.Interfaces: Names the tenant a request belongs to, so that one instance of the…
On this page
Names the tenant a request belongs to, so that one instance of the application can serve more than one company. Without one, MentorAgent serves a single tenant, as it always has: IMentorTenant.Id is null and nothing changes.
Register it with AddMentorTenantResolver<T>(). There is one per application: a second registration throws. It is a singleton: what it needs from the request's scope it resolves from MentorTenantRequest.Services.
It is asked once for every unit of work, before anything else is done for it: when a turn starts — in a Blazor circuit, on the hub, on /mentor/chat and in a task from another agent — and for every tools/list and tools/call of the MCP server, whose calls share no scope. Its answer is what IMentorTenant.Id reads in that scope, or during that call.
A request is never served without a tenant. A resolver that throws, or answers null, an empty string or white space, refuses the request: the turn is refused before the model is called, a tools/call is answered with an error and a tools/list lists nothing. Going on as the single tenant would put the request in the data every tenant shares. A turn whose tenant differs from the one the scope's first turn had is refused as well: a conversation stays with the tenant it began with. The exception's message is never logged, only its type.
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Abstractions.Interfaces. Package: Novior.MentorAgent.Abstractions.
public interface IMentorTenantResolver
dotnet add package Novior.MentorAgent.AbstractionsMethods
Section titled “Methods”ResolveAsync
Section titled “ResolveAsync”ValueTask<string?> ResolveAsync(MentorTenantRequest request, CancellationToken cancellationToken)
The tenant request belongs to: an identifier MentorAgent uses as it is.
