MentorAgent Docs
Menu

ReferencePackage: Novior.MentorAgent.Server

MentorEndpointActionExtensions class

Story 1287 — an endpoint of the application as an action of the coordinator, without writing it again:

View as Markdown
On this page
Example
app.MapPost("/orders/{id}/cancel", CancelOrder)
   .WithName("CancelOrder")
   .WithMentorAction(a => a.Describe("Cancels an order").RequireRoles("Manager"));

The action runs the endpoint itself, in the process, as the user of the turn: its authorization first, then its filters, its binding and its validation. A controller's action is declared with [MentorAction] on its method. Needs AddMentorAgentServer().

Namespace: Novior.MentorAgent.Server.Extensions. Package: Novior.MentorAgent.Server.

public static class MentorEndpointActionExtensions

Terminal
dotnet add package Novior.MentorAgent.Server

public static TBuilder WithMentorAction<TBuilder>(this TBuilder builder, Action<MentorActionBuilder> configure)

Declares the endpoint as an action of the coordinator, named after the endpoint's name (WithName) or its handler's method, in snake_case. A lambda without WithName needs MentorEndpointActionExtensions.WithMentorAction.

public static TBuilder WithMentorAction<TBuilder>(this TBuilder builder, string name, Action<MentorActionBuilder> configure)

Declares the endpoint as an action of the coordinator named name, as a model's tool name: letters, digits, _ and -, up to 64.